1
0

Add Equipment classes

This commit is contained in:
Timothy Warren 2022-02-08 09:42:53 -05:00
parent 1b354b007c
commit 159beb98b2
2 changed files with 50 additions and 0 deletions

44
components/equippable.py Normal file
View File

@ -0,0 +1,44 @@
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)

6
equipment_types.py Normal file
View File

@ -0,0 +1,6 @@
from enum import auto, Enum
class EquipmentType(Enum):
WEAPON = auto()
ARMOR = auto()