1
0
python-roguelike/components/equippable.py

44 lines
1.0 KiB
Python
Raw Normal View History

2022-02-08 09:42:53 -05:00
from __future__ import annotations
from typing import TYPE_CHECKING
from components.base_component import BaseComponent
from equipment_types import EquipmentType
if TYPE_CHECKING:
from entity import Item
class Equippable(BaseComponent):
parent: Item
def __init__(
self,
equipment_type: EquipmentType,
power_bonus: int = 0,
defense_bonus: int = 0,
):
self.equipment_type = equipment_type
self.power_bonus = power_bonus
self.defense_bonus = defense_bonus
class Dagger(Equippable):
def __init__(self) -> None:
super().__init__(EquipmentType.WEAPON, power_bonus=2)
class Sword(Equippable):
def __init__(self) -> None:
super().__init__(EquipmentType.WEAPON, power_bonus=4)
class LeatherArmor(Equippable):
def __init__(self) -> None:
super().__init__(EquipmentType.ARMOR, defense_bonus=1)
class ChainMail(Equippable):
def __init__(self) -> None:
super().__init__(EquipmentType.ARMOR, defense_bonus=3)