forked from df-mc/dragonfly
-
Notifications
You must be signed in to change notification settings - Fork 0
/
punch.go
46 lines (37 loc) · 970 Bytes
/
punch.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package enchantment
import (
"github.com/Adrian8115/dragonfly-Amethyst-Protocol/server/item"
"github.com/Adrian8115/dragonfly-Amethyst-Protocol/server/world"
)
// Punch increases the knock-back dealt when hitting a player or mob with a bow.
type Punch struct{}
// Name ...
func (Punch) Name() string {
return "Punch"
}
// MaxLevel ...
func (Punch) MaxLevel() int {
return 2
}
// Cost ...
func (Punch) Cost(level int) (int, int) {
min := 12 + (level-1)*20
return min, min + 25
}
// Rarity ...
func (Punch) Rarity() item.EnchantmentRarity {
return item.EnchantmentRarityRare
}
// KnockBackMultiplier returns the punch multiplier for the level and horizontal speed.
func (Punch) KnockBackMultiplier() float64 {
return 0.25
}
// CompatibleWithEnchantment ...
func (Punch) CompatibleWithEnchantment(item.EnchantmentType) bool {
return true
}
// CompatibleWithItem ...
func (Punch) CompatibleWithItem(i world.Item) bool {
_, ok := i.(item.Bow)
return ok
}