Added rings that can augment the player's statistics. Also added a new statistic : xp_buff, which helps the player level up sooner.
This commit is contained in:
@ -16,6 +16,7 @@ class Player(InventoryHolder, FightingEntity):
|
||||
"""
|
||||
current_xp: int = 0
|
||||
max_xp: int = 10
|
||||
xp_buff: float = 1
|
||||
paths: Dict[Tuple[int, int], Tuple[int, int]]
|
||||
equipped_main: Optional[Item]
|
||||
equipped_secondary: Optional[Item]
|
||||
@ -29,7 +30,7 @@ class Player(InventoryHolder, FightingEntity):
|
||||
hazel: int = 42, equipped_main: Optional[Item] = None,
|
||||
equipped_armor: Optional[Item] = None, critical: int = 5,\
|
||||
equipped_secondary: Optional[Item] = None, \
|
||||
equipped_helmet: Optional[Item] = None, \
|
||||
equipped_helmet: Optional[Item] = None, xp_buff: float = 1,\
|
||||
*args, **kwargs) -> None:
|
||||
super().__init__(name=name, maxhealth=maxhealth, strength=strength,
|
||||
intelligence=intelligence, charisma=charisma,
|
||||
@ -37,6 +38,7 @@ class Player(InventoryHolder, FightingEntity):
|
||||
level=level, critical=critical, *args, **kwargs)
|
||||
self.current_xp = current_xp
|
||||
self.max_xp = max_xp
|
||||
self.xp_buff = xp_buff
|
||||
self.inventory = self.translate_inventory(inventory or [])
|
||||
self.paths = dict()
|
||||
self.hazel = hazel
|
||||
@ -82,7 +84,7 @@ class Player(InventoryHolder, FightingEntity):
|
||||
Add some experience to the player.
|
||||
If the required amount is reached, level up.
|
||||
"""
|
||||
self.current_xp += xp
|
||||
self.current_xp += int(xp*self.xp_buff)
|
||||
self.level_up()
|
||||
|
||||
def remove_from_inventory(self, obj: Item) -> None:
|
||||
|
Reference in New Issue
Block a user