/
passiveability.py
1700 lines (1566 loc) · 58 KB
/
passiveability.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
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/python
import sys
import listener
from combat import *
ROOT_FOLDER = "./res/images/icons/skills/"
ANARCHIST = ROOT_FOLDER + "anarchist_skills/"
ARCANE_ARCHER = ROOT_FOLDER + "arcane_archer_skills/"
ASSASSIN = ROOT_FOLDER + "assassin_skills/"
BATTLEMAGE = ROOT_FOLDER + "battlemage_skills/"
BARBARIAN = ROOT_FOLDER + "barbarian_skills/"
DRAGOON = ROOT_FOLDER + "dragoon_skills/"
DRUID = ROOT_FOLDER + "druid_skills/"
MARKSMAN = ROOT_FOLDER + "marksman_skills/"
NIGHTBLADE = ROOT_FOLDER + "nightblade_skills/"
NINJA = ROOT_FOLDER + "ninja_skills/"
SHADOW = ROOT_FOLDER + "shadow_skills/"
SORCERER = ROOT_FOLDER + "sorcerer_skills/"
SPELLSWORD = ROOT_FOLDER + "spellsword_skills/"
TACTICIAN = ROOT_FOLDER + "tactician_skills/"
TRICKSTER = ROOT_FOLDER + "trickster_skills/"
WEAPONMASTER = ROOT_FOLDER + "weaponmaster_skills/"
# passiveability.py
# Author: Devin Ekins -- G. Cube
#
# This module contains all Passives used by players and monsters.
# Individual methods are not typically commented as they represent
# the functionality of individual passives -- those passives already have
# documentation on their functionality as detailed in the description
# on both the wiki and the dictionary containing the parameters of these
# functions.
class PassiveAbilityStub(object):
def __init__(self, name):
self.name = name
info = None
if name in PassiveAbility.allContentByName:
info = PassiveAbility.allContentByName[name]
self.image = './res/images/icons/cubeforce.png'
self.text = 'No description yet.'
if 'image' in info:
self.image = info['image']
if 'text' in info:
self.text = info['text']
class PassiveAbility(object):
def __init__(self, name, owner):
self.name = name
self.owner = owner
content = PassiveAbility.allContentByName[name]
self.requiredClass = content['class']
self.level = content['level']
self.type = content['type']
self.action = content['action']
self.onStringList = None
self.offStringList = None
if 'image' in content:
self.image = content['image']
else:
self.image = './res/images/icons/cubeforce.png'
if 'text' in content:
self.text = content['text']
else:
self.text = 'No description yet.'
if self.type == 'dynamic':
self.onStringList = content['onStringList']
self.offStringList = content['offStringList']
self.registerListener()
if self.type == 'static':
if self.action:
self.action(self, self.owner)
def registerListener(self):
newListener = listener.Listener(self, self.owner, self.onStringList, self.action, self.offStringList)
self.owner.listeners.append(newListener)
# Barbarian
def applyColdEndurance(self, target):
target.baseColdResistance += 10
def applyMagicalVulnerability(self, target):
target.baseMagicResist -= 3
def applyMightyWeapon(self, target, reverse=False, other=None):
if not reverse:
if target.usingWeaponStyle("Two-Handed"):
target.baseMight += 6
else:
if target.usingWeaponStyle("Two-Handed"):
target.baseMight -= 6
def applyTwoWeaponTargeting(self, target, reverse=False, other=None):
if not reverse:
if target.usingWeaponStyle("Dual"):
target.baseMeleeAccuracy += 3
else:
if target.usingWeaponStyle("Dual"):
target.baseMeleeAccuracy -= 3
def applyBloodOnTheEdge(self, target, reverse=False, damage=0):
# No reverse possible.
hpThreshold = round(target.totalHP * 0.30)
if target.HP > hpThreshold:
return
hpThreshold = round(target.totalHP * 0.05)
if damage > hpThreshold:
return
return "Ignore Damage"
def applyMagicalIgnorance(self, target):
target.baseMagicResist -= 3
def applyStunningRecovery(self, target, reverse=False, statusName=None):
if statusName == "Stun" and not target.hasStatus("Stunning Recovery"):
healing = round(target.totalHP * 0.10)
Combat.healTarget(target, target, healing)
Combat.addStatus(target, "Stunning Recovery", duration=1)
def applyWalkItOff(self, target, reverse=False, other=None):
source = self.owner
if source.record._previousTurnTilesMoved > 0:
Combat.healTarget(source, source, int(source.totalHP * 0.01))
# Dragoon
def applyOblivious(self, target):
target.baseIntuition -= 12
target.baseAwareness -= 5
def applyPolearmSpecialization(self, target, reverse=False, other=None):
source = self.owner
if not reverse:
if source.usingWeapon("Polearm"):
source.statusForce += 30
source.statusCriticalChance += 5
else:
if source.usingWeapon("Polearm"):
source.statusForce -= 30
source.statusCriticalChance -= 5
def applyDragonFoe(self, target, reverse=False, other=None):
source = self.owner
if other.team != "Monsters":
return
if not reverse:
if other.type == "Dragonkin":
source.statusMeleeAccuracy += 2
source.statusRangedAccuracy += 2
source.statusDodge += 2
else:
if other.type == "Dragonkin":
source.statusMeleeAccuracy -= 2
source.statusRangedAccuracy -= 2
source.statusDodge -= 2
def applyFireTouched(self, target):
target.baseFireResistance += 10
def applyJumpAttackUpgrade(self, target):
toRemove = None
for abil in target.abilities:
if abil.name == "Jump Attack":
toRemove = abil
break
if toRemove:
target.abilities.remove(toRemove)
def applyJumpAttackUpgrade2(self, target):
toRemove = None
for abil in target.abilities:
if abil.name == "Faster Jump Attack":
toRemove = abil
break
if toRemove:
target.abilities.remove(toRemove)
def applyJumpAttackUpgrade3(self, target):
toRemove = None
for abil in target.abilities:
if abil.name == "Faster Jump Attack++":
toRemove = abil
break
if toRemove:
target.abilities.remove(toRemove)
# Weapon Master
def applyShieldEfficiency(self, target, reverse=False, other=None):
source = self.owner
if source.usingShield():
Combat.modifyResource(source, "AP", 1)
def applyDirectCounterattack(self, target, reverse=False, other=None):
source = self.owner
# TODO: STUB
pass
def applyShieldCounter(self, target, reverse=False, other=None):
source = self.owner
# Stack an additional 50% bludgeoning damage onto the counterattack.
# TODO: STUB
pass
def applyTwoHandedParry(self, target, reverse=False, other=None):
source = self.owner
# TODO: Make this only apply to angles that you can counterattack from.
if not source.usingWeaponStyle("Two Handed"):
return
if not reverse:
source.statusDodge += 4
else:
source.statusDodge -= 4
def applyHoldTheLine(self, target, reverse=False, percent=None):
if not reverse:
if not target.hasStatus("Hold the Line") and percent < 0.30:
Combat.addStatus(target, "Hold the Line", -1)
else:
if target.hasStatus("Hold the Line") and percent >= 0.30:
Combat.removeStatus(target, "Hold the Line")
def applyDirectCounterattack2(self, target, reverse=False, other=None):
source = self.owner
# TODO: STUB
pass
def applyDirectCounterattackUpgrade(self, target):
toRemove = None
for abil in target.abilities:
if abil.name == "Direct Counterattack":
toRemove = abil
break
if toRemove:
target.abilities.remove(toRemove)
def applyTwoWeaponGlancing(self, target, reverse=False, other=None):
source = self.owner
if not reverse:
if source.usingWeaponStyle("Dual"):
source.statusDR += 2
else:
if source.usingWeaponStyle("Dual"):
source.statusDR -= 2
def applyRapidBandaging(self, target, reverse=False, statusName=None):
# An odd mechanism to find out if the most recently applied status
# was a bleeding status...
status = target.getMostRecentStatus("Bleeding")
if status.name == statusName and Dice.rollSuccess(50):
Combat.removeStatus(target, statusName)
# Spellsword
def applySeekerOfEnchantments(self, target, reverse=False, spell=None):
if not reverse:
if spell.school == "Enchantment":
target.statusSpellpower += 6
else:
if spell.school == "Enchantment":
target.statusSpellpower -= 6
def applyDuality(self, target):
target.baseDR += 2
target.baseMagicResist += 1
def applyLastingEnchantment(self, target, reverse=False, spell=None):
if spell.school == "Enchantment":
for buff in [x for x in target.statusList if x.name == spell.name or
x.name == "Weapon Enhance Striking" or
x.name == "Weapon Enhance Punishing" or
x.name == "Weapon Enhance Precision"]:
buff.turnsLeft += 1
# Has no reverse.
def applyKeenEnchantment(self, target, reverse=False, other=None):
if not target.usingWeaponStyle("Two Handed") or not target.hasWeaponEnchant():
return
if not reverse:
target.statusCriticalChance += 8
else:
target.statusCriticalChance -= 8
def applyFocalPoint(self, target, reverse=False, other=None):
if not target.usingWeaponStyle("Two Handed") or not target.hasWeaponEnchant():
return
holyDamage = (int(15 * (1 + target.totalDivineBonusDamage * 0.01) *
(1 - other.totalDivineResistance * 0.01)))
Combat.lowerHP(other, holyDamage)
Combat.sendCombatMessage(target.name + " --> " + other.name + ": " + `holyDamage` + " " +
"Holy" + " damage", target, 'yellow')
def applyBladesOfReduction(self, target, reverse=False, other=None):
if not target.usingWeapon("Sword") and not target.usingWeapon("Axe"):
return
doApply = Dice.rollPresetChance(target, other, "Reliable")
if doApply:
duration = -1 # Never ends
Combat.addStatus(other, "Blades of Reduction", duration)
# Anarchist
def applyHateCraft(self, target):
target.bonusTrapDamage += 20
def applyShockAndBurn(self, target):
target.baseFireBonusDamage += 5
target.baseElectricBonusDamage += 5
target.baseElectricResistance += 10
target.baseArmorPenetration += 2
def applyRushedDelivery(self, target, reverse=False, other=None):
source = self.owner
if not reverse:
if source.record._currentTurnTilesMoved >= 3:
source.bonusTrapDamage += 50
source.bonusTrapRating += 2
else:
if source.record._currentTurnTilesMoved >= 3:
source.bonusTrapDamage -= 50
source.bonusTrapRating -= 2
# Marksman
def applyExcellentVision(self, target):
target._bonusRange += 2
target.baseAwareness += 2
def applyLayingInWait(self, target, reverse=False, other=False):
source = self.owner
if not reverse:
if source.record._previousTurnTilesMoved == 0:
mag = 4
Combat.addStatus(source, "Laying in Wait", duration=-1, magnitude=mag)
else:
Combat.removeStatus(source, "Laying in Wait")
def applyFireHandler(self, target):
target.baseFireResistance += 5
target.baseFireBonusDamage += 5
def applyCamouflage(self, target):
target.baseSneak += 8
target.baseDodge += 2
target.baseRangedAccuracy += 2
def applyShortbowNiche(self, target, reverse=False, other=None):
source = self.owner
if not reverse:
if source.usingWeapon("Shortbow"):
source.statusCriticalMagnitude += 10
source.statusCriticalChance += 5
else:
if source.usingWeapon("Shortbow"):
source.statusCriticalMagnitude -= 10
source.statusCriticalChance -= 5
def applyIncredibleFocus(self, target, reverse=False, statusName=None):
source = self.owner
if statusName == "Stun" and Dice.rollBeneath(75):
Combat.removeStatus(source, statusName)
def applySuperiorTraining(self, target, reverse=False, other=None):
source = self.owner
duration = 2 # Decremented almost immediately.
mag = 3
Combat.addStatus(source, "Superior Training", duration, mag)
# Druid
def applyKnowledgeOfPoison(self, target):
target.basePoisonBonusDamage += 30
def applyPotencyOfPoisons(self, target):
target.basePoisonRatingBonus += 5
def applyExposureToPoison(self, target):
target.basePoisonTolerance += 5
target.basePoisonResistance += 20
def applyTimeWithNature(self, target):
target.basePoisonResistance += 5
target.baseColdResistance += 5
# Tactician
def applySpellsOfDeception(self, target, reverse=False, spell=None):
if not reverse:
if spell.school == "Illusion" or spell.school == "Mental":
target.statusSpellpower += 5
else:
if spell.school == "Illusion" or spell.school == "Mental":
target.statusSpellpower -= 5
# Assassin
def applyAnatomy(self, target):
target.baseCriticalChance += 10
def applySlightlySneakier(self, target):
target.baseSneak += 3
def applyDabblesWithPoison(self, target):
target.basePoisonRatingBonus += 2
# Shadow
def applyADabblerOfSorts(self, target):
target.basePoisonRatingBonus += 3
target.basePoisonBonusDamage += 5
def applyBackflip(self, target, reverse=False, other=None):
source = self.owner
direction = other.cLocation.direction_to(source.cLocation)
if not Combat.againstWall(source.cPane, source.cLocation, direction):
if not reverse:
source.statusDodge += 3
else:
source.statusDodge -= 3
def applyTreasureBag(self, target):
target.baseInventoryCapacity += 15
def applyAnEyeForValue(self, target):
target.goldFind += 2
def applySlingSkills(self, target, reverse=False, other=None):
source = self.owner
if not reverse:
if source.usingWeapon("Sling"):
source.statusRangedAccuracy += 5
else:
if source.usingWeapon("Sling"):
source.statusRangedAccuracy -= 5
def applyHideInPeril(self, target, reverse=False, damage=None):
source = self.owner
if damage >= source.totalHP * 0.3 and not source.inStealth():
Combat.addStatus(source, "Shadow Walk", -1)
def applyBackstabUpgrade(self, target):
toRemove = None
for abil in target.abilities:
if abil.name == "Backstab":
toRemove = abil
break
if toRemove:
target.abilities.remove(toRemove)
def applyBackstabUpgrade2(self, target):
toRemove = None
for abil in target.abilities:
if abil.name == "Bleeding Backstab":
toRemove = abil
break
if toRemove:
target.abilities.remove(toRemove)
# Nightblade
def applyNightArmor(self, target):
target.baseDR += 3
target.baseShadowResistance += 3
target.avoidanceChance += 3
def applyForbiddenStudies(self, target):
target.baseShadowBonusDamage += 5
def applySingleBlade(self, target, reverse=False, other=None):
source = self.owner
if not reverse:
if source.usingWeaponStyle("Single"):
source.statusMeleeAccuracy += 4
source.statusCriticalChance += 6
else:
if source.usingWeaponStyle("Single"):
source.statusMeleeAccuracy -= 4
source.statusCriticalChance -= 6
def applyMagicalDarkness(self, target, reverse=False, **kwArgs):
source = self.owner
if not reverse:
if source.inStealth():
source.statusShadowBonusDamage += 5
source.statusSpellpower += 4
else:
if source.inStealth():
source.statusShadowBonusDamage -= 5
source.statusSpellpower -= 4
def applyUpCloseAndPersonal(self, target, reverse=False, spell=None):
source = self.owner
if not reverse:
if spell.school == "Bane" and source.cLocation.in_melee_range(target.cLocation):
source.statusSpellpower += 4
else:
if spell.school == "Bane" and source.cLocation.in_melee_range(target.cLocation):
source.statusSpellpower -= 4
def applySingleBlade2(self, target, reverse=False, other=None):
source = self.owner
if not reverse:
if source.usingWeaponStyle("Single"):
source.statusMeleeAccuracy += 4
source.statusCriticalChance += 6
else:
if source.usingWeaponStyle("Single"):
source.statusMeleeAccuracy -= 4
source.statusCriticalChance -= 6
# Battle Mage
def applyCloseRangedMagic(self, target, reverse=False, spell=None):
if not reverse:
if spell.range < 4:
target.baseSpellpower += 6
else:
if spell.range < 4:
target.baseSpellpower -= 6
def applyManaAttack(self, target, reverse=False, other=None):
if not reverse:
Combat.modifyResource(target, "MP", 8)
else:
pass
def applyDireMana(self, target, reverse=False, damage=0):
if not reverse:
if damage >= target.totalHP * 0.15:
Combat.modifyResource(target, "MP", int(round(target.totalMP * 0.10)))
else:
pass
def applyMysticalAccuracy(self, target):
target.baseMeleeAccuracy += 2
def applyMysticalShieldUse(self, target, reverse=False, other=None):
if not reverse:
if target.usingShield("Any"):
target.baseDR += 3
else:
if target.usingShield("Any"):
target.baseDR -= 3
def applyRapidRetreat(self, target, reverse=False, other=None):
if not reverse:
if target.HP < target.totalHP * 0.20:
Combat.setMovementCost(target, 3)
else:
Combat.setMovementCost(target, -1)
def applyMilitaryDefensiveTraining(self, target, reverse=False, spell=None):
if not target.usingShield():
return
if not reverse:
target.statusMagicResist += 3
else:
target.statusMagicResist -= 3
def applyMilitarySpellTraining(self, target, reverse=False, spell=None):
if target.usingShield():
return
if not reverse:
target.statusSpellpower += 2
else:
target.statusSpellpower -= 2
def applyMilitaryOffensiveTraining(self, target, reverse=False, other=None):
if target.usingWeapon("Club"):
if not reverse:
target.statusMight += 5
else:
target.statusMight -= 5
else:
if not reverse:
target.statusMeleeAccuracy += 2
else:
target.statusMeleeAccuracy -= 2
def applyRefraction(self, target, reverse=False, spell=None):
if spell.range > -1 and spell.range < 5:
duration = 1
magnitude = 5
Combat.addStatus(self.owner, "Refraction", duration, magnitude)
# Arcane Archer
def applyManaArrows(self, target, reverse=False, other=None):
source = self.owner
if source.usingWeapon("Bow") or source.usingWeapon("Crossbow"):
Combat.modifyResource(source, "MP", source.arcaneArcherManaRegen)
def applyConduit(self, target):
target.baseArcaneBonusDamage += 15
target.baseCriticalMagnitude += 5
def applyMysticalResearch(self, target, reverse=False, spell=None):
source = self.owner
if not reverse:
if spell.school == "Mystic":
source.statusSpellpower += 4
else:
if spell.school == "Mystic":
source.statusSpellpower -= 4
def applyArcaneThreadingUpgrade(self, target):
toRemove = None
for abil in target.abilities:
if abil.name == "Arcane Threading":
toRemove = abil
break
if toRemove:
target.abilities.remove(toRemove)
# Trickster
def applyWildSurvival(self, target):
target.baseDodge += 14
def applyGlee(self, target, reverse=False):
source = self.owner
Combat.modifyResource(source, "MP", source.level * 2 + 10)
def applyInfuriatingBlows(self, target, reverse=False, other=None):
source = self.owner
Combat.modifyResource(source, "MP", 2)
def applyBurningPassion(self, target):
target.baseFireBonusDamage += 15
def applyDoubleDodge(self, target, reverse=False):
source = self.owner
Combat.addStatus(source, "Double Dodge", 1)
magnitude = min(15, 5 * source.getStatusStackCount("Double Dodge"))
source.statusDodge += magnitude
def applyRiskyFighting(self, target, reverse=False, other=None):
source = self.owner
if not reverse:
if source.usingWeaponStyle("Dual"):
source.statusMeleeAccuracy += 4
source.statusCriticalChance += 5
else:
if source.usingWeaponStyle("Dual"):
source.statusMeleeAccuracy -= 4
source.statusCriticalChance -= 5
def applySlightlySmugger(self, target, reverse=False):
source = self.owner
duration = 2
magnitude = 3
Combat.addStatus(source, "Slightly Smugger", duration, magnitude)
def applyJustPlainLucky(self, target):
target.baseDodge += 3
# Debug
def applyLibertarian(self, target):
target.baseHP += 1000
# Monsters
def applyDeflectMissiles(self, target, reverse=False, other=None):
''' Monsters with Deflect Missiles gain 10 Dodge and 5% DR against Ranged
attacks.'''
source = self.owner
if not reverse:
source.statusDR += 5
source.statusDodge += 10
else:
source.statusDR -= 5
source.statusDodge -= 10
def applyGrowingBoldness(self, target, reverse=False, other=None):
''' Monsters with Growing Boldness gain +2 Strength and 1% attack power after
every attempt to attack in melee. '''
source = self.owner
source.statusStrength += 2
source.attackPower += 1
Combat.sendCombatMessage(source.name + " Grows more bold.", other, color='red')
def applyKnockback2(self, target, reverse=False, other=None):
''' Monsters with Knockback 2, will knockback targets when they successfully
hit them with their basic attack 2 tiles. '''
source = self.owner
distance = 2
#Combat.knockback(other, self.cLocation, distance)
def applyMonsterAgility(self, target):
''' Monsters with 'Monster Agility' have +10-30 Dodge (based on level). '''
target.baseDodge += target.level + 10
def applyPanic(self, target, reverse=False, other=None):
''' Monsters that Panic gain Dexterity (increasing their accuracy and
dodge) every time they are hit with melee attacks.
Lasts the entire battle and stacks. '''
source = self.owner
source.statusDexterity += 2
Combat.sendCombatMessage(source.name + " Panics; +2 Dexterity.", other, color='red')
def applyRegeneration(self, target, reverse=False):
''' Monsters with regerenation recover 15% of their max HP each turn.'''
source = self.owner
source.HP += round(source.totalHP * 0.15)
allContentByName = {
'Cold Endurance':
{
'class' : 'Barbarian',
'level' : 1,
'type' : 'static',
'action' : applyColdEndurance,
'image' : BARBARIAN + "cold-endurance.png",
'text' : '+10% Cold Resistance'
},
'Magical Vulnerability':
{
'class' : 'Barbarian',
'level' : 1,
'type' : 'static',
'action' : applyMagicalVulnerability,
'image' : BARBARIAN + "magical-vulnerability.png",
'text' : '-3 Magic Resist'
},
'Mighty Weapon':
{
'class' : 'Barbarian',
'level' : 2,
'type' : 'dynamic',
'action' : applyMightyWeapon,
'onStringList' : ['Outgoing Melee Attack'],
'offStringList' : ['Outgoing Melee Attack Complete'],
'image' : BARBARIAN + "mighty-weapon.png",
'text' : '+6 Might on attacks with two-handed weapons'
},
'Two Weapon Targeting':
{
'class' : 'Barbarian',
'level' : 2,
'type' : 'dynamic',
'action' : applyTwoWeaponTargeting,
'onStringList' : ['Outgoing Melee Attack'],
'offStringList' : ['Outgoing Melee Attack Complete'],
'image' : BARBARIAN + "two-weapon-targeting.png",
'text' : "+3 Accuracy on attacks with two weapons"
},
'Blood on the Edge':
{
'class' : 'Barbarian',
'level' : 3,
'type' : 'dynamic',
'action' : applyBloodOnTheEdge,
'onStringList' : ['Incoming Damage'],
'offStringList' : [],
'image' : BARBARIAN + "blood-on-the-edge.png",
'text' : "Any incoming damage dealing less than 5% of maximum HP\n" + \
"is ignored while the Barbarian has less than 30% HP."
},
'Magical Ignorance':
{
'class' : 'Barbarian',
'level' : 3,
'type' : 'static',
'action' : applyMagicalIgnorance,
'image' : BARBARIAN + "magical-ignorance.png",
'text' : '-3 Magic Resist'
},
'Stunning Recovery':
{
'class' : 'Barbarian',
'level' : 4,
'type' : 'dynamic',
'action' : applyStunningRecovery,
'onStringList' : ['Incoming Status Applied'],
'offStringList' : [],
'image' : BARBARIAN + "stunning-recovery.png",
'text' : 'Whenever the Barbarian is stunned, he recovers 10% of his\n' + \
'Maximum HP. May occur once per monster turn.'
},
'Walk it off':
{
'class' : 'Barbarian',
'level' : 5,
'type' : 'dynamic',
'action' : applyWalkItOff,
'onStringList' : ['Player Turn Start'],
'offStringList' : [],
'image' : BARBARIAN + "walk-it-off.png",
'text' : 'As long as the Barbarian performed at least one movement action\n' + \
'during the previous turn, he regains 1% Max HP at the start of\n' + \
'this turn.'
},
'Oblivious':
{
'class' : 'Dragoon',
'level' : 1,
'type' : 'static',
'action' : applyOblivious,
'image' : DRAGOON + "oblivious.png",
'text' : 'Focusing on the sky all the time clouds your mind.\n' + \
'-12 Intuition, -5 Awareness'
},
'Polearm Specialization':
{
'class' : 'Dragoon',
'level' : 1,
'type' : 'dynamic',
'action' : applyPolearmSpecialization,
'onStringList' : ['Outgoing Melee Attack'],
'offStringList' : ['Outgoing Melee Attack Complete'],
'image' : DRAGOON + "polearm-specialization.png",
'text' : 'Grants Force x 1.30 and Critical hit chance + 5% when using polearms.'
},
'Dragon Foe':
{
'class' : 'Dragoon',
'level' : 1,
'type' : 'dynamic',
'action' : applyDragonFoe,
'onStringList' : ['Outgoing Melee Attack', 'Outgoing Ranged Attack',
'Incoming Melee Attack', 'Incoming Ranged Attack'],
'offStringList' : ['Outgoing Melee Attack Complete', 'Outgoing Ranged Attack Complete',
'Incmoing Melee Attack Complete', 'Incoming Ranged Attack Complete'],
'image' : DRAGOON + 'dragon-foe.png',
'text' : '+2 Melee and Ranged Accuracy vs. dragonkin and +2 Dodge vs. their attacks.'
},
'Fire-Touched':
{
'class' : 'Dragoon',
'level' : 2,
'type' : 'static',
'action' : applyFireTouched,
'image' : DRAGOON + 'fire-touched.png',
'text' : '+10% Fire Resistance'
},
'--IGNORE-- Jump Attack Upgrade':
{
'class' : 'Dragoon',
'level' : 3,
'type' : 'static',
'action' : applyJumpAttackUpgrade
},
'--IGNORE-- Jump Attack Upgrade 2':
{
'class' : 'Dragoon',
'level' : 4,
'type' : 'static',
'action' : applyJumpAttackUpgrade2
},
'--IGNORE-- Jump Attack Upgrade 3':
{
'class' : 'Dragoon',
'level' : 5,
'type' : 'static',
'action' : applyJumpAttackUpgrade3
},
'Shield Efficiency':
{
'class' : 'Weapon Master',
'level' : 1,
'type' : 'dynamic',
'action' : applyShieldEfficiency,
'onStringList' : ['Outgoing Melee Attack'],
'offStringList' : [],
'image' : WEAPONMASTER + 'shield-efficiency.png',
'text' : 'Basic melee attacks refund 1 AP when using a shield.'
},
'Direct Counterattack':
{
'class' : 'Weapon Master',
'level' : 1,
'type' : 'dynamic',
'action' : applyDirectCounterattack,
'onStringList' : ['Incoming Melee Attack'],
'offStringList' : [],
'image' : WEAPONMASTER + 'direct-counterattack.png',
'text' : "Upon being attacked in melee by an enemy directly\n" +\
"in front of you, you will immediately counterattack with a\n" +\
"basic melee attack during the enemy's turn."
},
'Shield Counter':
{
'class' : 'Weapon Master',
'level' : 2,
'type' : 'dynamic',
'action' : applyShieldCounter,
'onStringList' : ['Outgoing Counterattack'],
'offStringList' : [],
'image' : WEAPONMASTER + 'shield-counter.png',
'text' : 'Deal 50% extra damage as bludgeoning during counterattacks.\n' +\
'Must have a shield equipped.'
},
'Two-Handed Parry':
{
'class' : 'Weapon Master',
'level' : 2,
'type' : 'dynamic',
'action' : applyTwoHandedParry,
'onStringList' : ['Incoming Melee Attack'],
'offStringList' : ['Incoming Melee Attack Complete'],
'image' : WEAPONMASTER + 'two-handed-parry.png',
'text' : 'When attacked from angles from which you can counterattack,\n' +\
'+4 Dodge if equipped with a two-handed weapon.'
},
'Hold the Line':
{
'class' : 'Weapon Master',
'level' : 3,
'type' : 'dynamic',
'action' : applyHoldTheLine,
'onStringList' : ['Player HP Level Changed'],
'offStringList' : ['Player HP Level Changed'],
'image' : WEAPONMASTER + 'hold-the-line.png',
'text' : 'If your HP is reduced below 30%, you gain +5% DR until\n' +\
'it reaches 30% or higher. Must have a shield equipped.'
},
'Direct Counterattack 2':
{
'class' : 'Weapon Master',
'level' : 4,
'type' : 'dynamic',
'action' : applyDirectCounterattack2,
'onStringList' : ['Incoming Melee Attack'],
'offStringList' : [],
'image' : WEAPONMASTER + 'direct-counterattack.png',
'text' : "Upon being attacked in melee by an enemy directly\n" +\
"in front of you, or front-diagonal to you, you will\n" +\
"immediately counterattack with a basic melee\n" +\
"attack during the enemy's turn."
},
'--IGNORE-- Direct Counterattack Upgrade':
{
'class' : 'Weapon Master',
'level' : 4,
'type' : 'static',
'action' : applyDirectCounterattackUpgrade
},
'Two-Weapon Glancing':
{
'class' : 'Weapon Master',
'level' : 5,
'type' : 'dynamic',
'action' : applyTwoWeaponGlancing,
'onStringList' : ['Incoming Melee Attack'],
'offStringList' : ['Incoming Melee Attack Complete'],
'image' : WEAPONMASTER + 'two-weapon-glancing.png',
'text' : 'Gain +2% DR against melee attacks while equipping two weapons.'
},
'Rapid Bandaging':
{
'class' : 'Weapon Master',
'level' : 5,
'type' : 'dynamic',
'action' : applyRapidBandaging,
'onStringList' : ['Incoming Status Applied'],
'offStringList' : [],
'image' : WEAPONMASTER + 'rapid-bandaging.png',
'text' : 'When a bleeding effect would normally be applied to the\n' +\
'Weaponmaster, there is a 50% chance that it will be ignored.'
},
'Seeker of Enchantments':
{
'class' : 'Spellsword',
'level' : 1,
'type' : 'dynamic',
'action' : applySeekerOfEnchantments,
'onStringList' : ['Outgoing Spell Cast'],
'offStringList' : ['Outgoing Spell Cast Complete'],
'image' : SPELLSWORD + 'seeker-of-enchantments.png',
'text' : '+6 Spellpower when casting enchantment spells'
},
'Duality':
{
'class' : 'Spellsword',
'level' : 1,
'type' : 'static',
'action' : applyDuality,
'image' : SPELLSWORD + 'duality.png',
'text' : '+2% DR and +1 magic resist'
},
'Lasting Enchantment':
{
'class' : 'Spellsword',
'level' : 2,
'type' : 'dynamic',
'action' : applyLastingEnchantment,
'onStringList' : ['Outgoing Spell Cast Complete'],
'offStringList' : [],
'image' : SPELLSWORD + 'lasting-enchantment.png',
'text' : '+1 Turn to all enchantments cast on yourself'
},
'Keen Enchantment':
{
'class' : 'Spellsword',
'level' : 3,
'type' : 'dynamic',
'action' : applyKeenEnchantment,
'onStringList' : ['Outgoing Melee Attack'],
'offStringList' : ['Outgoing Melee Attack Complete'],
'image' : SPELLSWORD + 'keen-enchantment.png',
'text' : '+8% To critical hit chance when using a two-handed weapon\n' + \
'that is also benefiting from a Spellsword enchantment.'
},