Add Equipment classes
This commit is contained in:
parent
1b354b007c
commit
159beb98b2
44
components/equippable.py
Normal file
44
components/equippable.py
Normal 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
6
equipment_types.py
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
from enum import auto, Enum
|
||||||
|
|
||||||
|
|
||||||
|
class EquipmentType(Enum):
|
||||||
|
WEAPON = auto()
|
||||||
|
ARMOR = auto()
|
Loading…
Reference in New Issue
Block a user