-
Notifications
You must be signed in to change notification settings - Fork 3
/
data_types.py
111 lines (85 loc) · 2.31 KB
/
data_types.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
from dataclasses import dataclass, field
from enum import Enum
class Alignment(Enum):
CHAOS = 0
NATURE = 1
LIFE = 2
ORDER = 3
DEATH = 4
MIGHT = 5
class UnitSize(Enum):
SMALL = 0 #3x3
BIG = 1 #5x5 with 3x3 edges
@dataclass
class BattleMaps:
#Stores battlefield sprites
data:any = None
#grid location, not pixel location
team1_positions:list[tuple[int,int]] = None
team2_positions:list[tuple[int,int]] = None
@dataclass
class BattleTile:
terrain:str = ""
occupied:bool = False
@dataclass
class Resources:
gold:int = 0
wood:int = 0
ore:int = 0
gems:int = 0
crystal:int = 0
sulfur:int = 0
mercury:int = 0
@dataclass
class Creature:
"""Base definition of a creature"""
name:str = ""
description:str = ""
data:any = None # should contain sprites, animations, etc (or a reference to them?)
level:int = 0
alignment:Alignment = None # placeholder
cost:Resources = None
growth:int = 0
experience_value:int = 0
size:int = 0
damage:tuple = field(default_factory=tuple)
hp:int = 0
melee_attack:int = 0
ranged_attack:int = 0
melee_defense:int = 0
ranged_defense:int = 0 #Added ranged and melee subdivison
move:int = 0
speed:int = 0
shots:int = 0
abilities:list = field(default_factory=list)
spells:list = field(default_factory=list)
spell_power:int = 0
mana:int = 0
luck:int = 0 #Added morale and luck
morale:int = 0
@dataclass
class StatusModifier:
name:str = ""
description:str = ""
#Ability class split up into two definition, conditional abilities like the pirates or flying
#On attack abilities like curse
#How to implement abilities like charge
@dataclass
class Abilities:
name:str = ""
description:str = ""
data:any = None
def apply(self, attacker, defender):
"""Default apply method."""
pass
class ConditionalAbility(Abilities):
def check_condition(self, creature, context):
"""Check specific conditions"""
return False
def apply_condition(self, creature, context):
"""Apply effects based on condition"""
pass
class CombatAbility(Abilities):
def apply_on_attack(self, attacker, defender):
"""Apply during attack"""
pass