forked from df-mc/dragonfly
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fire_protection.go
49 lines (40 loc) · 1.17 KB
/
fire_protection.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
47
48
49
package enchantment
import (
"github.com/Adrian8115/dragonfly-Amethyst-Protocol/server/item"
"github.com/Adrian8115/dragonfly-Amethyst-Protocol/server/world"
)
// FireProtection is an armour enchantment that decreases fire damage.
type FireProtection struct{}
// Name ...
func (FireProtection) Name() string {
return "Fire Protection"
}
// MaxLevel ...
func (FireProtection) MaxLevel() int {
return 4
}
// Cost ...
func (FireProtection) Cost(level int) (int, int) {
min := 10 + (level-1)*8
return min, min + 8
}
// Rarity ...
func (FireProtection) Rarity() item.EnchantmentRarity {
return item.EnchantmentRarityUncommon
}
// Modifier returns the base protection modifier for the enchantment.
func (FireProtection) Modifier() float64 {
return 0.08
}
// CompatibleWithEnchantment ...
func (FireProtection) CompatibleWithEnchantment(t item.EnchantmentType) bool {
_, blastProtection := t.(BlastProtection)
_, projectileProtection := t.(ProjectileProtection)
_, protection := t.(Protection)
return !blastProtection && !projectileProtection && !protection
}
// CompatibleWithItem ...
func (FireProtection) CompatibleWithItem(i world.Item) bool {
_, ok := i.(item.Armour)
return ok
}