forked from jwvhewitt/dmeternal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
enchantments.py
276 lines (225 loc) · 11.1 KB
/
enchantments.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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
import stats
import image
import effects
import animobs
# Enumerated constants for dispelling types.
COMBAT, MAGIC, POISON, DAILY, CURSE = range( 5 )
class Enchantment( object ):
NAME = ""
def __init__( self, statline=None, dispel = (COMBAT,MAGIC) ):
if not statline:
statline = stats.StatMod()
self.statline = statline
self.dispel = dispel
self.uses = 0
# If FX is defined, this affects carrier once per round.
FX = None
# If any of the following effects are defined, they will be added to attacks.
ATTACK_ON_HIT = None
# If MAX_USES defined, enchantment disappears after that number of uses.
MAX_USES = None
class AirArmor( Enchantment ):
NAME = "Air Armor"
def __init__( self ):
super(AirArmor, self).__init__(statline=stats.StatMod({stats.PHYSICAL_DEFENSE:5,stats.MAGIC_DEFENSE:5,stats.NATURAL_DEFENSE:5}),dispel=(COMBAT,MAGIC))
class ArmorDamage( Enchantment ):
NAME = "Armor Damage"
def __init__( self ):
super(ArmorDamage, self).__init__(statline=stats.StatMod({stats.PHYSICAL_DEFENSE:-10,stats.NATURAL_DEFENSE:-10}),dispel=(COMBAT,))
class AcidWepEn( Enchantment ):
NAME = "Acid Weapon"
def __init__( self ):
super(AcidWepEn, self).__init__(statline=stats.StatMod({stats.PHYSICAL_ATTACK:10}),dispel=(COMBAT,MAGIC))
ATTACK_ON_HIT = effects.HealthDamage( (1,10,0), stat_bonus=None, element=stats.RESIST_ACID, anim=animobs.GreenExplosion, on_success=(
effects.OpposedRoll( def_stat=stats.TOUGHNESS, on_failure = (
effects.Enchant( ArmorDamage, anim=animobs.OrangeSparkle )
,))
,) )
class BeastlyMightEn( Enchantment ):
NAME = "Beastly Might"
def __init__( self ):
super(BeastlyMightEn, self).__init__(statline=stats.StatMod({stats.STRENGTH:4,stats.TOUGHNESS:4,stats.PHYSICAL_ATTACK:5}),dispel=(COMBAT,MAGIC))
class Bleeding( Enchantment ):
NAME = "Bleeding"
def __init__( self ):
super(Bleeding, self).__init__(dispel=(COMBAT,CURSE,DAILY))
FX = effects.HealthDamage( (3,4,0), stat_bonus=None, element=None, anim=animobs.BloodSplat )
MAX_USES = 5
class BlessedWepEn( Enchantment ):
NAME = "Blessed Weapon"
def __init__( self ):
super(BlessedWepEn, self).__init__(statline=stats.StatMod({stats.PHYSICAL_ATTACK:10,stats.PHYSICAL_DEFENSE:5,stats.NATURAL_DEFENSE:5,stats.MAGIC_DEFENSE:5}),dispel=(COMBAT,MAGIC))
ATTACK_ON_HIT = effects.HealthDamage( (1,8,0), stat_bonus=None, element=stats.RESIST_SOLAR, anim=animobs.YellowExplosion )
class BlessingEn( Enchantment ):
NAME = "Blessed"
def __init__( self ):
super(BlessingEn, self).__init__(statline=stats.StatMod({stats.PHYSICAL_ATTACK:5,stats.MAGIC_ATTACK:5,stats.KUNG_FU:5}),dispel=(COMBAT,MAGIC))
class BlindedEn( Enchantment ):
NAME = "Dazzled"
def __init__( self ):
super(BlindedEn, self).__init__(statline=stats.StatMod({stats.PHYSICAL_ATTACK:-10,stats.AWARENESS:-30}),dispel=(COMBAT,MAGIC,CURSE))
class BurnLowEn( Enchantment ):
NAME = "Burning"
def __init__( self ):
super(BurnLowEn, self).__init__(dispel=(MAGIC,COMBAT,CURSE,stats.RESIST_WATER))
FX = effects.HealthDamage( (1,6,0), stat_bonus=None, element=stats.RESIST_FIRE, anim=animobs.RedCloud )
MAX_USES = 5
class CurseEn( Enchantment ):
NAME = "Cursed"
def __init__( self ):
super(CurseEn, self).__init__(statline=stats.StatMod({stats.PHYSICAL_ATTACK:-5,stats.MAGIC_ATTACK:-5}),dispel=(COMBAT,MAGIC,CURSE))
class DiseaseEn( Enchantment ):
NAME = "Diseased"
def __init__( self ):
super(DiseaseEn, self).__init__(statline=stats.StatMod({stats.STRENGTH:-5,
stats.TOUGHNESS:-5,stats.REFLEXES:-5,stats.INTELLIGENCE:-5,stats.PIETY:-5,
stats.CHARISMA:-5}),dispel=(CURSE,))
class FireSignEn( Enchantment ):
NAME = "Fire Sign"
def __init__( self ):
super(FireSignEn, self).__init__(statline=stats.StatMod({stats.PHYSICAL_DEFENSE:-10,stats.NATURAL_DEFENSE:-10,
stats.STEALTH:-200}),dispel=(COMBAT,MAGIC,CURSE,stats.RESIST_WATER))
class FireWepEn( Enchantment ):
NAME = "Fire Weapon"
def __init__( self ):
super(FireWepEn, self).__init__(statline=stats.StatMod({stats.PHYSICAL_ATTACK:5,stats.RESIST_COLD:5}),dispel=(COMBAT,MAGIC))
ATTACK_ON_HIT = effects.HealthDamage( (1,6,0), stat_bonus=None, element=stats.RESIST_FIRE, anim=animobs.OrangeExplosion )
class FrostBurnEn( Enchantment ):
NAME = "Frostburn"
def __init__( self ):
super(FrostBurnEn, self).__init__(dispel=(MAGIC,COMBAT,CURSE,stats.RESIST_FIRE))
FX = effects.HealthDamage( (3,4,0), stat_bonus=None, element=stats.RESIST_COLD, anim=animobs.SnowCloud )
MAX_USES = 5
class FrostWepEn( Enchantment ):
NAME = "Frost Weapon"
def __init__( self ):
super(FrostWepEn, self).__init__(statline=stats.StatMod({stats.PHYSICAL_ATTACK:5,stats.RESIST_FIRE:5}),dispel=(COMBAT,MAGIC))
ATTACK_ON_HIT = effects.HealthDamage( (1,10,0), stat_bonus=None, element=stats.RESIST_COLD, anim=animobs.BlueExplosion,
on_success=( effects.OpposedRoll( on_success = (
effects.Paralyze( max_duration = 3 ),
)),)
)
class HeroismEn( Enchantment ):
NAME = "Heroism"
def __init__( self ):
super(HeroismEn, self).__init__(statline=stats.StatMod({stats.STRENGTH:2,stats.TOUGHNESS:2,stats.REFLEXES:2,
stats.INTELLIGENCE:2, stats.PIETY:2, stats.CHARISMA:2}),dispel=(COMBAT,MAGIC))
class HolySignMark( Enchantment ):
def __init__( self ):
super(HolySignMark, self).__init__(statline=stats.StatMod({stats.PHYSICAL_ATTACK:-5,stats.MAGIC_ATTACK:-5}),dispel=(COMBAT,))
class IronSkinEn( Enchantment ):
NAME = "Iron Skin"
def __init__( self ):
super(IronSkinEn, self).__init__(statline=stats.StatMod({stats.RESIST_SLASHING:75,stats.RESIST_CRUSHING:75,stats.RESIST_PIERCING:75
,stats.PHYSICAL_DEFENSE:10,stats.NATURAL_DEFENSE:10,stats.MAGIC_DEFENSE:10}),dispel=(COMBAT,MAGIC))
class ManaLeak( Enchantment ):
NAME = "Mana Leak"
def __init__( self ):
super(ManaLeak, self).__init__(dispel=(MAGIC,CURSE,DAILY))
FX = effects.ManaDamage( (2,6,0), stat_bonus=None, anim=animobs.PurpleExplosion )
MAX_USES = 10
class PermaRegeneration( Enchantment ):
# Basically like normal regeneration, but may not be dispelled.
def __init__( self ):
super(PermaRegeneration, self).__init__(dispel=())
FX = effects.TargetIsDamaged( on_true= (
effects.HealthRestore( dice=(1,6,0) )
,))
class PermaMegaRegeneration( Enchantment ):
# Basically like PermaRegeneration, but moreso.
def __init__( self ):
super(PermaMegaRegeneration, self).__init__(dispel=())
FX = effects.TargetIsDamaged( on_true= (
effects.HealthRestore( dice=(2,6,0) )
,))
class PoisonClassic( Enchantment ):
NAME = "Poisoned"
def __init__( self ):
super(PoisonClassic, self).__init__(dispel=(POISON,DAILY))
FX = effects.HealthDamage( (1,4,0), stat_bonus=None, element=stats.RESIST_POISON, anim=animobs.PoisonCloud )
MAX_USES = 10
class PoisonWepEn( Enchantment ):
NAME = "Poison Weapon"
def __init__( self ):
super(PoisonWepEn, self).__init__(statline=stats.StatMod({stats.PHYSICAL_ATTACK:10}),dispel=(COMBAT,MAGIC))
ATTACK_ON_HIT = effects.HealthDamage( (2,6,0), stat_bonus=None, element=stats.RESIST_POISON, anim=animobs.PoisonCloud, on_success=(
effects.SavingThrow( roll_skill=stats.RESIST_POISON, roll_stat=stats.TOUGHNESS, on_failure = (
effects.Enchant( PoisonClassic, anim=animobs.DeathSparkle )
,))
,) )
class ProtectFromEvilEn( Enchantment ):
NAME = "Protect from Evil"
def __init__( self ):
super(ProtectFromEvilEn, self).__init__(statline=stats.StatMod({stats.PHYSICAL_DEFENSE:10,
stats.NATURAL_DEFENSE:10, stats.MAGIC_DEFENSE:10, stats.RESIST_LUNAR:50}),
dispel=(COMBAT,MAGIC))
class ProtectFromGoodEn( Enchantment ):
NAME = "Protect from Good"
def __init__( self ):
super(ProtectFromGoodEn, self).__init__(statline=stats.StatMod({stats.PHYSICAL_DEFENSE:10,
stats.NATURAL_DEFENSE:10, stats.MAGIC_DEFENSE:10, stats.RESIST_SOLAR:50}),
dispel=(COMBAT,MAGIC))
class RegeneratEn( Enchantment ):
NAME = "Regenerating"
def __init__( self ):
super(RegeneratEn, self).__init__(dispel=(MAGIC,DAILY))
FX = effects.TargetIsDamaged( on_true= (
effects.HealthRestore( dice=(1,6,0) )
,))
MAX_USES = 10
class ResistAtomicEn( Enchantment ):
NAME = "Resist Atomic"
def __init__( self ):
super(ResistAtomicEn, self).__init__(statline=stats.StatMod({stats.RESIST_ATOMIC:50}),
dispel=(COMBAT,MAGIC))
class ResistElementsEn( Enchantment ):
NAME = "Resist Elements"
def __init__( self ):
super(ResistElementsEn, self).__init__(statline=stats.StatMod({stats.RESIST_WIND:50,
stats.RESIST_WATER:50,stats.RESIST_POISON:50}),dispel=(COMBAT,MAGIC))
class ResistEnergyEn( Enchantment ):
NAME = "Resist Energy"
def __init__( self ):
super(ResistEnergyEn, self).__init__(statline=stats.StatMod({stats.RESIST_FIRE:50,stats.RESIST_COLD:50,
stats.RESIST_ACID:50,stats.RESIST_LIGHTNING:50}),dispel=(COMBAT,MAGIC))
class SpellShieldEn( Enchantment ):
NAME = "Spell Shield"
def __init__( self ):
super(SpellShieldEn, self).__init__(statline=stats.StatMod({stats.MAGIC_DEFENSE:25}),dispel=(COMBAT,MAGIC))
class StoneSkinEn( Enchantment ):
NAME = "Stone Skin"
def __init__( self ):
super(StoneSkinEn, self).__init__(statline=stats.StatMod({stats.RESIST_SLASHING:50,stats.RESIST_CRUSHING:50,stats.RESIST_PIERCING:50
,stats.PHYSICAL_DEFENSE:10,stats.NATURAL_DEFENSE:10,stats.MAGIC_DEFENSE:10}),dispel=(COMBAT,MAGIC))
class WoodSkinEn( Enchantment ):
NAME = "Wood Skin"
def __init__( self ):
super(WoodSkinEn, self).__init__(statline=stats.StatMod({stats.RESIST_SLASHING:25,stats.RESIST_CRUSHING:25,stats.RESIST_PIERCING:25
,stats.PHYSICAL_DEFENSE:10,stats.NATURAL_DEFENSE:10}),dispel=(COMBAT,MAGIC))
class Field( object ):
FX = None
SPRITENAME = "field_entangle.png"
combat_only = True
def __init__( self, pos, dispel = (COMBAT,MAGIC), caster=None ):
self.pos = pos
self.dispel = dispel
self.caster = caster
def generate_avatar( self ):
return image.Image( self.SPRITENAME, frame_width = 54, frame_height = 54 )
def frame( self, phase ):
return ( phase // 10 ) % 2
def invoke( self, explo ):
"""Someone is standing here. Do what needs to be done."""
if self.FX:
explo.invoke_effect( self.FX, self.caster, ( self.pos, ) )
class Entanglement( Field ):
FX = None
SPRITENAME = "field_entangle.png"
def __init__( self, pos, dispel=(COMBAT,MAGIC,stats.RESIST_FIRE,
stats.RESIST_ATOMIC), caster=None ):
super(Entanglement,self).__init__(pos,dispel=dispel,caster=caster)
def invoke( self, explo ):
# The character spends extra AP to move through this mess.
target = explo.scene.get_character_at_spot( self.pos )
if target and explo.camp.fight:
explo.camp.fight.ap_spent[target] += 2