Entity name is a parameter since it can be changed through body snatch potion
This commit is contained in:
parent
ea672272f5
commit
f887a1f0aa
|
@ -67,8 +67,8 @@ class Heart(Item):
|
||||||
"""
|
"""
|
||||||
healing: int
|
healing: int
|
||||||
|
|
||||||
def __init__(self, healing: int = 5, *args, **kwargs):
|
def __init__(self, name: str = "heart", healing: int = 5, *args, **kwargs):
|
||||||
super().__init__(name="heart", *args, **kwargs)
|
super().__init__(name=name, *args, **kwargs)
|
||||||
self.healing = healing
|
self.healing = healing
|
||||||
|
|
||||||
def hold(self, player: "Player") -> None:
|
def hold(self, player: "Player") -> None:
|
||||||
|
@ -96,9 +96,9 @@ class Bomb(Item):
|
||||||
owner: Optional["Player"]
|
owner: Optional["Player"]
|
||||||
tick: int
|
tick: int
|
||||||
|
|
||||||
def __init__(self, damage: int = 5, exploding: bool = False,
|
def __init__(self, name: str = "bomb", damage: int = 5,
|
||||||
*args, **kwargs):
|
exploding: bool = False, *args, **kwargs):
|
||||||
super().__init__(name="bomb", *args, **kwargs)
|
super().__init__(name=name, *args, **kwargs)
|
||||||
self.damage = damage
|
self.damage = damage
|
||||||
self.exploding = exploding
|
self.exploding = exploding
|
||||||
self.tick = 4
|
self.tick = 4
|
||||||
|
@ -151,8 +151,8 @@ class BodySnatchPotion(Item):
|
||||||
other entity.
|
other entity.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, name: str = "body_snatch_potion", *args, **kwargs):
|
||||||
super().__init__(name="body_snatch_potion", *args, **kwargs)
|
super().__init__(name=name, *args, **kwargs)
|
||||||
|
|
||||||
def use(self) -> None:
|
def use(self) -> None:
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -63,9 +63,9 @@ class Tiger(Monster):
|
||||||
"""
|
"""
|
||||||
A tiger monster
|
A tiger monster
|
||||||
"""
|
"""
|
||||||
def __init__(self, strength: int = 2, maxhealth: int = 20,
|
def __init__(self, name: str = "tiger", strength: int = 2,
|
||||||
*args, **kwargs) -> None:
|
maxhealth: int = 20, *args, **kwargs) -> None:
|
||||||
super().__init__(name="tiger", strength=strength,
|
super().__init__(name=name, strength=strength,
|
||||||
maxhealth=maxhealth, *args, **kwargs)
|
maxhealth=maxhealth, *args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
@ -73,9 +73,9 @@ class Hedgehog(Monster):
|
||||||
"""
|
"""
|
||||||
A really mean hedgehog monster
|
A really mean hedgehog monster
|
||||||
"""
|
"""
|
||||||
def __init__(self, strength: int = 3, maxhealth: int = 10,
|
def __init__(self, name: str = "hedgehog", strength: int = 3,
|
||||||
*args, **kwargs) -> None:
|
maxhealth: int = 10, *args, **kwargs) -> None:
|
||||||
super().__init__(name="hedgehog", strength=strength,
|
super().__init__(name=name, strength=strength,
|
||||||
maxhealth=maxhealth, *args, **kwargs)
|
maxhealth=maxhealth, *args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
@ -83,9 +83,9 @@ class Rabbit(Monster):
|
||||||
"""
|
"""
|
||||||
A rabbit monster
|
A rabbit monster
|
||||||
"""
|
"""
|
||||||
def __init__(self, strength: int = 1, maxhealth: int = 15,
|
def __init__(self, name: str = "rabbit", strength: int = 1,
|
||||||
*args, **kwargs) -> None:
|
maxhealth: int = 15, *args, **kwargs) -> None:
|
||||||
super().__init__(name="rabbit", strength=strength,
|
super().__init__(name=name, strength=strength,
|
||||||
maxhealth=maxhealth, *args, **kwargs)
|
maxhealth=maxhealth, *args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ class TeddyBear(Monster):
|
||||||
"""
|
"""
|
||||||
A cute teddybear monster
|
A cute teddybear monster
|
||||||
"""
|
"""
|
||||||
def __init__(self, strength: int = 0, maxhealth: int = 50,
|
def __init__(self, name: str = "teddy_bear", strength: int = 0,
|
||||||
*args, **kwargs) -> None:
|
maxhealth: int = 50, *args, **kwargs) -> None:
|
||||||
super().__init__(name="teddy_bear", strength=strength,
|
super().__init__(name=name, strength=strength,
|
||||||
maxhealth=maxhealth, *args, **kwargs)
|
maxhealth=maxhealth, *args, **kwargs)
|
||||||
|
|
|
@ -16,11 +16,12 @@ class Player(FightingEntity):
|
||||||
inventory: list
|
inventory: list
|
||||||
paths: Dict[Tuple[int, int], Tuple[int, int]]
|
paths: Dict[Tuple[int, int], Tuple[int, int]]
|
||||||
|
|
||||||
def __init__(self, maxhealth: int = 20, strength: int = 5,
|
def __init__(self, name: str = "player", maxhealth: int = 20,
|
||||||
intelligence: int = 1, charisma: int = 1, dexterity: int = 1,
|
strength: int = 5, intelligence: int = 1, charisma: int = 1,
|
||||||
constitution: int = 1, level: int = 1, current_xp: int = 0,
|
dexterity: int = 1, constitution: int = 1, level: int = 1,
|
||||||
max_xp: int = 10, *args, **kwargs) -> None:
|
current_xp: int = 0, max_xp: int = 10, *args, **kwargs) \
|
||||||
super().__init__(name="player", maxhealth=maxhealth, strength=strength,
|
-> None:
|
||||||
|
super().__init__(name=name, maxhealth=maxhealth, strength=strength,
|
||||||
intelligence=intelligence, charisma=charisma,
|
intelligence=intelligence, charisma=charisma,
|
||||||
dexterity=dexterity, constitution=constitution,
|
dexterity=dexterity, constitution=constitution,
|
||||||
level=level, *args, **kwargs)
|
level=level, *args, **kwargs)
|
||||||
|
|
Loading…
Reference in New Issue