-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enchantments/vanishing.go: implement Curse of Vanishing enchantment (#…
…661) Co-authored-by: DaPigGuy <mcpepig123@gmail.com>
- Loading branch information
1 parent
e73095c
commit 00a8340
Showing
4 changed files
with
80 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package enchantment | ||
|
||
import ( | ||
"github.com/df-mc/dragonfly/server/item" | ||
"github.com/df-mc/dragonfly/server/world" | ||
) | ||
|
||
// CurseOfVanishing is an enchantment that causes the item to disappear on death. | ||
type CurseOfVanishing struct{} | ||
|
||
// Name ... | ||
func (CurseOfVanishing) Name() string { | ||
return "Curse of Vanishing" | ||
} | ||
|
||
// MaxLevel ... | ||
func (CurseOfVanishing) MaxLevel() int { | ||
return 1 | ||
} | ||
|
||
// Cost ... | ||
func (CurseOfVanishing) Cost(int) (int, int) { | ||
return 25, 50 | ||
} | ||
|
||
// Rarity ... | ||
func (CurseOfVanishing) Rarity() item.EnchantmentRarity { | ||
return item.EnchantmentRarityVeryRare | ||
} | ||
|
||
// CompatibleWithEnchantment ... | ||
func (CurseOfVanishing) CompatibleWithEnchantment(t item.EnchantmentType) bool { | ||
return true | ||
} | ||
|
||
// CompatibleWithItem ... | ||
func (CurseOfVanishing) CompatibleWithItem(i world.Item) bool { | ||
_, arm := i.(item.Armour) | ||
_, com := i.(item.Compass) | ||
_, dur := i.(item.Durable) | ||
_, rec := i.(item.RecoveryCompass) | ||
// TODO: Carrot on a Stick | ||
// TODO: Warped Fungus on a Stick | ||
return arm || com || dur || rec | ||
} | ||
|
||
// Treasure ... | ||
func (CurseOfVanishing) Treasure() bool { | ||
return true | ||
} | ||
|
||
// Curse ... | ||
func (CurseOfVanishing) Curse() bool { | ||
return true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters