enchantment

package
v0.0.0-...-183dbea Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 29, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ProtectionFactor

func ProtectionFactor(src world.DamageSource, enchantments []item.Enchantment) float64

ProtectionFactor calculates the combined protection factor for a slice of item.Enchantment. The factor depends on the world.DamageSource passed and is in a range of [0, 0.8], where 0.8 means incoming damage would be reduced by 80%.

Types

type AffectedDamageSource

type AffectedDamageSource interface {
	world.DamageSource
	// AffectedByEnchantment specifies if a world.DamageSource is affected by
	// the item.EnchantmentType passed.
	AffectedByEnchantment(e item.EnchantmentType) bool
}

AffectedDamageSource represents a world.DamageSource whose damage may be affected by an enchantment. A world.DamageSource does not need to implement AffectedDamageSource to let Protection affect the damage. This happens depending on the (world.DamageSource).ReducedByResistance() method.

type AquaAffinity

type AquaAffinity struct{}

AquaAffinity is a helmet enchantment that increases underwater mining speed.

func (AquaAffinity) CompatibleWithEnchantment

func (AquaAffinity) CompatibleWithEnchantment(item.EnchantmentType) bool

CompatibleWithEnchantment ...

func (AquaAffinity) CompatibleWithItem

func (AquaAffinity) CompatibleWithItem(i world.Item) bool

CompatibleWithItem ...

func (AquaAffinity) Cost

func (AquaAffinity) Cost(int) (int, int)

Cost ...

func (AquaAffinity) MaxLevel

func (AquaAffinity) MaxLevel() int

MaxLevel ...

func (AquaAffinity) Name

func (AquaAffinity) Name() string

Name ...

func (AquaAffinity) Rarity

Rarity ...

type BlastProtection

type BlastProtection struct{}

BlastProtection is an armour enchantment that reduces damage from explosions.

func (BlastProtection) CompatibleWithEnchantment

func (BlastProtection) CompatibleWithEnchantment(t item.EnchantmentType) bool

CompatibleWithEnchantment ...

func (BlastProtection) CompatibleWithItem

func (BlastProtection) CompatibleWithItem(i world.Item) bool

CompatibleWithItem ...

func (BlastProtection) Cost

func (BlastProtection) Cost(level int) (int, int)

Cost ...

func (BlastProtection) MaxLevel

func (BlastProtection) MaxLevel() int

MaxLevel ...

func (BlastProtection) Modifier

func (BlastProtection) Modifier() float64

Modifier returns the base protection modifier for the enchantment.

func (BlastProtection) Name

func (BlastProtection) Name() string

Name ...

func (BlastProtection) Rarity

Rarity ...

type CurseOfVanishing

type CurseOfVanishing struct{}

CurseOfVanishing is an enchantment that causes the item to disappear on death.

func (CurseOfVanishing) CompatibleWithEnchantment

func (CurseOfVanishing) CompatibleWithEnchantment(t item.EnchantmentType) bool

CompatibleWithEnchantment ...

func (CurseOfVanishing) CompatibleWithItem

func (CurseOfVanishing) CompatibleWithItem(i world.Item) bool

CompatibleWithItem ...

func (CurseOfVanishing) Cost

func (CurseOfVanishing) Cost(int) (int, int)

Cost ...

func (CurseOfVanishing) Curse

func (CurseOfVanishing) Curse() bool

Curse ...

func (CurseOfVanishing) MaxLevel

func (CurseOfVanishing) MaxLevel() int

MaxLevel ...

func (CurseOfVanishing) Name

func (CurseOfVanishing) Name() string

Name ...

func (CurseOfVanishing) Rarity

Rarity ...

func (CurseOfVanishing) Treasure

func (CurseOfVanishing) Treasure() bool

Treasure ...

type DamageModifier

type DamageModifier interface {
	Modifier() float64
}

DamageModifier is an item.EnchantmentType that can reduce damage through a modifier if an AffectedDamageSource returns true for it.

type DepthStrider

type DepthStrider struct{}

DepthStrider is a boot enchantment that increases underwater movement speed.

func (DepthStrider) CompatibleWithEnchantment

func (DepthStrider) CompatibleWithEnchantment(item.EnchantmentType) bool

CompatibleWithEnchantment ...

func (DepthStrider) CompatibleWithItem

func (DepthStrider) CompatibleWithItem(i world.Item) bool

CompatibleWithItem ...

func (DepthStrider) Cost

func (DepthStrider) Cost(level int) (int, int)

Cost ...

func (DepthStrider) MaxLevel

func (DepthStrider) MaxLevel() int

MaxLevel ...

func (DepthStrider) Name

func (DepthStrider) Name() string

Name ...

func (DepthStrider) Rarity

Rarity ...

type Efficiency

type Efficiency struct{}

Efficiency is an enchantment that increases mining speed.

func (Efficiency) Addend

func (Efficiency) Addend(level int) float64

Addend returns the mining speed addend from efficiency.

func (Efficiency) CompatibleWithEnchantment

func (Efficiency) CompatibleWithEnchantment(item.EnchantmentType) bool

CompatibleWithEnchantment ...

func (Efficiency) CompatibleWithItem

func (Efficiency) CompatibleWithItem(i world.Item) bool

CompatibleWithItem ...

func (Efficiency) Cost

func (Efficiency) Cost(level int) (int, int)

Cost ...

func (Efficiency) MaxLevel

func (Efficiency) MaxLevel() int

MaxLevel ...

func (Efficiency) Name

func (Efficiency) Name() string

Name ...

func (Efficiency) Rarity

Rarity ...

type FeatherFalling

type FeatherFalling struct{}

FeatherFalling is an enchantment to boots that reduces fall damage. It does not affect falling speed.

func (FeatherFalling) CompatibleWithEnchantment

func (FeatherFalling) CompatibleWithEnchantment(item.EnchantmentType) bool

CompatibleWithEnchantment ...

func (FeatherFalling) CompatibleWithItem

func (FeatherFalling) CompatibleWithItem(i world.Item) bool

CompatibleWithItem ...

func (FeatherFalling) Cost

func (FeatherFalling) Cost(level int) (int, int)

Cost ...

func (FeatherFalling) MaxLevel

func (FeatherFalling) MaxLevel() int

MaxLevel ...

func (FeatherFalling) Modifier

func (FeatherFalling) Modifier() float64

Modifier returns the base protection modifier for the enchantment.

func (FeatherFalling) Name

func (FeatherFalling) Name() string

Name ...

func (FeatherFalling) Rarity

Rarity ...

type FireAspect

type FireAspect struct{}

FireAspect is a sword enchantment that sets the target on fire.

func (FireAspect) CompatibleWithEnchantment

func (FireAspect) CompatibleWithEnchantment(item.EnchantmentType) bool

CompatibleWithEnchantment ...

func (FireAspect) CompatibleWithItem

func (FireAspect) CompatibleWithItem(i world.Item) bool

CompatibleWithItem ...

func (FireAspect) Cost

func (FireAspect) Cost(level int) (int, int)

Cost ...

func (FireAspect) Duration

func (FireAspect) Duration(level int) time.Duration

Duration returns how long the fire from fire aspect will last.

func (FireAspect) MaxLevel

func (FireAspect) MaxLevel() int

MaxLevel ...

func (FireAspect) Name

func (FireAspect) Name() string

Name ...

func (FireAspect) Rarity

Rarity ...

type FireProtection

type FireProtection struct{}

FireProtection is an armour enchantment that decreases fire damage.

func (FireProtection) CompatibleWithEnchantment

func (FireProtection) CompatibleWithEnchantment(t item.EnchantmentType) bool

CompatibleWithEnchantment ...

func (FireProtection) CompatibleWithItem

func (FireProtection) CompatibleWithItem(i world.Item) bool

CompatibleWithItem ...

func (FireProtection) Cost

func (FireProtection) Cost(level int) (int, int)

Cost ...

func (FireProtection) MaxLevel

func (FireProtection) MaxLevel() int

MaxLevel ...

func (FireProtection) Modifier

func (FireProtection) Modifier() float64

Modifier returns the base protection modifier for the enchantment.

func (FireProtection) Name

func (FireProtection) Name() string

Name ...

func (FireProtection) Rarity

Rarity ...

type Flame

type Flame struct{}

Flame turns your arrows into flaming arrows allowing you to set your targets on fire.

func (Flame) BurnDuration

func (Flame) BurnDuration() time.Duration

BurnDuration always returns a hundred seconds, no matter the level.

func (Flame) CompatibleWithEnchantment

func (Flame) CompatibleWithEnchantment(item.EnchantmentType) bool

CompatibleWithEnchantment ...

func (Flame) CompatibleWithItem

func (Flame) CompatibleWithItem(i world.Item) bool

CompatibleWithItem ...

func (Flame) Cost

func (Flame) Cost(int) (int, int)

Cost ...

func (Flame) MaxLevel

func (Flame) MaxLevel() int

MaxLevel ...

func (Flame) Name

func (Flame) Name() string

Name ...

func (Flame) Rarity

func (Flame) Rarity() item.EnchantmentRarity

Rarity ...

type Infinity

type Infinity struct{}

Infinity is an enchantment to bows that prevents regular arrows from being consumed when shot.

func (Infinity) CompatibleWithEnchantment

func (Infinity) CompatibleWithEnchantment(t item.EnchantmentType) bool

CompatibleWithEnchantment ...

func (Infinity) CompatibleWithItem

func (Infinity) CompatibleWithItem(i world.Item) bool

CompatibleWithItem ...

func (Infinity) ConsumesArrows

func (Infinity) ConsumesArrows() bool

ConsumesArrows always returns false.

func (Infinity) Cost

func (Infinity) Cost(int) (int, int)

Cost ...

func (Infinity) MaxLevel

func (Infinity) MaxLevel() int

MaxLevel ...

func (Infinity) Name

func (Infinity) Name() string

Name ...

func (Infinity) Rarity

func (Infinity) Rarity() item.EnchantmentRarity

Rarity ...

type KnockBack

type KnockBack struct{}

KnockBack is an enchantment to a sword that increases the sword's knock-back.

func (KnockBack) CompatibleWithEnchantment

func (KnockBack) CompatibleWithEnchantment(item.EnchantmentType) bool

CompatibleWithEnchantment ...

func (KnockBack) CompatibleWithItem

func (KnockBack) CompatibleWithItem(i world.Item) bool

CompatibleWithItem ...

func (KnockBack) Cost

func (KnockBack) Cost(level int) (int, int)

Cost ...

func (KnockBack) Force

func (KnockBack) Force(level int) float64

Force returns the increase in knock-back force from the enchantment.

func (KnockBack) MaxLevel

func (KnockBack) MaxLevel() int

MaxLevel ...

func (KnockBack) Name

func (KnockBack) Name() string

Name ...

func (KnockBack) Rarity

func (KnockBack) Rarity() item.EnchantmentRarity

Rarity ...

type Mending

type Mending struct{}

Mending is an enchantment that repairs the item when experience orbs are collected.

func (Mending) CompatibleWithEnchantment

func (Mending) CompatibleWithEnchantment(t item.EnchantmentType) bool

CompatibleWithEnchantment ...

func (Mending) CompatibleWithItem

func (Mending) CompatibleWithItem(i world.Item) bool

CompatibleWithItem ...

func (Mending) Cost

func (Mending) Cost(level int) (int, int)

Cost ...

func (Mending) MaxLevel

func (Mending) MaxLevel() int

MaxLevel ...

func (Mending) Name

func (Mending) Name() string

Name ...

func (Mending) Rarity

func (Mending) Rarity() item.EnchantmentRarity

Rarity ...

func (Mending) Treasure

func (Mending) Treasure() bool

Treasure ...

type Power

type Power struct{}

Power is a bow enchantment which increases arrow damage.

func (Power) CompatibleWithEnchantment

func (Power) CompatibleWithEnchantment(item.EnchantmentType) bool

CompatibleWithEnchantment ...

func (Power) CompatibleWithItem

func (Power) CompatibleWithItem(i world.Item) bool

CompatibleWithItem ...

func (Power) Cost

func (Power) Cost(level int) (int, int)

Cost ...

func (Power) MaxLevel

func (Power) MaxLevel() int

MaxLevel ...

func (Power) Name

func (Power) Name() string

Name ...

func (Power) PowerDamage

func (Power) PowerDamage(level int) float64

PowerDamage returns the extra base damage dealt by the enchantment and level.

func (Power) Rarity

func (Power) Rarity() item.EnchantmentRarity

Rarity ...

type ProjectileProtection

type ProjectileProtection struct{}

ProjectileProtection is an armour enchantment that reduces damage from projectiles.

func (ProjectileProtection) CompatibleWithEnchantment

func (ProjectileProtection) CompatibleWithEnchantment(t item.EnchantmentType) bool

CompatibleWithEnchantment ...

func (ProjectileProtection) CompatibleWithItem

func (ProjectileProtection) CompatibleWithItem(i world.Item) bool

CompatibleWithItem ...

func (ProjectileProtection) Cost

func (ProjectileProtection) Cost(level int) (int, int)

Cost ...

func (ProjectileProtection) MaxLevel

func (ProjectileProtection) MaxLevel() int

MaxLevel ...

func (ProjectileProtection) Modifier

func (ProjectileProtection) Modifier() float64

Modifier returns the base protection modifier for the enchantment.

func (ProjectileProtection) Name

Name ...

func (ProjectileProtection) Rarity

Rarity ...

type Protection

type Protection struct{}

Protection is an armour enchantment which increases the damage reduction.

func (Protection) CompatibleWithEnchantment

func (Protection) CompatibleWithEnchantment(t item.EnchantmentType) bool

CompatibleWithEnchantment ...

func (Protection) CompatibleWithItem

func (Protection) CompatibleWithItem(i world.Item) bool

CompatibleWithItem ...

func (Protection) Cost

func (Protection) Cost(level int) (int, int)

Cost ...

func (Protection) MaxLevel

func (Protection) MaxLevel() int

MaxLevel ...

func (Protection) Modifier

func (Protection) Modifier() float64

Modifier returns the base protection modifier for the enchantment.

func (Protection) Name

func (Protection) Name() string

Name ...

func (Protection) Rarity

Rarity ...

type Punch

type Punch struct{}

Punch increases the knock-back dealt when hitting a player or mob with a bow.

func (Punch) CompatibleWithEnchantment

func (Punch) CompatibleWithEnchantment(item.EnchantmentType) bool

CompatibleWithEnchantment ...

func (Punch) CompatibleWithItem

func (Punch) CompatibleWithItem(i world.Item) bool

CompatibleWithItem ...

func (Punch) Cost

func (Punch) Cost(level int) (int, int)

Cost ...

func (Punch) KnockBackMultiplier

func (Punch) KnockBackMultiplier() float64

KnockBackMultiplier returns the punch multiplier for the level and horizontal speed.

func (Punch) MaxLevel

func (Punch) MaxLevel() int

MaxLevel ...

func (Punch) Name

func (Punch) Name() string

Name ...

func (Punch) Rarity

func (Punch) Rarity() item.EnchantmentRarity

Rarity ...

type Respiration

type Respiration struct{}

Respiration extends underwater breathing time by +15 seconds per enchantment level in addition to the default time of 15 seconds.

func (Respiration) Chance

func (Respiration) Chance(level int) float64

Chance returns the chance of the enchantment blocking the air supply from ticking.

func (Respiration) CompatibleWithEnchantment

func (Respiration) CompatibleWithEnchantment(item.EnchantmentType) bool

CompatibleWithEnchantment ...

func (Respiration) CompatibleWithItem

func (Respiration) CompatibleWithItem(i world.Item) bool

CompatibleWithItem ...

func (Respiration) Cost

func (Respiration) Cost(level int) (int, int)

Cost ...

func (Respiration) MaxLevel

func (Respiration) MaxLevel() int

MaxLevel ...

func (Respiration) Name

func (Respiration) Name() string

Name ...

func (Respiration) Rarity

Rarity ...

type Sharpness

type Sharpness struct{}

Sharpness is an enchantment applied to a sword or axe that increases melee damage.

func (Sharpness) Addend

func (Sharpness) Addend(level int) float64

Addend returns the additional damage when attacking with sharpness.

func (Sharpness) CompatibleWithEnchantment

func (Sharpness) CompatibleWithEnchantment(item.EnchantmentType) bool

CompatibleWithEnchantment ...

func (Sharpness) CompatibleWithItem

func (Sharpness) CompatibleWithItem(i world.Item) bool

CompatibleWithItem ...

func (Sharpness) Cost

func (Sharpness) Cost(level int) (int, int)

Cost ...

func (Sharpness) MaxLevel

func (Sharpness) MaxLevel() int

MaxLevel ...

func (Sharpness) Name

func (Sharpness) Name() string

Name ...

func (Sharpness) Rarity

func (Sharpness) Rarity() item.EnchantmentRarity

Rarity ...

type SilkTouch

type SilkTouch struct{}

SilkTouch is an enchantment that allows many blocks to drop themselves instead of their usual items when mined.

func (SilkTouch) CompatibleWithEnchantment

func (SilkTouch) CompatibleWithEnchantment(item.EnchantmentType) bool

CompatibleWithEnchantment ...

func (SilkTouch) CompatibleWithItem

func (SilkTouch) CompatibleWithItem(i world.Item) bool

CompatibleWithItem ...

func (SilkTouch) Cost

func (SilkTouch) Cost(int) (int, int)

Cost ...

func (SilkTouch) MaxLevel

func (SilkTouch) MaxLevel() int

MaxLevel ...

func (SilkTouch) Name

func (SilkTouch) Name() string

Name ...

func (SilkTouch) Rarity

func (SilkTouch) Rarity() item.EnchantmentRarity

Rarity ...

type SoulSpeed

type SoulSpeed struct{}

SoulSpeed is an enchantment that can be applied on boots and allows the player to walk more quickly on soul sand or soul soil.

func (SoulSpeed) CompatibleWithEnchantment

func (SoulSpeed) CompatibleWithEnchantment(item.EnchantmentType) bool

CompatibleWithEnchantment ...

func (SoulSpeed) CompatibleWithItem

func (SoulSpeed) CompatibleWithItem(i world.Item) bool

CompatibleWithItem ...

func (SoulSpeed) Cost

func (SoulSpeed) Cost(level int) (int, int)

Cost ...

func (SoulSpeed) MaxLevel

func (SoulSpeed) MaxLevel() int

MaxLevel ...

func (SoulSpeed) Name

func (SoulSpeed) Name() string

Name ...

func (SoulSpeed) Rarity

func (SoulSpeed) Rarity() item.EnchantmentRarity

Rarity ...

func (SoulSpeed) Treasure

func (SoulSpeed) Treasure() bool

Treasure ...

type SwiftSneak

type SwiftSneak struct{}

SwiftSneak is a non-renewable enchantment that can be applied to leggings and allows the player to walk more quickly while sneaking.

func (SwiftSneak) CompatibleWithEnchantment

func (SwiftSneak) CompatibleWithEnchantment(item.EnchantmentType) bool

CompatibleWithEnchantment ...

func (SwiftSneak) CompatibleWithItem

func (SwiftSneak) CompatibleWithItem(i world.Item) bool

CompatibleWithItem ...

func (SwiftSneak) Cost

func (SwiftSneak) Cost(level int) (int, int)

Cost ...

func (SwiftSneak) MaxLevel

func (SwiftSneak) MaxLevel() int

MaxLevel ...

func (SwiftSneak) Name

func (SwiftSneak) Name() string

Name ...

func (SwiftSneak) Rarity

Rarity ...

func (SwiftSneak) Treasure

func (SwiftSneak) Treasure() bool

Treasure ...

type Thorns

type Thorns struct{}

Thorns is an enchantment that inflicts damage on attackers.

func (Thorns) CompatibleWithEnchantment

func (Thorns) CompatibleWithEnchantment(item.EnchantmentType) bool

CompatibleWithEnchantment ...

func (Thorns) CompatibleWithItem

func (Thorns) CompatibleWithItem(i world.Item) bool

CompatibleWithItem ...

func (Thorns) Cost

func (Thorns) Cost(level int) (int, int)

Cost ...

func (Thorns) MaxLevel

func (Thorns) MaxLevel() int

MaxLevel ...

func (Thorns) Name

func (Thorns) Name() string

Name ...

func (Thorns) Rarity

func (Thorns) Rarity() item.EnchantmentRarity

Rarity ...

type ThornsDamageSource

type ThornsDamageSource struct {
	// Owner is the owner of the armour with the Thorns enchantment.
	Owner world.Entity
}

ThornsDamageSource is used for damage caused by thorns.

func (ThornsDamageSource) Fire

func (ThornsDamageSource) Fire() bool

func (ThornsDamageSource) ReducedByArmour

func (ThornsDamageSource) ReducedByArmour() bool

func (ThornsDamageSource) ReducedByResistance

func (ThornsDamageSource) ReducedByResistance() bool

type Unbreaking

type Unbreaking struct{}

Unbreaking is an enchantment that gives a chance for an item to avoid durability reduction when it is used, effectively increasing the item's durability.

func (Unbreaking) CompatibleWithEnchantment

func (Unbreaking) CompatibleWithEnchantment(item.EnchantmentType) bool

CompatibleWithEnchantment ...

func (Unbreaking) CompatibleWithItem

func (Unbreaking) CompatibleWithItem(i world.Item) bool

CompatibleWithItem ...

func (Unbreaking) Cost

func (Unbreaking) Cost(level int) (int, int)

Cost ...

func (Unbreaking) MaxLevel

func (Unbreaking) MaxLevel() int

MaxLevel ...

func (Unbreaking) Name

func (Unbreaking) Name() string

Name ...

func (Unbreaking) Rarity

Rarity ...

func (Unbreaking) Reduce

func (Unbreaking) Reduce(it world.Item, level, amount int) int

Reduce returns the amount of damage that should be reduced with unbreaking.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL