Пример #1
0
    def save(self):
        tree = Destroyable.save(self)

        # Save sprite
        sprite = etree.SubElement(tree, 'sprite')
        sprite.text = self.sprite_link

        return tree
Пример #2
0
    def save(self):
        tree = Destroyable.save(self)

        # Save level
        level = etree.SubElement(tree, 'level')
        level.text = str(self.lvl)

        # Save exp
        exp = etree.SubElement(tree, 'exp')
        exp.text = str(self.xp)

        # Save stats
        hp_m = etree.SubElement(tree, 'hp')
        hp_m.text = str(self.hp_max)
        atk = etree.SubElement(tree, 'strength')
        atk.text = str(self.strength)
        defense = etree.SubElement(tree, 'def')
        defense.text = str(self.defense)
        res = etree.SubElement(tree, 'res')
        res.text = str(self.res)
        move = etree.SubElement(tree, 'move')
        move.text = str(self.max_move)

        return tree