github.com/df-mc/dragonfly@v0.9.13/server/item/enchantment/power.go (about)

     1  package enchantment
     2  
     3  import (
     4  	"github.com/df-mc/dragonfly/server/item"
     5  	"github.com/df-mc/dragonfly/server/world"
     6  )
     7  
     8  // Power is a bow enchantment which increases arrow damage.
     9  type Power struct{}
    10  
    11  // Name ...
    12  func (Power) Name() string {
    13  	return "Power"
    14  }
    15  
    16  // MaxLevel ...
    17  func (Power) MaxLevel() int {
    18  	return 5
    19  }
    20  
    21  // Cost ...
    22  func (Power) Cost(level int) (int, int) {
    23  	min := 1 + (level-1)*10
    24  	return min, min + 15
    25  }
    26  
    27  // Rarity ...
    28  func (Power) Rarity() item.EnchantmentRarity {
    29  	return item.EnchantmentRarityCommon
    30  }
    31  
    32  // PowerDamage returns the extra base damage dealt by the enchantment and level.
    33  func (Power) PowerDamage(level int) float64 {
    34  	return float64(level+1) * 0.5
    35  }
    36  
    37  // CompatibleWithEnchantment ...
    38  func (Power) CompatibleWithEnchantment(item.EnchantmentType) bool {
    39  	return true
    40  }
    41  
    42  // CompatibleWithItem ...
    43  func (Power) CompatibleWithItem(i world.Item) bool {
    44  	_, ok := i.(item.Bow)
    45  	return ok
    46  }