diff --git a/squirrelbattle/display/statsdisplay.py b/squirrelbattle/display/statsdisplay.py index e24c969..c74b63f 100644 --- a/squirrelbattle/display/statsdisplay.py +++ b/squirrelbattle/display/statsdisplay.py @@ -28,7 +28,7 @@ class StatsDisplay(Display): string3 = "STR {}\nINT {}\nCHR {}\nDEX {}\nCON {}\nCRI {}%"\ .format(self.player.strength, self.player.intelligence, self.player.charisma, - self.player.dexterity, self.player.constitution,\ + self.player.dexterity, self.player.constitution, self.player.critical) self.addstr(self.pad, 3, 0, string3) @@ -54,15 +54,16 @@ class StatsDisplay(Display): if self.player.equipped_secondary: self.addstr(self.pad, 11, 0, _("Equipped secondary:") + " " - f"{self.pack[self.player.equipped_secondary.name.upper()]}") + + self.pack[self.player.equipped_secondary + .name.upper()]) if self.player.equipped_armor: self.addstr(self.pad, 12, 0, _("Equipped chestplate:") + " " - f"{self.pack[self.player.equipped_armor.name.upper()]}") + + self.pack[self.player.equipped_armor.name.upper()]) if self.player.equipped_helmet: self.addstr(self.pad, 13, 0, _("Equipped helmet:") + " " - f"{self.pack[self.player.equipped_helmet.name.upper()]}") + + self.pack[self.player.equipped_helmet.name.upper()]) self.addstr(self.pad, 14, 0, f"{self.pack.HAZELNUT} " f"x{self.player.hazel}") diff --git a/squirrelbattle/entities/items.py b/squirrelbattle/entities/items.py index 336d3e5..3eb3530 100644 --- a/squirrelbattle/entities/items.py +++ b/squirrelbattle/entities/items.py @@ -107,7 +107,7 @@ class Item(Entity): @staticmethod def get_all_items() -> list: - return [BodySnatchPotion, Bomb, Heart, Shield, Sword,\ + return [BodySnatchPotion, Bomb, Heart, Shield, Sword, Chestplate, Helmet, RingCritical, RingXP] def be_sold(self, buyer: InventoryHolder, seller: InventoryHolder) -> bool: @@ -283,7 +283,7 @@ class Armor(Item): Class of items that increase the player's constitution. """ constitution: int - + def __init__(self, constitution: int, *args, **kwargs): super().__init__(*args, **kwargs) self.constitution = constitution @@ -301,30 +301,33 @@ class Armor(Item): d["constitution"] = self.constitution return d + class Shield(Armor): """ Class of shield items, they can be equipped in the other hand. """ - def __init__(self, name: str = "shield", constitution: int = 2,\ + def __init__(self, name: str = "shield", constitution: int = 2, price: int = 6, *args, **kwargs): super().__init__(name=name, constitution=constitution, *args, **kwargs) + class Helmet(Armor): """ Class of helmet items, they can be equipped on the head. """ - def __init__(self, name: str = "helmet", constitution: int = 2, \ + def __init__(self, name: str = "helmet", constitution: int = 2, price: int = 8, *args, **kwargs): super().__init__(name=name, constitution=constitution, *args, **kwargs) + class Chestplate(Armor): """ Class of chestplate items, they can be equipped on the body. """ - def __init__(self, name: str = "chestplate", constitution: int = 4,\ + def __init__(self, name: str = "chestplate", constitution: int = 4, price: int = 15, *args, **kwargs): super().__init__(name=name, constitution=constitution, *args, **kwargs) @@ -362,6 +365,7 @@ class BodySnatchPotion(Item): self.held_by.inventory.remove(self) + class Ring(Item): """ A class of rings that boost the player's statistics. @@ -375,9 +379,9 @@ class Ring(Item): critical: int experience: float - def __init__(self, maxhealth: int = 0, strength: int = 0,\ - intelligence: int = 0, charisma: int = 0,\ - dexterity: int = 0, constitution: int = 0,\ + def __init__(self, maxhealth: int = 0, strength: int = 0, + intelligence: int = 0, charisma: int = 0, + dexterity: int = 0, constitution: int = 0, critical: int = 0, experience: float = 0, *args, **kwargs): super().__init__(*args, **kwargs) self.maxhealth = maxhealth @@ -416,14 +420,16 @@ class Ring(Item): d["constitution"] = self.constitution return d + class RingCritical(Ring): def __init__(self, name: str = "ring_of_critical_damage", price: int = 15, critical: int = 20, *args, **kwargs): - super().__init__(name=name, price=price, critical=critical, \ + super().__init__(name=name, price=price, critical=critical, *args, **kwargs) + class RingXP(Ring): def __init__(self, name: str = "ring_of_more_experience", price: int = 25, experience: float = 2, *args, **kwargs): - super().__init__(name=name, price=price, experience=experience, \ + super().__init__(name=name, price=price, experience=experience, *args, **kwargs) diff --git a/squirrelbattle/entities/monsters.py b/squirrelbattle/entities/monsters.py index bcdff11..d93b24b 100644 --- a/squirrelbattle/entities/monsters.py +++ b/squirrelbattle/entities/monsters.py @@ -87,9 +87,11 @@ class Rabbit(Monster): A rabbit monster """ def __init__(self, name: str = "rabbit", strength: int = 1, - maxhealth: int = 15, critical: int = 30, *args, **kwargs) -> None: + maxhealth: int = 15, critical: int = 30, + *args, **kwargs) -> None: super().__init__(name=name, strength=strength, - maxhealth=maxhealth, critical=critical, *args, **kwargs) + maxhealth=maxhealth, critical=critical, + *args, **kwargs) class TeddyBear(Monster): @@ -101,6 +103,7 @@ class TeddyBear(Monster): super().__init__(name=name, strength=strength, maxhealth=maxhealth, *args, **kwargs) + class GiantSeaEagle(Monster): """ An eagle boss diff --git a/squirrelbattle/entities/player.py b/squirrelbattle/entities/player.py index 854bd93..63d6536 100644 --- a/squirrelbattle/entities/player.py +++ b/squirrelbattle/entities/player.py @@ -28,9 +28,9 @@ 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_main: Optional[Item] = None, - equipped_armor: Optional[Item] = None, critical: int = 5,\ - equipped_secondary: Optional[Item] = None, \ - equipped_helmet: Optional[Item] = None, xp_buff: float = 1,\ + equipped_armor: Optional[Item] = None, critical: int = 5, + equipped_secondary: 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, @@ -84,7 +84,7 @@ class Player(InventoryHolder, FightingEntity): Add some experience to the player. If the required amount is reached, level up. """ - self.current_xp += int(xp*self.xp_buff) + self.current_xp += int(xp * self.xp_buff) self.level_up() def remove_from_inventory(self, obj: Item) -> None: diff --git a/squirrelbattle/interfaces.py b/squirrelbattle/interfaces.py index e4557d1..556051c 100644 --- a/squirrelbattle/interfaces.py +++ b/squirrelbattle/interfaces.py @@ -146,8 +146,8 @@ class Map: tile = self.tiles[y][x] if tile.can_walk(): break - entity = choices(Entity.get_all_entity_classes(),\ - weights = Entity.get_weights(), k=1)[0]() + entity = choices(Entity.get_all_entity_classes(), + weights=Entity.get_weights(), k=1)[0]() entity.move(y, x) self.add_entity(entity)