/
stats.py
164 lines (123 loc) · 4.01 KB
/
stats.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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
from compositecore import Leaf
class DataPoint(Leaf):
"""
Class for components holding a single data point.
"""
def __init__(self, component_type, value, tags=[]):
super(DataPoint, self).__init__()
self.tags |= set(tags)
self.component_type = component_type
self.value = value
class Flag(Leaf):
"""
Component which only has a component type. Composites with this component has this flag.
"""
def __init__(self, component_type):
super(Flag, self).__init__()
self.component_type = component_type
class DataPointBonusSpoof(Leaf):
"""
Defines a bonus value, if this is added to an entity as spoof.
The entity will get that bonus added to the normal value.
"""
def __init__(self, component_type, bonus_value):
super(DataPointBonusSpoof, self).__init__()
self.component_type = component_type
self.bonus_value = bonus_value
@property
def value(self):
return self.next.value + self.bonus_value
@value.setter
def value(self, new_value):
self.next.value = new_value
class Damage(Leaf):
"""
Holds min and max damage.
"""
def __init__(self, min, max):
super(Damage, self).__init__()
self.component_type = "damage_data_point"
self.min = min
self.max = max
class Class:
ROGUE = "Rogue"
KNIGHT = "Knight"
GUNSLINGER = "Gunslinger"
WITCH = "Witch"
TINKER = "Tinker"
class Races:
HUMAN = "Human"
RATMAN = "Ratman"
CYCLOPS = "Cyclops"
PIXIE = "Pixie"
class Tags:
DAMAGE_TYPE = "damage_type"
class DataTypes:
CLASS = "job"
RACE = "race"
ENERGY = "energy"
CRIT_MULTIPLIER = "crit_multiplier"
UNARMED_CRIT_CHANCE = "unarmed_crit_chance"
CRIT_CHANCE = "crit_chance"
CRIT_CHANCE_WEAPON = "crit_chance_weapon_effect"
STRENGTH = "strength"
ARMOR = "armor"
ACCURACY = "accuracy"
DAMAGE = "damage"
STEALTH = "stealth"
AWARENESS = "awareness"
EVASION = "evasion"
COUNTER_ATTACK_CHANCE = "counter_attack_chance"
OFFENCIVE_ATTACK_CHANCE = "offencive_attack_chance"
DEFENCIVE_ATTACK_CHANCE = "defencive_attack_chance"
MELEE_SPEED = "melee_speed"
SHOOT_SPEED = "shoot_speed"
THROW_SPEED = "throw_speed"
THROW_ITEM_SPEED = "throw_item_speed"
CAST_SPEED = "cast_speed"
MELEE_DAMAGE_MULTIPLIER = "melee_damage_multiplier"
THROW_DAMAGE_MULTIPLIER = "throw_damage_multiplier"
INTELLIGENCE = "intelligence"
GAME_PIECE_TYPE = "game_piece_type"
MOVEMENT_SPEED = "movement_speed"
FACTION = "faction"
WEIGHT = "weight"
WEAPON_RANGE = "weapon_range"
SIGHT_RADIUS = "sight_radius"
SKIP_ACTION_CHANCE = "skip_action_chance"
DENSITY = "density"
CLOUD_TYPE = "cloud_type"
CLONE_FUNCTION = "clone_function"
MINIMUM_DEPTH = "minimum_depth"
GAME_STATE = "game_state"
class Immunities(object):
SPIDER_WEB = "spider_web_immunity"
class IntelligenceLevel(DataPoint):
MINDLESS = 0
PLANT = 1
ANIMAL = 2
NORMAL = 3
HIGH = 4
class Factions(DataPoint):
PLAYER = 0
MONSTER = 1
class GamePieceTypes(DataPoint):
ENTITY = 0
CLOUD = 1
ITEM = 2
DUNGEON_FEATURE = 3
DUNGEON_TRASH = 4
TERRAIN = 5
MAX_INSTANCES_ON_TILE = {ENTITY: 1,
CLOUD: 1,
ITEM: 1,
DUNGEON_FEATURE: 1,
DUNGEON_TRASH: 1,
TERRAIN: 1}
def max_instances_of_composite_on_tile(composite):
return GamePieceTypes.MAX_INSTANCES_ON_TILE[composite.game_piece_type.value]
class UnArmedHitTargetEntityEffectFactory(DataPoint):
def __init__(self, effect_factory_function):
super(UnArmedHitTargetEntityEffectFactory, self).__init__("unarmed_hit_target_entity_effect_factory_" +
str(effect_factory_function), effect_factory_function)
self.tags.add("unarmed_hit_target_entity_effect_factory")