so making a rpg battle system following the tutorial but it only makes attacks so i thought creating a heal spell would be good practice and help me understand better this is what i got
class
class Person:
def __init__(self, hp, mp, sp, atk, df, magic, skills):
self.maxhp = hp
self.hp = hp
self.maxmp = mp
self.mp = mp
self.maxsp = sp
self.sp = sp
self.atkL = atk - 10
self.atkH = atk + 20
self.df = df
self.magic = magic
self.skills = skills
self.actions = ["Attack", "Magic", "Skills"]
def generate_damage(self):
return random.randrange(self.atkL, self.atkH)
def generate_spell_damage(self, i):
mgl = self.magic[i]["dmg"] - 5
mgh = self.magic[i]["dmg"] + 5
return random.randrange(mgl, mgh)
def generate_heal_spell(self, i):
mgl = self.magic[i]["restore"] - 5
mgh = self.magic[i]["restore"] + 5
return random.randrange(mgl, mgh)
main code
from classes.game import Person, bcolors
magic = [{"Spell Name": "Fire", "Spell Cost": 10, "dmg": 60},
{"Spell Name": "Spark", "Spell Cost": 10, "dmg": 60},
{"Spell Name": "Cold", "Spell Cost": 10, "dmg": 60},
{"Spell Name": "Heal", "Spell Cost": 7, "restore": 45}]
skills = [{"Skill Name": "Slash", "Skill Cost": 6, "dmg": 23},
{"Skill Name": "Bash", "Skill Cost": 8, "dmg": 37},
{"Skill Name": "Pierce", "Skill Cost": 4, "dmg": 17},
{"Skill Name": "God Clap", "Skill Cost": 67, "dmg": 337}]
player = Person(500, 220, 100, 70, 45, magic, skills)
print(player.generate_spell_damage(0))
# print(player.generate_heal_spell(10))
type or paste code here
any help on where i messed up would be appreciated