Repaired the use functionnality of the main item, as well as the load system for Armor items.
This commit is contained in:
parent
f3fe04e13a
commit
a9aeb9ca3a
|
@ -276,7 +276,6 @@ class Sword(Weapon):
|
|||
def __init__(self, name: str = "sword", price: int = 20,
|
||||
*args, **kwargs):
|
||||
super().__init__(name=name, price=price, *args, **kwargs)
|
||||
self.name = name
|
||||
|
||||
|
||||
class Armor(Item):
|
||||
|
@ -307,24 +306,27 @@ class Shield(Armor):
|
|||
Class of shield items, they can be equipped in the other hand.
|
||||
"""
|
||||
|
||||
def __init__(self, constitution: int = 2, *args, **kwargs):
|
||||
super().__init__(name="shield", constitution=constitution, *args, **kwargs)
|
||||
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, constitution: int = 2, *args, **kwargs):
|
||||
super().__init__(name="helmet", constitution=constitution, *args, **kwargs)
|
||||
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, constitution: int = 4, *args, **kwargs):
|
||||
super().__init__(name="chestplate", constitution=constitution, *args, **kwargs)
|
||||
def __init__(self, name: str = "chestplate", constitution: int = 4,\
|
||||
price: int = 15, *args, **kwargs):
|
||||
super().__init__(name=name, constitution=constitution, *args, **kwargs)
|
||||
|
||||
|
||||
class BodySnatchPotion(Item):
|
||||
|
|
|
@ -127,8 +127,8 @@ class Game:
|
|||
elif key == KeyValues.INVENTORY:
|
||||
self.state = GameMode.INVENTORY
|
||||
self.display_actions(DisplayActions.UPDATE)
|
||||
elif key == KeyValues.USE and self.player.equipped_item:
|
||||
self.player.equipped_item.use()
|
||||
elif key == KeyValues.USE and self.player.equipped_main:
|
||||
self.player.equipped_main.use()
|
||||
elif key == KeyValues.SPACE:
|
||||
self.state = GameMode.MAINMENU
|
||||
elif key == KeyValues.CHAT:
|
||||
|
|
|
@ -374,7 +374,7 @@ class Entity:
|
|||
TeddyBear, GiantSeaEagle
|
||||
from squirrelbattle.entities.friendly import Merchant, Sunflower
|
||||
from squirrelbattle.entities.items import BodySnatchPotion, Bomb, \
|
||||
Heart, Sword
|
||||
Heart, Sword, Shield, Chestplate, Helmet
|
||||
return {
|
||||
"Tiger": Tiger,
|
||||
"Bomb": Bomb,
|
||||
|
@ -388,6 +388,9 @@ class Entity:
|
|||
"Sunflower": Sunflower,
|
||||
"Sword": Sword,
|
||||
"Eagle": GiantSeaEagle,
|
||||
"Shield": Shield,
|
||||
"Chestplate": Chestplate,
|
||||
"Helmet": Helmet,
|
||||
}
|
||||
|
||||
def save_state(self) -> dict:
|
||||
|
|
Loading…
Reference in New Issue