Added critical hit system: the player and rabbit entities have a chance of making x4 damage! Closes #52

This commit is contained in:
eichhornchen
2021-01-05 19:07:15 +01:00
parent c01307202a
commit 9b8dfb00da
3 changed files with 16 additions and 8 deletions

View File

@ -87,9 +87,9 @@ class Rabbit(Monster):
A rabbit monster
"""
def __init__(self, name: str = "rabbit", strength: int = 1,
maxhealth: int = 15, *args, **kwargs) -> None:
maxhealth: int = 15, critical: int = 30, *args, **kwargs) -> None:
super().__init__(name=name, strength=strength,
maxhealth=maxhealth, *args, **kwargs)
maxhealth=maxhealth, critical=critical, *args, **kwargs)
class TeddyBear(Monster):

View File

@ -25,12 +25,12 @@ class Player(InventoryHolder, FightingEntity):
dexterity: int = 1, constitution: int = 1, level: int = 1,
current_xp: int = 0, max_xp: int = 10, inventory: list = None,
hazel: int = 42, equipped_item: Optional[Item] = None,
equipped_armor: Optional[Item] = None, *args, **kwargs) \
-> None:
equipped_armor: Optional[Item] = None, critical: int = 5,\
*args, **kwargs) -> None:
super().__init__(name=name, maxhealth=maxhealth, strength=strength,
intelligence=intelligence, charisma=charisma,
dexterity=dexterity, constitution=constitution,
level=level, *args, **kwargs)
level=level, critical=critical, *args, **kwargs)
self.current_xp = current_xp
self.max_xp = max_xp
self.inventory = self.translate_inventory(inventory or [])