Hello! I was wondering if it's possible to have an object inside of an object. I'm trying to have moves assigned to certain characters, but it doesn't seem to work. The code is in Ren'py, but I put it in an init python block, so it's interpreting it as Python code.
Here's all of the code in the file:
init python:
class Moves:
def __init__(self, name, text, effect):
self.name = name
self.text = text
self.effect = effect
pet = Moves("Pet", "He really liked that!", 1)
def recruit_value(value):
recruit += value
class Attacks:
def __init__(self, name, text, effect):
self.name = name
self.text = text
self.effect = effect
class Characters:
def __init__(self, name, hp, attack, defense, speed, move1, move2):
self.name = name
self.hp = hp
self.attack = attack
self.defense = defense
self.speed = speed
self.move1 = move1
self.move2 = move2
marshy = Characters("Marshy", 20, 10, 10, 9, marshmallowspit, strongattack)
drchocomarsh = Characters("Dr. Chocomarsh", 40, 15, 9, 6, marshmallowspit, icyspell)
loansharky = Characters("Loan Sharky", 30, 15, 15, 9, bite, headbutt)
marshmallowspit = Attacks("Marshmallow Spit", "[player.name] used Marshmallow Spit!", 10)
icyspell = Attacks("Icy Spell", "[player.name] used Icy Spell!", 10)
headbutt = Attacks("Headbutt", "[player.name] used Headbutt!", 15)
strongattack = Attacks("Strong Attack", "[player.name] used Strong Attack!", 10)
bite = Attacks("Bite", "[player.name] used Bite", 10)
#Damage Formula
def battleformula(player, enemy, move):
damage = 2*player.attack+move.effect - enemy.defense
enemy.hp -= damage
return```