Fix for loading game in progress, there remains to change all entities __init__ to allow being initialized by a dictionnary (work in progress, breaks the game)
This commit is contained in:
@ -81,6 +81,13 @@ class Rabbit(Monster):
|
||||
super().__init__(name="rabbit", strength=strength,
|
||||
maxhealth=maxhealth, *args, **kwargs)
|
||||
|
||||
def save_state(self) -> None:
|
||||
"""
|
||||
Saves the state of the entity into a dictionary
|
||||
"""
|
||||
d = super().save_state()
|
||||
d["type"] = "Rabbit"
|
||||
|
||||
|
||||
class TeddyBear(Monster):
|
||||
"""
|
||||
@ -90,3 +97,10 @@ class TeddyBear(Monster):
|
||||
*args, **kwargs) -> None:
|
||||
super().__init__(name="teddy_bear", strength=strength,
|
||||
maxhealth=maxhealth, *args, **kwargs)
|
||||
|
||||
def save_state(self) -> None:
|
||||
"""
|
||||
Saves the state of the entity into a dictionary
|
||||
"""
|
||||
d = super().save_state()
|
||||
d["type"] = "Teddy"
|
||||
|
Reference in New Issue
Block a user