github.com/df-mc/dragonfly@v0.9.13/server/item/enchantment/punch.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  // Punch increases the knock-back dealt when hitting a player or mob with a bow.
     9  type Punch struct{}
    10  
    11  // Name ...
    12  func (Punch) Name() string {
    13  	return "Punch"
    14  }
    15  
    16  // MaxLevel ...
    17  func (Punch) MaxLevel() int {
    18  	return 2
    19  }
    20  
    21  // Cost ...
    22  func (Punch) Cost(level int) (int, int) {
    23  	min := 12 + (level-1)*20
    24  	return min, min + 25
    25  }
    26  
    27  // Rarity ...
    28  func (Punch) Rarity() item.EnchantmentRarity {
    29  	return item.EnchantmentRarityRare
    30  }
    31  
    32  // KnockBackMultiplier returns the punch multiplier for the level and horizontal speed.
    33  func (Punch) KnockBackMultiplier() float64 {
    34  	return 0.25
    35  }
    36  
    37  // CompatibleWithEnchantment ...
    38  func (Punch) CompatibleWithEnchantment(item.EnchantmentType) bool {
    39  	return true
    40  }
    41  
    42  // CompatibleWithItem ...
    43  func (Punch) CompatibleWithItem(i world.Item) bool {
    44  	_, ok := i.(item.Bow)
    45  	return ok
    46  }