Create wands
This commit is contained in:
parent
0c7ae19d40
commit
b24ea5b610
@ -92,7 +92,7 @@ spell_none = Spell(__INVALID_SPELL, 0, 0, 0, "(internal) invalid spell", SPELL_T
|
||||
##
|
||||
## Standalone spell functions
|
||||
##
|
||||
def find_spell_by_name(input):
|
||||
def find_spell_by_name(input: str):
|
||||
for i in Spell.spellList:
|
||||
if input.title() == i.name.title():
|
||||
return i
|
||||
|
69
wands.py
Normal file
69
wands.py
Normal file
@ -0,0 +1,69 @@
|
||||
WAND_CORE_UNICORN = 0 #Succes +3%
|
||||
WAND_CORE_PHOENIX = 1 #Speed +4%
|
||||
WAND_CORE_DRAGON = 2 #Damage +5%
|
||||
|
||||
WAND_WOOD_ASH = 0 #Succes -3%
|
||||
WAND_WOOD_ELDER = 1 #Speed -4%
|
||||
WAND_WOOD_APPLE = 2 #Damage -5%
|
||||
|
||||
class Wand:
|
||||
_next_wand_id = 1
|
||||
|
||||
def __init__(self, wand_core: int, wand_wood: int):
|
||||
self.id = Wand._next_wand_id
|
||||
|
||||
self.core = wand_core
|
||||
self.wood = wand_wood
|
||||
|
||||
self.succes_rate = 1
|
||||
self.speed = 1
|
||||
self.damage = 1
|
||||
|
||||
if self.core == WAND_CORE_UNICORN:
|
||||
self.succes_rate *= 1.03
|
||||
elif self.core == WAND_CORE_PHOENIX:
|
||||
self.speed *= 1.04
|
||||
elif self.core == WAND_CORE_DRAGON:
|
||||
self.speed *= 1.05
|
||||
|
||||
if self.wood == WAND_WOOD_ASH:
|
||||
self.succes_rate *= 0.97
|
||||
elif self.wood == WAND_WOOD_ELDER:
|
||||
self.succes_rate *= 0.96
|
||||
elif self.wood == WAND_WOOD_APPLE:
|
||||
self.damage *= 0.95
|
||||
|
||||
Wand._next_wand_id += 1
|
||||
|
||||
def __repr__(self):
|
||||
succes_rate = round(self.succes_rate * 100, 3)
|
||||
speed = round(self.speed * 100, 3)
|
||||
damage = round(self.dmg * 100, 3)
|
||||
return "Modifiers: SUCCES RATE: {srate}%\tSPEED: {speed}\tDAMAGE: {dmg}".format(srate=succes_rate, speed=speed, dmg=damage)
|
||||
|
||||
def get_wand_core(self):
|
||||
if self.core == WAND_CORE_UNICORN: return "Unicorn hair"
|
||||
elif self.core == WAND_CORE_PHOENIX: return "Phoenix feather"
|
||||
elif self.core == WAND_CORE_DRAGON: return "Dragon heartstring"
|
||||
else: return "Muggle's electric wire"
|
||||
|
||||
def get_wand_wood(self):
|
||||
if self.wood == WAND_WOOD_ASH: return "Ash"
|
||||
elif self.wood == WAND_WOOD_ELDER: return "Elder"
|
||||
elif self.wood == WAND_WOOD_APPLE: return "Apple"
|
||||
else: return "Common wood"
|
||||
|
||||
##
|
||||
## Wands
|
||||
##
|
||||
wand_1 = Wand(WAND_CORE_UNICORN, WAND_WOOD_ASH)
|
||||
wand_2 = Wand(WAND_CORE_UNICORN, WAND_WOOD_ELDER)
|
||||
wand_3 = Wand(WAND_CORE_UNICORN, WAND_WOOD_APPLE)
|
||||
|
||||
wand_4 = Wand(WAND_CORE_PHOENIX, WAND_WOOD_ASH)
|
||||
wand_5 = Wand(WAND_CORE_PHOENIX, WAND_WOOD_ELDER)
|
||||
wand_6 = Wand(WAND_CORE_PHOENIX, WAND_WOOD_APPLE)
|
||||
|
||||
wand_7 = Wand(WAND_CORE_DRAGON, WAND_WOOD_ASH)
|
||||
wand_8 = Wand(WAND_CORE_DRAGON, WAND_WOOD_ELDER)
|
||||
wand_9 = Wand(WAND_CORE_DRAGON, WAND_WOOD_APPLE)
|
Loading…
x
Reference in New Issue
Block a user