Files
TarnaWijaya 26ed99fda6
Build and deploy / Build (push) Has been cancelled
Build and deploy / Update Contributors (push) Has been cancelled
Build and deploy / Deploy (push) Has been cancelled
up3
2026-07-09 08:33:57 +08:00

49 lines
1.0 KiB
Go

package enchantment
import (
"github.com/df-mc/dragonfly/server/item"
"github.com/df-mc/dragonfly/server/world"
)
// Protection is an armour enchantment which increases the damage reduction.
var Protection protection
type protection struct{}
// Name ...
func (protection) Name() string {
return "Protection"
}
// MaxLevel ...
func (protection) MaxLevel() int {
return 4
}
// Cost ...
func (protection) Cost(level int) (int, int) {
minCost := 1 + (level-1)*11
return minCost, minCost + 11
}
// Rarity ...
func (protection) Rarity() item.EnchantmentRarity {
return item.EnchantmentRarityCommon
}
// Modifier returns the base protection modifier for the enchantment.
func (protection) Modifier() float64 {
return 0.04
}
// CompatibleWithEnchantment ...
func (protection) CompatibleWithEnchantment(t item.EnchantmentType) bool {
return t != BlastProtection && t != FireProtection && t != ProjectileProtection
}
// CompatibleWithItem ...
func (protection) CompatibleWithItem(i world.Item) bool {
_, ok := i.(item.Armour)
return ok
}