forked from Gibberlings3/EE_Fixpack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bg2ee.tph
1567 lines (1397 loc) · 74.8 KB
/
bg2ee.tph
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
///// \\\\\
///// string fixes \\\\\
///// \\\\\
// string fixes, processed automatically if tra file exists
LAUNCH_ACTION_FUNCTION cd_string_set_from_tra
STR_VAR input_tra = EVAL ~eefixpack/languages/%LANGUAGE%/fixes_%game%.tra~ // tra file to process
output_tph = EVAL ~weidu_external/eefixpack/fixes_%game%.tph~ // tph being built; use weidu_external for this
END
///// \\\\\
///// lua fixes \\\\\
///// \\\\\
///// \\\\\
///// ids/2da fixes \\\\\
///// \\\\\
INCLUDE ~eefixpack/files/tph/a7/anim_3001.tph~ // fix missing creature animation definitions for Neothelid
/*
luke
**splprot.2da**
- the newly added (v2.6) header descriptions are incorrect for the alignment rows
*/
WITH_SCOPE BEGIN
COPY_EXISTING "splprot.2da" "override"
COUNT_2DA_COLS "cols"
SET_2DA_ENTRY 33 0 "%cols%" "33_ALIGNMENTBITS=GOOD" // NOT BIT1 = Not NEUTRAL or EVIL
SET_2DA_ENTRY 34 0 "%cols%" "34_ALIGNMENTBITS!=GOOD" // HAS BIT1 = Is NEUTRAL or EVIL
SET_2DA_ENTRY 35 0 "%cols%" "35_ALIGNMENTBITS=NEUTRAL" // NOT BIT0 = Not GOOD or EVIL
SET_2DA_ENTRY 36 0 "%cols%" "36_ALIGNMENTBITS!=NEUTRAL" // HAS BIT0 = Is GOOD or EVIL
SET_2DA_ENTRY 37 0 "%cols%" "37_ALIGNMENTBITS=EVIL"
SET_2DA_ENTRY 38 0 "%cols%" "38_ALIGNMENTBITS!=EVIL"
SET_2DA_ENTRY 59 0 "%cols%" "59_ALIGNMENTBITS=LAWFUL" // NOT BIT5 = Not CHAOTIC or NEUTRAL
SET_2DA_ENTRY 60 0 "%cols%" "60_ALIGNMENTBITS!=LAWFUL" // HAS BIT5 = Is CHAOTIC or NEUTRAL
SET_2DA_ENTRY 61 0 "%cols%" "61_ALIGNMENTBITS=CHAOTIC"
SET_2DA_ENTRY 62 0 "%cols%" "62_ALIGNMENTBITS!=CHAOTIC"
SET_2DA_ENTRY 118 0 "%cols%" "118_ALIGNMENTBITS!=n" // Clearly state it is a bitwise check
// Formatting
PRETTY_PRINT_2DA
BUT_ONLY_IF_IT_CHANGES
END
INCLUDE ~eefixpack/files/tph/clswpbon.tpa~ // tbd, cam: fix non-prof penalties for shadowdancers, mage-thieves
//tbd, cam
// battleguards starting in tob lack a weapon due to a typo
COPY_EXISTING ~25stweap.2da~ ~override~
REPLACE_TEXTUALLY ~[ %TAB%]ham07[ %TAB%]~ ~ hamm07 ~
PRETTY_PRINT_2DA
///// \\\\\
///// mass copy/includes actions \\\\\
///// \\\\\
COPY ~eefixpack/files/bam/ixbow04.bam~ ~override~ // tbd, cam: fix light crossbow BAM
~eefixpack/files/2da/clabmo02.2da~ ~override~ // tbd, cam: borked kit ability table, dark moon monk
~eefixpack/files/2da/clabmo03.2da~ ~override~ // tbd, cam: borked kit ability table, sun soul monk
~eefixpack/files/2da/clabrn02.2da~ ~override~ // tbd, cam: borked kit ability table, archer
~eefixpack/files/2da/spwi417.2da~ ~override~ // tbd, cam: allow enchant weapon to be cast via contingency
~eefixpack/files/bam/mdem~ ~override~ // tbd, sam.: merging four-frame animations to fix issues, demogorgon
~eefixpack/files/bam/mdr1~ ~override~ // tbd, sam.: merging four-frame animations to fix issues, dragon red
~eefixpack/files/bam/mdr2~ ~override~ // tbd, sam.: merging four-frame animations to fix issues, dragon black
~eefixpack/files/bam/mdr3~ ~override~ // tbd, sam.: merging four-frame animations to fix issues, dragon silver
~eefixpack/files/bam/mwyv~ ~override~ // tbd, sam.: merging four-frame animations to fix issues, wyvern big
~eefixpack/files/eff/balth01b.eff~ ~override~ // tbd, cam: balthazar's solar stance! should have fire-damage melee hit effects that also drain hp
~eefixpack/files/bam/cmnk1inv.bam~ ~override~ // monk (tutorial, not pc) paperdoll
// tbd, sam.
// merging multi-part area animations to eliminate issues
ACTION_FOR_EACH file IN
1400t001 1400t002 1400t003 1400t004 1400t005 am0602c am0602d am0602k1 am0602k2 am0602l1 am0602l2
am0801b1 am0801b2 am0902l am0902l1 am0902l2 am0902l3 am0902l4 am2000a am2000a1 am2000a2 am2000a3
am2000a4 am2000b am2000b1 am2000b2 am2000b3 am2000b4 am2805b am2805c am414e11 am414e12
BEGIN
COPY ~eefixpack/files/bam/area_anim/%file%.bam~ ~override~
END
// tbd, cam (from jmerry)
// curing poison should also cure insta-death from green slimes
//INCLUDE ~eefixpack/files/tph/tbd_green_slime.tph~ now part of 'cure' fixes
// tbd, cam (from jmerry)
// vernus can't be raised
INCLUDE ~eefixpack/files/tph/tbd_vernus_resurrection.tph~
//tbd, cam
// wilson fixes: strength exploit, AC fixes, regen fixes
INCLUDE ~eefixpack/files/tph/tbd_wilson.tph~
// bgcs-3460, cam
// death tyrant animation fixes
INCLUDE ~eefixpack/files/tph/b3460_death_tyrant.tph~ // bgcs-3460, cam: death tyrant animation fixes
// bgcs-3397, cam
// revenant animation fixes
INCLUDE ~eefixpack/files/tph/b3397_revenant.tph~ // bgcs-3397, cam: revenant animation fixes
// tbd, cam
// make troll animations make sense: https://www.gibberlings3.net/forums/topic/35642-troll-animations/
INCLUDE ~eefixpack/files/tph/tbd_bg2_troll_anims.tph~
// tbd, cam
// potion of icedust doesn't work since it uses an enemy-only projectile for a buff
INCLUDE ~eefixpack/files/tph/tbd_icedust.tph~ // tbd, cam: potion of icedust doesn't work since it uses an enemy-only projectile for a party-only buff
///// \\\\\
///// mechanics fixes / overhauls \\\\\
///// \\\\\
// kjeron
WITH_SCOPE BEGIN
WITH_TRA "eefixpack/languages/en_us/luke/polymorph_overhaul.tra" "eefixpack/languages/%LANGUAGE%/luke/polymorph_overhaul.tra" BEGIN
INCLUDE "eefixpack/files/tph/luke/polymorph_overhaul.tph"
LAF "POLYMORPH_OVERHAUL" END
END
END
///// \\\\\
///// dialogue fixes \\\\\
///// \\\\\
COMPILE ~eefixpack/files/d/%game%_core_fixes.d~ // misc dialogue fixes
///// \\\\\
///// script fixes \\\\\
///// \\\\\
// tbd, cam
// ranger stronghold fails if you're in Umar Hills when Delon spawn timer expires; see also delon.dlg
COPY_EXISTING ~ar1100.bcs~ ~override~
DECOMPILE_AND_PATCH BEGIN
REPLACE_TEXTUALLY ~\(NumDeadLT("rogron",6)\)~ ~\1 Global("CDDelonSpoke","GLOBAL",1)~
END
BUT_ONLY
// tbd, cam
// siege camp reinforcements checking wrong blocks
COPY_EXISTING ~ar5203.bcs~ ~override~
DECOMPILE_AND_PATCH BEGIN
REPLACE_TEXTUALLY ~GlobalLT("EXTRACOUNT2","MYAREA",1)[ %TAB%%LNL%%MNL%%WNL%]+\(ActionListEmpty()[ %TAB%%LNL%%MNL%%WNL%]+InActiveArea(Myself)[ %TAB%%LNL%%MNL%%WNL%]+THEN[ %TAB%%LNL%%MNL%%WNL%]+RESPONSE #30[ %TAB%%LNL%%MNL%%WNL%]+IncrementGlobal("MaxSpawn","AR5203",1)[ %TAB%%LNL%%MNL%%WNL%]+CreateCreatureObjectOffScreen("YSSOLD04",Player1,0,0,0)[ %TAB%%LNL%%MNL%%WNL%]+IncrementGlobal("EXTRACOUNT3","MYAREA",1)\)~
~GlobalLT("EXTRACOUNT3","MYAREA",1) \1~
END
BUT_ONLY
// tbd, cam
// firkraag should despawn at the copper coronet once you engage in the windpear events
EXTEND_TOP ~firkra01.bcs~ ~eefixpack/files/baf/firkra01.baf~
// tbd, cam
// two CC guards have unbounded scripts blocks that loop
COPY_EXISTING ~guard1a.bcs~ ~override~ // unbounded guard scripts in CC
~guard1b.bcs~ ~override~
DECOMPILE_AND_PATCH BEGIN
REPLACE_TEXTUALLY ~\(Allegiance(Myself,NEUTRAL)\)~ ~\1 Global("f4imoved","LOCALS",0)~
REPLACE_TEXTUALLY ~\(MoveToPoint(\[[0-9]+\.[0-9]+\])\)~ ~\1 SetGlobal("f4imoved","LOCALS",1)~
END
BUT_ONLY
// tbd, cam
// love talk sets trigger for jaheira's bandits to spawn, but shouldn't occur if romance ends before timer is up
COPY_EXISTING ~jaheira.bcs~ ~override~
DECOMPILE_AND_PATCH BEGIN
REPLACE_TEXTUALLY ~\(Global("JaheiraBanditPlot","GLOBAL",1)\)~ ~\1 OR(2) Global("JaheiraRomanceActive","GLOBAL",1) Global("JaheiraRomanceActive","GLOBAL",2)~
END
BUT_ONLY
// ie-5948, cam
// Generic cleric AI script can hang
COPY_EXISTING ~pries14a.bcs~ ~override~
DECOMPILE_AND_PATCH BEGIN
REPLACE_TEXTUALLY ~\(IF[ %TAB%%LNL%%MNL%%WNL%]See(NearestEnemyOf(Myself))[ %TAB%%LNL%%MNL%%WNL%]+HaveSpell(CLERIC_CONFUSION)[ %TAB%%LNL%%MNL%%WNL%]+THEN[ %TAB%%LNL%%MNL%%WNL%]+RESPONSE #100[ %TAB%%LNL%%MNL%%WNL%]\)\(END\)~
~\1 Spell(NearestEnemyOf(Myself),CLERIC_CONFUSION) \2~
END
BUT_ONLY
// ie-5281, cam
// bp2: Golem fight is well-nigh impossible on Legacy of Bhaal difficulty
COPY_EXISTING ~ohb_t302.bcs~ ~override~
DECOMPILE_AND_PATCH BEGIN
REPLACE_TEXTUALLY ~LevelGT(Myself,10)~ ~HasItem("immune1",Myself)~
END
BUT_ONLY
// tbd, cam (from jmerry)
// area script can loop
COPY_EXISTING ~oh7200.bcs~ ~override~
DECOMPILE_AND_PATCH BEGIN
REPLACE_TEXTUALLY ~\(AmbientActivate("Hidcont",TRUE)\)~ ~\1 SetGlobal("OHH_wiztrap","OH7200",2)~
END
BUT_ONLY
// tbd, cam (two issues here, see bysohim in main d compile)
// Yoshimo Should Have Follow-Up Banters with the PC
EXTEND_BOTTOM ~yoshimo.bcs~ ~eefixpack/files/baf/yoshimo_banter.baf~ // add script prompt for third banter
///// \\\\\
///// area fixes \\\\\
///// \\\\\
// tbd, cam (from jmerry)
// npcs spawning/moving on impassable terrain (see also baerie.dlg, aeriej.dlg, ar1000.are)
COPY_EXISTING ~ar0800.are~ ~override~ // Graveyard District, Stein
LPF ALTER_AREA_ACTOR INT_VAR y_coord=1071 STR_VAR actor_name=Stein END
BUT_ONLY
// tbd, cam (from jmerry)
// npcs spawning/moving on impassable terrain (see also baerie.dlg, aeriej.dlg, ar0800.are)
COPY_EXISTING ~ar1000.are~ ~override~ // Government District, Amnish Soldier
READ_LONG 0x54 ofsActors
READ_SHORT 0x58 numActors
FOR (idx = 0; idx < numActors; ++idx) BEGIN
SET offsetx = ofsActors + (idx * 0x110) + 0x20
SET offsety = ofsActors + (idx * 0x110) + 0x22
READ_SHORT offsetx xpos
READ_SHORT offsety ypos
PATCH_IF ((xpos = 2796) AND (ypos = 538)) BEGIN
WRITE_SHORT offsety 558
END
END // Multiple actors with same name, long version needed
BUT_ONLY
///// \\\\\
///// creature file fixes \\\\\
///// \\\\\
INCLUDE ~eefixpack/files/tph/tbd_elemental_summons.tph~ // tbd, cam: elemental prince summons shouldn't grant XP
INCLUDE ~eefixpack/files/tph/tbd_conjure_animals_bearposu.tph~ // tbd, cam: bears summoned by conjure animals should used summoned scripts, not bear scripts
// ie-3658, cam
// Jassar (and others) shouldn't drop identified magic armor
COPY_EXISTING ~ohbgit01.cre~ ~override~
~ohbthr01.cre~ ~override~
~ohdcru04.cre~ ~override~
~ohdlufpl.cre~ ~override~
~ohnvgc.cre~ ~override~
~ohrjassa.cre~ ~override~
REPLACE_CRE_ITEM ~plat23~ #0 #0 #0 ~NONE~ ~ARMOR~ // replace plat19, the special 0-lore armor from wish with identical plate with lore
// tbd, cam (originally from jmerry)
// joinable NPCs should have proper trueclass kit values
COPY_EXISTING ~anomen10.cre~ ~override~ // anomen
~anomen12.cre~ ~override~ // anomen
~anomen6.cre~ ~override~ // anomen
~anomen7.cre~ ~override~ // anomen
~anomen8.cre~ ~override~ // anomen
~anomen9.cre~ ~override~ // anomen
~imoen.cre~ ~override~ // imoen
~imoen10.cre~ ~override~ // imoen
~imoen15.cre~ ~override~ // imoen
~imoen211.cre~ ~override~ // imoen
~imoen213.cre~ ~override~ // imoen
~kivan.cre~ ~override~ // kivan
~kivan4.cre~ ~override~ // kivan
~kivan6.cre~ ~override~ // kivan
~mazzy11.cre~ ~override~ // mazzy
~mazzy12.cre~ ~override~ // mazzy
~mazzy15.cre~ ~override~ // mazzy
~mazzy8.cre~ ~override~ // mazzy
~mazzy9.cre~ ~override~ // mazzy
~sarevok.cre~ ~override~ // sarevok
WRITE_LONG 0x244 0x40000000 // proper trueclass value
BUT_ONLY IF_EXISTS
// tbd, cam
// has all hallmarks of fear immunity except fear immunity itself
COPY_EXISTING ~gith03.cre~ ~override~ // anti-paladin - blocks cdhorror
~ohgith03.cre~ ~override~ // anti-paladin - blocks cdhorror
LPF ALTER_EFFECT INT_VAR match_opcode = 101 match_parameter2 = 101 parameter2 = 24 END // yo dawg, we heard you like immunity to effect, so we immunity to efected your immunity to effect
BUT_ONLY
// immune to confusion, but missing spconfus immunity
COPY_EXISTING ~ohhgmum.cre~ ~override~ // greater mummy - immune to fear - immune to confusion
~ohhraffi.cre~ ~override~ // raffiyah - immune to fear - immune to confusion
LPF CLONE_EFFECT INT_VAR multi_match = 1 match_opcode = 101 match_parameter2 = 128 opcode = 296 parameter2 = 0 STR_VAR resource = spconfus END
BUT_ONLY
// tbd, cam
// HD too low for most ankhegs; bgee ones also had pickpocketable shells
INCLUDE ~eefixpack/files/tph/tbd_ankheg.tph~
//tbd, cam
// poison mists can be summoned but can also spawn as normal creatures, so need both a gender: neither and gender: summoned version
INCLUDE ~eefixpack/files/tph/tbd_poison_mists.tph~
// BGCS-469, luke
// Lizard Men should be flagged as 'LIZARDMAN'
WITH_SCOPE BEGIN
COPY_EXISTING_REGEXP ~ohbliz0[1-3].cre~ ~override~ // The Black Pits 2
WRITE_BYTE 0x272 IDS_OF_SYMBOL ("RACE" "LIZARDMAN")
BUT_ONLY_IF_IT_CHANGES
END
///// \\\\\
///// item file fixes \\\\\
///// \\\\\
INCLUDE ~eefixpack/files/tph/tbd_bg2ee_146.tph~ // tbd, cam: fixes items that cast spells
INCLUDE ~eefixpack/files/tph/tbd_energy_blades.tph~ // tbd, cam: per descript, energy blades should do missile damage, not slashing
// tbd, cam
// aegis fang has wrong enchantment level
COPY_EXISTING ~aegis.itm~ ~override~ // Aegis-fang +3
~aegis2.itm~ ~override~ // Aegis-fang +3
WRITE_LONG 0x60 3 // enchantment
BUT_ONLY
// basilisk petrification should force, you know, a save against petrification
COPY_EXISTING ~basigaze.itm~ ~override~
~basilg1.itm~ ~override~
~basill1.itm~ ~override~
LPF ALTER_EFFECT INT_VAR savingthrow = BIT4 END // save vs. spell > petrification
// tbd, cam
// set to 400% speed, not set a fixed value of 30
COPY_EXISTING ~boot10.itm~ ~override~ // Boots of Lightning Speed
LPF ALTER_EFFECT INT_VAR match_opcode = 126 parameter1 = 400 parameter2 = 2 END
// tbd, cam
// lmd via foebane lacks normal immunity for golems & undead
COPY_EXISTING ~comps63.itm~ ~override~ // foebane +5, 1pp cosmetic version
~sw1h63.itm~ ~override~ // foebane +5
LPF CLONE_EFFECT INT_VAR check_globals = 0 match_opcode = 146 opcode = 324 parameter1 = 0 parameter2 = 55 timing = 0 resist_dispel = 0 STR_VAR match_resource = spin104a resource = EVAL ~%SOURCE_RES%~ END
// elven charm immunity can block level drain and other effects
OUTER_SET charm_immunity = IDS_OF_SYMBOL (~splstate~ ~CHARM_IMMUNITY~)
COPY_EXISTING ~gorwom1.itm~ ~override~ // Nalmissra's attack
LPF DELETE_EFFECT INT_VAR match_opcode = 324 END // delete existing 324s
LPF ALTER_EFFECT INT_VAR match_opcode = 142 match_parameter2 = 1 probability1 = 50 END // charm is 50%, but icon is 100%
PATCH_FOR_EACH op IN 5 215 142 BEGIN
LPF CLONE_EFFECT INT_VAR match_opcode = op match_probability1 = 50 STR_VAR insert = last END
LPF DELETE_EFFECT INT_VAR match_opcode = op match_probability1 = 50 multi_match = 1 END
END
// LPF CLONE_EFFECT INT_VAR match_opcode = 5 opcode = 324 timing = 0 duration = 0 resist_dispel = 0 savingthrow = 0 savebonus = 0 parameter1 = charm_immunity parameter2 = 110 END // charm immunity
LPF CLONE_EFFECT INT_VAR match_opcode = 5 opcode = 324 timing = 0 duration = 0 resist_dispel = 0 savingthrow = 0 savebonus = 0 parameter1 = 0 parameter2 = 19 probability1 = 15 END // half-elf immunity
LPF CLONE_EFFECT INT_VAR match_opcode = 5 opcode = 324 timing = 0 duration = 0 resist_dispel = 0 savingthrow = 0 savebonus = 0 parameter1 = 0 parameter2 = 15 probability1 = 45 END // elf immunity
// tbd, cam
// blackmist plays two sounds when it blinds targets; one of them is the expirty sound and should be delayed
COPY_EXISTING ~halb06.itm~ ~override~ // Blackmist +4 - causes blind
LPF ALTER_EFFECT INT_VAR match_opcode = 174 timing = 4 duration = 600 STR_VAR match_resource = eff_e07 END
// tbd, cam
// helmet appearance corrections
COPY_EXISTING ~helm32.itm~ ~override~ // Helm of the Rock
WRITE_ASCII 0x22 ~j2~ #2 // paperdoll appearance
LPF ALTER_EFFECT INT_VAR match_opcode = 7 match_parameter2 = 48 parameter1 = 207 END // change 'helmet wings' to 'minor noble 2 chrome gold'
LPF ALTER_EFFECT INT_VAR match_opcode = 7 match_parameter2 = 52 parameter1 = 199 END // change 'helmet face' to 'black teal'
LPF ALTER_EFFECT INT_VAR match_opcode = 7 match_parameter2 = 53 parameter1 = 199 END // change 'helmet exterior' to 'black teal'
LPF CLONE_EFFECT INT_VAR match_opcode = 7 match_parameter2 = 48 parameter1 = 0 parameter2 = 49 END // clone 'helmet wings' to 'helmet detail', color 'rust tinted black'
LPF CLONE_EFFECT INT_VAR match_opcode = 7 match_parameter2 = 48 parameter1 = 0 parameter2 = 50 END // clone 'helmet wings' to 'helmet plume', color 'rust tinted black'
COPY_EXISTING ~helm33.itm~ ~override~ // Gold Horned Helm
WRITE_ASCII 0x22 ~j3~ #2 // paperdoll appearance
LPF ALTER_EFFECT INT_VAR match_opcode = 7 match_parameter2 = 48 parameter1 = 223 END // change 'helmet wings' to 'drow skin moss green'
LPF ALTER_EFFECT INT_VAR match_opcode = 7 match_parameter2 = 53 parameter1 = 208 END // change 'helmet exterior' to 'faded wheat'
LPF CLONE_EFFECT INT_VAR match_opcode = 7 match_parameter2 = 53 parameter2 = 52 END // clone 'helmet exterior' to 'helmet face'
// tbd, cam
// combat feedback used with instant/limited timing and durations
COPY_EXISTING ~helm32.itm~ ~override~ // Helm of the Rock - causes fear - portrait icon 36 - unknown long effect
~spin595.spl~ ~override~ // Yellow Dragon Scorching Sand - causes blind - unknown long effect
~spin878.spl~ ~override~ // Level Drain - causes blind - causes level drain - unknown long effect
~spin893.spl~ ~override~ // Shadow Dragon Breath - causes blind - causes level drain - unknown long effect
~spin929.spl~ ~override~ // Mist Ball - causes blind - unknown long effect
~spin931.spl~ ~override~ // Sooty Ball - causes blind - unknown long effect
~spwi714.spl~ ~override~ // Prismatic Spray - causes blind - causes feeblemind - unknown long effect
~spwi815.spl~ ~override~ // Power Word, Blind - causes blind - unknown long effect - plays sound EFF_E06
~spwi958.spl~ ~override~ // Power Word, Blind - causes blind - unknown long effect - plays sound EFF_E06
LPF ALTER_EFFECT INT_VAR match_opcode = 139 timing = 1 duration = 0 END
// tbd, cam
// blocks confusion animation, but is subject to confusion
COPY_EXISTING //~dragring.itm~ ~override~ // ring - immune to stun - immune to hold - blocks spmindat - blocks spconfus - probably intentional since animation isn't right for dragons
~hslaywpn.itm~ ~override~ // <invalid strref -1> - immune to stun - blocks spconfus - blocks spmindat
~ohbbslay.itm~ ~override~ // <invalid strref -1> - immune to stun - blocks spconfus - blocks spmindat
~slayerw1.itm~ ~override~ // <invalid strref -1> - immune to stun - blocks spconfus - blocks spmindat
~slayerwp.itm~ ~override~ // <invalid strref -1> - immune to stun - blocks spconfus - blocks spmindat
LPF DELETE_EFFECT INT_VAR match_opcode = 296 STR_VAR match_resource = spconfus END
BUT_ONLY
// tie slow icon to slos-via-disease effect so it gets cleared by disease cures
COPY_EXISTING ~iotyugh.itm~ ~override~ // (itm) Attack - causes disease - portrait icon 41
~ohrslng1.itm~ ~override~ // (itm) Lupine Sling +2 - causes disease - portrait icon 41 [uses slow icon with its disease]
~otyugh.itm~ ~override~ // (itm) Attack - causes disease - portrait icon 41
LPF DELETE_EFFECT INT_VAR match_opcode = 142 match_parameter2 = 41 END // delete slow effect
LPF ALTER_EFFECT INT_VAR match_opcode = 78 match_parameter2 = 10 special = 41 END // change slow-via-disease to use slow icon instead of disease (other disease effect already uses disease icon)
// sirine1 uses 'feeblemind' icon for an intelligence drain; instead use generic 'ability score drained' for both
COPY_EXISTING ~magiconf.itm~ ~override~ // Ghoul hand - causes confusion - unknown long effect - portrait icon 3
~sirine1.itm~ ~override~ // Ghoul hand - causes confusion - unknown long effect - portrait icon 3 - portrait icon 48
LPF DELETE_EFFECT INT_VAR match_opcode = 142 match_parameter2 = 48 END
LPF CLONE_EFFECT INT_VAR match_opcode = 19 opcode = 142 parameter1 = 0 parameter2 = 91 END
// tbd, cam
// uses 'intoxication' icon for a confusion effect
COPY_EXISTING ~misc3m.itm~ ~override~ // Harp of Discord - causes confusion - plays animation SPCONFUS - portrait icon 5 - plays sound EFF_P05
LPF ALTER_EFFECT INT_VAR match_opcode = 142 match_parameter2 = 5 parameter2 = 3 END
// immune to hold, but missing spmindat immunity
COPY_EXISTING ~ohbetrai.itm~ ~override~ // <invalid strref -1> - immune to stun - immune to hold
LPF CLONE_EFFECT INT_VAR multi_match = 1 match_opcode = 101 match_parameter2 = 175 opcode = 296 parameter2 = 0 STR_VAR resource = spmindat END
BUT_ONLY
// tbd, cam
// elixir of health should cure intoxication, not set it to zero
COPY_EXISTING ~potn17.itm~ ~override~ // Elixir of Health - set drunkenness to 0, just change to 'cure drunk' instead
LPF ALTER_EFFECT INT_VAR match_opcode = 94 opcode = 164 parameter2 = 0 END // flesh out effects below
// poison resistance blocking con penalty, choking noises
COPY_EXISTING ~potn48.itm~ ~override~ // Vial of Mysterious Liquid - causes poison
LPF CLONE_EFFECT INT_VAR match_opcode = 324 STR_VAR insert = last END
LPF CLONE_EFFECT INT_VAR match_opcode = 25 STR_VAR insert = last END
LPF DELETE_EFFECT INT_VAR multi_match = 2 match_opcode = 324 END
LPF DELETE_EFFECT INT_VAR multi_match = 1 match_opcode = 25 END
// tbd, cam
// protection from magic scrolls not dispelling all buffs
COPY_EXISTING ~scrl07.itm~ ~override~ // protection from magic
FOR (index = 0 ; index < 11 ; ++index) BEGIN
LPF ADD_ITEM_EFFECT INT_VAR insert_point = 0 opcode = 220 parameter1 = 99 parameter2 = index target = 2 timing = 1 END // remove school protections: index
END
FOR (index = 0 ; index < 14 ; ++index) BEGIN // only 10 spell schools, but 13 secondary types
LPF ADD_ITEM_EFFECT INT_VAR insert_point = 0 opcode = 221 parameter1 = 99 parameter2 = index target = 2 timing = 1 END // remove school protections: index
END
BUT_ONLY
// the feeblemind effect already sets INT=3, so purging redundant effects
COPY_EXISTING ~sirine.itm~ ~override~ // Ghoul hand - causes feeblemind - unknown long effect - plays sound EFF_E05 - portrait icon 48
LPF DELETE_EFFECT INT_VAR match_opcode = 19 END
// tbd, cam
// elemental staves' sound effect should only target the specified creature
OUTER_SET elemental_destroyed = RESOLVE_STR_REF (@100)
COPY_EXISTING ~staf15.itm~ ~override~ // staff of air +2
~staf16.itm~ ~override~ // staff of earth +2
~staf17.itm~ ~override~ // staff of fire +2
LPF CLONE_EFFECT INT_VAR match_opcode = 55 opcode = 318 power = 0 parameter2 = 115 timing = 0 savingthrow = 0 STR_VAR insert = first resource = EVAL ~%SOURCE_RES%~ END
LPF CLONE_EFFECT INT_VAR match_opcode = 55 opcode = 139 parameter1 = elemental_destroyed parameter2 = 0 END // add 'elemental destroyed' message
LPF ALTER_EFFECT INT_VAR match_opcode = 55 parameter1 = 0 parameter2 = 2 END // now gated by a 318, make 55 universal
BUT_ONLY
// tbd, cam
// per descript knockback shouldn't work on 'large creatures'
COPY_EXISTING ~staf22.itm~ ~override~ // staff of the ram +6
LPF CLONE_EFFECT INT_VAR check_globals = 0 match_opcode = 235 opcode = 318 parameter1 = 0 parameter2 = 13 timing = 0 duration = 0 resist_dispel = 0 STR_VAR resource = EVAL ~%SOURCE_RES%~ END
// tbd, cam
// ilbratha's mirror image can be blocked by wielder's MR
COPY_EXISTING ~sw1h26.itm~ ~override~ // ilbratha
LPF ALTER_EFFECT INT_VAR check_globals = 0 header_type = 3 resist_dispel = 3 END
BUT_ONLY
// tbd, cam
// sword of flame and angurvadal apply glows to wrong part of avatar
COPY_EXISTING ~sw1h53.itm~ ~override~ // Sword of Flame +1
~sw1h60.itm~ ~override~ // Angurvadal +4
~sw1h61.itm~ ~override~ // Angurvadal +5
LPF ALTER_EFFECT INT_VAR check_headers = 0 match_opcode = 9 match_parameter2 = (5 + (20 << 16)) parameter2 = (20 + (20 << 16)) END
BUT_ONLY
// luke
// Mis-indexed effects
WITH_SCOPE BEGIN
COPY_EXISTING ~hamm06.itm~ ~override~ // Dwarven Thrower +3
~staf01.itm~ ~override~ // Quarterstaff
LAUNCH_PATCH_FUNCTION ~FJ_SPL_ITM_REINDEX~ END
BUT_ONLY_IF_IT_CHANGES
END
// luke
// **Longtooth: The Grave Binder**
// - Unusually large dagger, depicted as a Short Sword => make sure `range=1`
WITH_SCOPE BEGIN
COPY_EXISTING "dagg04.itm" "override"
LAUNCH_PATCH_FUNCTION ~ALTER_ITEM_HEADER~ INT_VAR ~range~ = 1 END
BUT_ONLY_IF_IT_CHANGES
END
// luke
// **Paralytic Bolt**
// - Rename as "Paralytic Bolt +1" (the item's name should state its enchantment level)
// - `resist_dispel` should be `0` (effects should not be dispellable and should ignore MR)
WITH_SCOPE BEGIN
COPY_EXISTING "sahbolt.itm" "override"
/* Feature blocks */
LAUNCH_PATCH_FUNCTION ~ALTER_EFFECT~ INT_VAR ~check_globals~ = 0 ~resist_dispel~ = 0 END
BUT_ONLY_IF_IT_CHANGES
END
// luke
// – Neera's Staff +1 => When the staff strikes a target, there is a 10% chance that either the target or the wielder will take 1 point of fire damage
//// – In particular, on 10% of all hits there's an extra point of fire damage, so Neera gets hit 5% of the time and her target 5%
//// – This isn't implemented properly since the two op12 effects share the same probability range... Also, while we're at it, make sure it's 10% chance and not 11% chance...
WITH_SCOPE BEGIN
COPY_EXISTING ~stafn1.itm~ ~override~ // Neera's Staff +1
LAUNCH_PATCH_FUNCTION ~ALTER_EFFECT~ INT_VAR ~check_globals~ = 0 ~multi_match~ = 1 ~match_opcode~ = 12 ~probability1~ = 4 END // 5% chance (target)
LAUNCH_PATCH_FUNCTION ~ALTER_EFFECT~ INT_VAR ~check_globals~ = 0 ~match_opcode~ = 12 ~match_probability1~ = 10 ~probability2~ = 5 ~probability1~ = 9 END // 10% chance (wielder)
BUT_ONLY_IF_IT_CHANGES
END
// luke
// Chill Touch – better feedback for the player when attacking Golems or Undead
WITH_SCOPE BEGIN
COPY_EXISTING "chillt.itm" "override"
LAUNCH_PATCH_FUNCTION ~DELETE_EFFECT~ INT_VAR ~match_opcode~ = 177 END
LAUNCH_PATCH_FUNCTION ~ADD_ITEM_EFFECT~ INT_VAR ~insert_point~ = 0 ~type~ = 1 ~target~ = 2 ~opcode~ = 324 ~parameter2~ = 55 STR_VAR ~resource~ = ~%DEST_RES%~ END // Immunity to resource and message
BUT_ONLY_IF_IT_CHANGES
END
/*
luke
**Shocking Grasp**
- Should not interact with level-based spell protections
- Delete expiry sound since the spell can end prematurely
- It now casts a `SPL` file that scales with level (up to `20`)
- (instead of using `20` different `ITM` files)
*/
WITH_SCOPE BEGIN
INCLUDE "eefixpack/files/tph/luke/shocking_grasp.tph"
LAUNCH_ACTION_FUNCTION "WIZARD_SHOCKING_GRASP" END
END
// luke
// Ghoul Touch – should not interact with spell protections
WITH_SCOPE BEGIN
COPY_EXISTING "ghoult.itm" "override"
LAUNCH_PATCH_FUNCTION ~ALTER_EFFECT~ INT_VAR ~power~ = 0 END
BUT_ONLY_IF_IT_CHANGES
END
// luke
// Melf's Minute Meteors – should not interact with spell protections
WITH_SCOPE BEGIN
COPY_EXISTING "melfmet.itm" "override"
LAUNCH_PATCH_FUNCTION ~ALTER_EFFECT~ INT_VAR ~power~ = 0 END
BUT_ONLY_IF_IT_CHANGES
END
/*
luke
**Black Blade of Disaster**
- Should not interact with level-based spell protections
- Make sure *"The caster is considered to be proficient to the point of Grand Mastery in this weapon"* always works
- `op233` needs to be on the normal effects list to be evaluated after chargen proficiency effects and override them!
- Provide a workaround for the following bugs:
- if you Dual-class when the Black Blade is equipped, the character permanently gains grand mastery in long swords
- if, for example, you have a warrior with an item that grants dagger proficiency while equipped, they can then take dagger specialization at a level-up, remove the item, and keep the specialization permanently
*/
WITH_SCOPE BEGIN
WITH_TRA
"eefixpack/languages/en_us/luke/shared.tra"
"eefixpack/languages/%LANGUAGE%/luke/shared.tra"
BEGIN
INCLUDE "eefixpack/files/tph/luke/black_blade_of_disaster.tph"
LAUNCH_ACTION_FUNCTION "WIZARD_BLACK_BLADE_OF_DISASTER" END
END
END
// luke
// Energy Blade – should not interact with spell protections
WITH_SCOPE BEGIN
COPY_EXISTING "eneblade.itm" "override"
LAUNCH_PATCH_FUNCTION ~ALTER_EFFECT~ INT_VAR ~power~ = 0 END
BUT_ONLY_IF_IT_CHANGES
END
// luke
// **Flame Blade**
// - should not interact with level-based spell protections
WITH_SCOPE BEGIN
COPY_EXISTING "fblade.itm" "override"
LAUNCH_PATCH_FUNCTION ~ALTER_EFFECT~ INT_VAR ~power~ = 0 END
BUT_ONLY_IF_IT_CHANGES
END
// luke
// **Fire Seed**
// - should not interact with level-based spell protections
WITH_SCOPE BEGIN
COPY_EXISTING "fireseed.itm" "override"
LAUNCH_PATCH_FUNCTION ~ALTER_EFFECT~ INT_VAR ~power~ = 0 END
BUT_ONLY_IF_IT_CHANGES
END
// luke
// **Searing Orb**
// - should not interact with level-based spell protections
// - recode from scratch so as to use `op326` effects instead of messy `op177` effects
WITH_SCOPE BEGIN
INCLUDE "eefixpack/files/tph/luke/searing_orb.tph"
LAUNCH_ACTION_FUNCTION ~CLERIC_SOL_SEARING_ORB~ END
END
/*
luke
**Magical Weapon Slot**
(Based on the previous tweak to the Black Blade of Disaster)
- Make sure natural creature weapons / touch attacks do not benefit from Fighting Styles
*/
WITH_SCOPE BEGIN
WITH_TRA
"eefixpack/languages/en_us/luke/shared.tra"
"eefixpack/languages/%LANGUAGE%/luke/shared.tra"
BEGIN
INCLUDE "eefixpack/files/tph/luke/magical_weapon_slot.tph"
LAUNCH_ACTION_FUNCTION "MAGICAL_WEAPON_SLOT" END
END
END
// tbd, cam
// fixing paperdoll animations
ACTION_DEFINE_ASSOCIATIVE_ARRAY cd_paperdoll_animations BEGIN
misc9q => sc // Habib's Mighty Scimitar uses a katana paperdoll animation instead of scimitar
rodsword => fs // The Flaming Long Sword +1 from the Rod of Lordly Might (rodsword) should use the flaming sword animation
sw1h66 => ss // Yamato +4 uses a scimitar animation instead of short sword (like other wakizashi)
sw1h67 => s1 // Usuno's Blade uses a scimitar animation instead of long sword (like other ninja-to)
sw1h68a => s2 // The undroppable copy of the Spectral brand has no animation
END
ACTION_PHP_EACH cd_paperdoll_animations AS item => anim BEGIN
COPY_EXISTING ~%item%.itm~ ~override~
WRITE_ASCIIE 0x22 "%anim%" #2
END
///// \\\\\
///// spell fixes \\\\\
///// \\\\\
// tbd, cam (from jmerry)
// simulacrum/projected images should have thief skills, but no shadow twin
INCLUDE ~eefixpack/files/tph/tbd_simulacrum.tph~
// tbd, cam (from jmerry)
// prevent infinite feedback (and resultant crash) from interacting fireshield-ish effects by giving them a brief immunity to re-application
INCLUDE ~eefixpack/files/tph/tbd_fireshields.tph~
// luke
// **Cure Wounds**
WITH_SCOPE BEGIN
INCLUDE "eefixpack/files/tph/luke/cure_wounds.tph"
LAUNCH_ACTION_FUNCTION ~CURE_WOUNDS~ END
END
// luke
// **Cause Wounds**
WITH_SCOPE BEGIN
INCLUDE "eefixpack/files/tph/luke/cause_wounds.tph"
LAUNCH_ACTION_FUNCTION ~CAUSE_WOUNDS~ END
END
// luke
// **Lesser / Greater Restoration**
WITH_SCOPE BEGIN
INCLUDE "eefixpack/files/tph/luke/restoration.tph"
LAUNCH_ACTION_FUNCTION ~RESTORATION~ END
END
// ie-5931, cam
// Stoneskin from Demogorgon & Melissan cannot be breached
COPY_EXISTING ~melstone.spl~ ~override~
WRITE_BYTE 0x27 7 // change secondary to Combat Protections
BUT_ONLY
// tbd, cam
// Hexxat's ability is supposed to summon 1d4 creatures, does something wacky intstead
COPY_EXISTING ~ohhsumm.spl~ ~override~ // children of the night
LPF DELETE_EFFECT INT_VAR multi_match = 1 STR_VAR match_resource = ohhrat END // change 1d4+1 rats to 1d4
LPF ALTER_EFFECT INT_VAR probability1 = 100 STR_VAR match_resource = ohhrat END // uncorrect rat probs so I can run the next three unimpeded
LPF ALTER_EFFECT INT_VAR multi_match = 1 probability1 = 24 END // change summon #1 to 25%
LPF ALTER_EFFECT INT_VAR multi_match = 1 match_probability1 = 100 probability1 = 49 END // change summon #2 to 50%
LPF ALTER_EFFECT INT_VAR multi_match = 1 match_probability1 = 100 probability1 = 74 END // change summon #3 to 75%
BUT_ONLY
// tbd, cam
// enrage is using berserk's spell icon
COPY_EXISTING ~spcl321.spl~ ~override~
WRITE_ASCII 0x3a ~enrageb~ #8
LPF ALTER_SPELL_HEADER STR_VAR icon = ~enrageb~ END
BUT_ONLY
// tbd, cam
// shadow twin duration should be two turns, not one
COPY_EXISTING ~spcl936.spl~ ~override~ // shadow twin
LPF ALTER_EFFECT INT_VAR match_duration = 60 duration = 120 END
BUT_ONLY
// tbd, cam
// damage on minsc's berserk expiry should precede the bonus HP expiring, like it does in bgee
COPY_EXISTING ~spin117.spl~ ~override~ // minsc's berserk
LPF ALTER_EFFECT INT_VAR match_duration = 119 duration = 120 END
LPF ALTER_EFFECT INT_VAR match_opcode = 12 duration = 119 END
BUT_ONLY
// tbd, cam
// update psychic drain to use generic mind flayer spell animation, spflayer
COPY_EXISTING ~spin804.spl~ ~override~ // psychic drain - plays spmindat
LPF ALTER_EFFECT INT_VAR match_opcode = 215 STR_VAR match_resource = spmindat resource = spflayer END
BUT_ONLY
// tbd, cam
// wrong duration for portrait icon
COPY_EXISTING ~spin807.spl~ ~override~ // Slayer Fear - causes fear - portrait icon 36
LPF ALTER_EFFECT INT_VAR match_duration = 120 duration = 12 END
// tbd, cam
// delayed sound effect doesn't bypass mr though the rest of the spell does
COPY_EXISTING ~spin910.spl~ ~override~ // psionic domination
LPF ALTER_EFFECT INT_VAR match_opcode = 174 resist_dispel = 2 END
BUT_ONLY
// tbd, cam
// shield spell shouldn't stack
COPY_EXISTING ~spwi114.spl~ ~override~
LPF CLONE_EFFECT INT_VAR match_opcode = 142 opcode = 321 power = 0 parameter2 = 0 timing = 1 duration = 0 STR_VAR insert = first resource = EVAL ~%SOURCE_RES%~ END
BUT_ONLY
// tbd, cam
// know alignment's save should match description
COPY_EXISTING ~spwi208.spl~ ~override~ // know alignment, arcane - lacks saving throw
~sppr209.spl~ ~override~ // know alignment, divine - has -2 penalty
LPF ALTER_EFFECT INT_VAR savingthrow = BIT0 savebonus = 0 END
BUT_ONLY
// tbd, cam (from jmerry)
// self-stack protection only targets self, not party, like the rest of the effects
COPY_EXISTING ~spwish12.spl~ ~override~
LPF ALTER_EFFECT INT_VAR match_opcode = 321 target = 3 END
BUT_ONLY // Now removes hardiness effects from the same targets it adds them to
// tbd, cam
// expiry sound is way too early
COPY_EXISTING ~spwish33.spl~ ~override~ // Intoxication - causes drunkenness - plays sound EFF_E06 - portrait icon 5
LPF ALTER_EFFECT INT_VAR match_opcode = 174 match_duration = 60 duration = 1200 END
// luke
// Mis-indexed effects
WITH_SCOPE BEGIN
COPY_EXISTING ~ohbwi302.spl~ ~override~ // Remove Magic
~ohbwi304.spl~ ~override~ // Fireball
LAUNCH_PATCH_FUNCTION ~FJ_SPL_ITM_REINDEX~ END
BUT_ONLY_IF_IT_CHANGES
END
// luke
// Mimic Glue should not set the GREASE stat
WITH_SCOPE BEGIN
COPY_EXISTING ~%MIMIC_GLUE%.spl~ ~override~ // Mimic Glue
LAUNCH_PATCH_FUNCTION "ALTER_EFFECT" INT_VAR "match_opcode" = 158 "opcode" = 215 "parameter2" = 1 STR_VAR "resource" = "GREASED" END // Grease overlay => Play visual effect, Mode: Over target (attached)
BUT_ONLY_IF_IT_CHANGES
END
// luke
// Lesser Fire Spirit – Suppress misleading "One of the spell has failed" message
// 1) Set subspell's range to a very high value (max signed value)
// 2) Set subspell's projectile to either "RANGE05", "RANGE07" or "RANGE10". The second one is the most appropriate IMHO (given ELEMENTAL_FIRE_SMALL selection circle)...
WITH_SCOPE BEGIN
COPY_EXISTING "bdsha12a.spl" "override"
LAUNCH_PATCH_FUNCTION ~ALTER_SPELL_HEADER~ INT_VAR "range" = 0x7FFF "projectile" = IDS_OF_SYMBOL ("MISSILE" "OneTarget_Range_07") END
BUT_ONLY_IF_IT_CHANGES
END
// luke
// Grease – Remove duplicate op321 effect
WITH_SCOPE BEGIN
COPY_EXISTING ~%WIZARD_GREASE%.spl~ ~override~ // Grease
PATCH_WITH_SCOPE BEGIN
GET_OFFSET_ARRAY "ab_array" SPL_V10_HEADERS
PHP_EACH "ab_array" AS "hdr" => "ab_off" BEGIN
LPF "COUNT_V10_HEAD_EFFECTS" STR_VAR "opcode" = "321" "resource" = "%DEST_RES%" RET "count" END
LPF ~DELETE_EFFECT~ INT_VAR ~match_opcode~ = 321 ~check_headers~ = (~%count%~ <= 1 ? 0 : 1) ~multi_match~ = (~%count%~ - 1) ~header~ = ~%hdr%~ STR_VAR ~match_resource~ = ~%DEST_RES%~ END
END
END
BUT_ONLY_IF_IT_CHANGES
END
// luke
// Magic Missile – better feedback for the player when you cast it at someone protected by WIZARD_SHIELD
WITH_SCOPE BEGIN
COPY_EXISTING ~%WIZARD_MAGIC_MISSILE%.spl~ ~override~
~%TRAP_MAGIC_MISSILE%.spl~ ~override~
~%MAGIC_MISSILE_SURE_HIT%.spl~ ~override~
~%BEHOLDER_MAGIC_MISSILE%.spl~ ~override~
~balth06.spl~ ~override~
LAUNCH_PATCH_FUNCTION ~ADD_SPELL_EFFECT~ INT_VAR "insert_point" = 0 "opcode" = 324 "target" = 2 "parameter1" = IDS_OF_SYMBOL ("SPLSTATE" "WIZARD_SHIELD") "parameter2" = 110 "resist_dispel" = 2 "power" = 1 STR_VAR "resource" = "%DEST_RES%" END
BUT_ONLY_IF_IT_CHANGES
END
// luke
// Larloch's Minor Drain
// 1) subspell's effects should have `power=0`
// 2) subspell should not play `casting graphics` and `casting sound`
// 3) subspell should not use the `exclusion flags` field
WITH_SCOPE BEGIN
COPY_EXISTING ~%WIZARD_LARLOCH_MINOR_DRAIN%a.spl~ ~override~
~%INNATE_LARLOCHS_MINOR_DRAIN%a.spl~ ~override~
// Header
WRITE_ASCII 0x10 "" #8
WRITE_LONG 0x1E 0
WRITE_SHORT 0x22 0
// Feature blocks
LAUNCH_PATCH_FUNCTION "ALTER_EFFECT" INT_VAR "power" = 0 END
BUT_ONLY_IF_IT_CHANGES
END
// luke
// Chill Touch – should not interact with spell protections
WITH_SCOPE BEGIN
COPY_EXISTING "%WIZARD_CHILL_TOUCH%a.spl" "override"
LAUNCH_PATCH_FUNCTION ~ALTER_EFFECT~ INT_VAR ~power~ = 0 END
BUT_ONLY_IF_IT_CHANGES
END
// luke
// Detect Evil – should not interact with spell protections
// 1) there's no need for the subspell
//// 1a) its effects have incorrect power levels
//// 1b) more importantly, as of v2.6, you should no longer be able to bypass other's Magic Resistance by targeting yourself with an area-effect ability => see `https://gibberlings3.github.io/iesdp/file_formats/ie_formats/eff_v2.htm#effv2_Body_0x5C` (BIT3) for further details...
// 2) creatures flagged as STATE_NONDETECTION (see f.i. "Cloak of Non-Detection: Whispers of Silence") should not be immune to it
//// I mean, STATE_NONDETECTION protects against op47 and op116; this spell uses op115, so... Am I missing something?
WITH_SCOPE BEGIN
COPY_EXISTING "%WIZARD_DETECT_EVIL%.spl" "override"
"%CLERIC_DETECT_EVIL%.spl" "override"
"%PALADIN_DETECT_EVIL%.spl" "override"
"spin120.spl" "override"
LAUNCH_PATCH_FUNCTION ~ALTER_EFFECT~ INT_VAR ~match_opcode~ = 146 ~opcode~ = 115 ~parameter1~ = 0 ~parameter2~ = 0 ~timing~ = 1 ~duration~ = 0 STR_VAR ~resource~ = ~~ END // Cast spell => Detect alignment
LAUNCH_PATCH_FUNCTION ~DELETE_EFFECT~ INT_VAR ~match_opcode~ = 318 END
BUT_ONLY_IF_IT_CHANGES
END
// luke
// Stinking Cloud
// 1) op39 can automatically display a portrait icon, there's no need to apply a separate op142 effect
// 2) remove the "Bypass Mirror Image" flag (it's only relevant for opcode #12 and opcode #25)
// 3) provide better feedback for the player when attacking Golems or Undead
WITH_SCOPE BEGIN
COPY_EXISTING "%WIZARD_STINKING_CLOUD%.spl" "override"
PATCH_WITH_SCOPE BEGIN
GET_OFFSET_ARRAY "ab_array" SPL_V10_HEADERS
PHP_EACH "ab_array" AS "_" => "ab_off" BEGIN
GET_OFFSET_ARRAY2 "fx_array" "%ab_off%" SPL_V10_HEAD_EFFECTS
PHP_EACH "fx_array" AS "_" => "fx_off" BEGIN
WRITE_LONG ("%fx_off%" + 0x24) (THIS BAND BNOT BIT24)
END
END
END
LAUNCH_PATCH_FUNCTION ~ADD_SPELL_EFFECT~ INT_VAR "insert_point" = 0 "opcode" = 324 "target" = 2 "parameter2" = 55 "resist_dispel" = 2 "power" = 2 STR_VAR "resource" = "%DEST_RES%" END
LAUNCH_PATCH_FUNCTION ~DELETE_EFFECT~ INT_VAR ~match_opcode~ = 142 END
LAUNCH_PATCH_FUNCTION ~ALTER_EFFECT~ INT_VAR ~match_opcode~ = 39 ~special~ = 126 END
BUT_ONLY_IF_IT_CHANGES
END
// luke
// Stinking Cloud
// 1) op39 can automatically display a portrait icon, there's no need to apply a separate op142 effect
// 2) remove the "Bypass Mirror Image" flag (it's only relevant for opcode #12 and opcode #25)
// 3) provide better feedback for the player when attacking Golems or Undead
WITH_SCOPE BEGIN
COPY_EXISTING "%TRAP_STINKING_CLOUD%.spl" "override"
"%MEPHIT_STINKING_CLOUD%.spl" "override"
"spwm187.spl" "override" // Wild surge
PATCH_WITH_SCOPE BEGIN
GET_OFFSET_ARRAY "ab_array" SPL_V10_HEADERS
PHP_EACH "ab_array" AS "_" => "ab_off" BEGIN
GET_OFFSET_ARRAY2 "fx_array" "%ab_off%" SPL_V10_HEAD_EFFECTS
PHP_EACH "fx_array" AS "_" => "fx_off" BEGIN
WRITE_LONG ("%fx_off%" + 0x24) (THIS BAND BNOT BIT24)
END
END
END
LAUNCH_PATCH_FUNCTION ~ADD_SPELL_EFFECT~ INT_VAR ~insert_point~ = 0 ~target~ = 2 ~opcode~ = 324 ~parameter2~ = 55 STR_VAR ~resource~ = ~%DEST_RES%~ END // Immunity to resource and message
LAUNCH_PATCH_FUNCTION ~DELETE_EFFECT~ INT_VAR ~match_opcode~ = 142 END
LAUNCH_PATCH_FUNCTION ~ALTER_EFFECT~ INT_VAR ~match_opcode~ = 39 ~special~ = 126 END
BUT_ONLY_IF_IT_CHANGES
END
// luke
// Deafness – should not bypass Magic Resistance
WITH_SCOPE BEGIN
COPY_EXISTING "%WIZARD_DEAFNESS%.spl" "override"
LAUNCH_PATCH_FUNCTION ~ALTER_EFFECT~ INT_VAR ~resist_dispel~ = BIT0 END
BUT_ONLY_IF_IT_CHANGES
END
// luke
// Lightning Bolt – remove duplicate op318 effect
WITH_SCOPE BEGIN
COPY_EXISTING "%WIZARD_LIGHTNING_BOLT%.spl" "override"
"%TALOS_LIGHTNING_BOLT%.spl" "override"
"%TRAP_LIGHTNING_BOLT%.spl" "override"
"spdr301.spl" "override" // Avenger
"%CELESTIAL_BOLT%.spl" "override"
"%GORION_LIGHTNING%.spl" "override"
PATCH_WITH_SCOPE BEGIN
GET_OFFSET_ARRAY "ab_array" SPL_V10_HEADERS
PHP_EACH "ab_array" AS "hdr" => "ab_off" BEGIN
LPF "COUNT_V10_HEAD_EFFECTS" STR_VAR "opcode" = "318" "resource" = "%DEST_RES%" RET "count" END
LPF ~DELETE_EFFECT~ INT_VAR ~match_opcode~ = 318 ~check_headers~ = (~%count%~ <= 1 ? 0 : 1) ~multi_match~ = (~%count%~ - 1) ~header~ = ~%hdr%~ STR_VAR ~match_resource~ = ~%DEST_RES%~ END
END
END
BUT_ONLY_IF_IT_CHANGES
END
// luke
// Protection From Normal Missiles – remove duplicate op328 effect
WITH_SCOPE BEGIN
COPY_EXISTING "%WIZARD_PROTECTION_FROM_NORMAL_MISSILES%.spl" "override"
"spra303.spl" "override" // Stalker
PATCH_WITH_SCOPE BEGIN
SET "op328_p2" = IDS_OF_SYMBOL ("SPLSTATE" "PROTECTION_FROM_NORMAL_MISSILES")
GET_OFFSET_ARRAY "ab_array" SPL_V10_HEADERS
PHP_EACH "ab_array" AS "hdr" => "ab_off" BEGIN
LPF "COUNT_V10_HEAD_EFFECTS" STR_VAR "opcode" = "328" "parameter2" = "%op328_p2%" RET "count" END
LPF ~DELETE_EFFECT~ INT_VAR ~match_opcode~ = 328 ~check_headers~ = (~%count%~ <= 1 ? 0 : 1) ~multi_match~ = (~%count%~ - 1) ~header~ = ~%hdr%~ ~match_parameter2~ = IDS_OF_SYMBOL ("SPLSTATE" "PROTECTION_FROM_NORMAL_MISSILES") END
END
END
BUT_ONLY_IF_IT_CHANGES
END
// luke
// Vampiric Touch
// 1) subspell's effects should have `power=0`
// 2) subspell should not play `casting graphics` and `casting sound`
// 3) subspell's type should match its parent (to maintain casting level!)
WITH_SCOPE BEGIN
COPY_EXISTING ~%WIZARD_VAMPIRIC_TOUCH%a.spl~ ~override~
// Header
WRITE_ASCII 0x10 "" #8
WRITE_SHORT 0x1C 1 // wizard
WRITE_SHORT 0x22 0
// Feature blocks
LAUNCH_PATCH_FUNCTION "ALTER_EFFECT" INT_VAR "power" = 0 END
BUT_ONLY_IF_IT_CHANGES
END
// luke
// Vampiric Touch (innate)
// 1) subspell's effects should have `power=0`
// 2) subspell should not play `casting graphics` and `casting sound`
WITH_SCOPE BEGIN
COPY_EXISTING ~%INNATE_VAMPIRIC_TOUCH%a.spl~ ~override~
~%TANARI_VAMPIRIC_TOUCH%a.spl~ ~override~
// Header
WRITE_ASCII 0x10 "" #8
WRITE_SHORT 0x22 0
// Feature blocks
LAUNCH_PATCH_FUNCTION "ALTER_EFFECT" INT_VAR "power" = 0 END
BUT_ONLY_IF_IT_CHANGES
END
// luke
// Wraithform – make sure all limited effects are dispellable
WITH_SCOPE BEGIN
COPY_EXISTING ~%WIZARD_WRAITH_FORM%.spl~ ~override~
LAUNCH_PATCH_FUNCTION "ALTER_EFFECT" INT_VAR "resist_dispel" = (BIT0 + BIT1) END
BUT_ONLY_IF_IT_CHANGES
END
// luke
// Minor Spell Deflection – remove duplicate op328 / op233 effects
WITH_SCOPE BEGIN
COPY_EXISTING "%WIZARD_MINOR_SPELL_DEFLECTION%.spl" "override"
"spra302.spl" "override" // Stalker
PATCH_WITH_SCOPE BEGIN
SET "op328_p2" = IDS_OF_SYMBOL ("SPLSTATE" "BUFF_PRO_SPELLS")
SET "op233_p2" = IDS_OF_SYMBOL ("STATS" "WIZARD_SPELL_DEFLECTION")
GET_OFFSET_ARRAY "ab_array" SPL_V10_HEADERS
PHP_EACH "ab_array" AS "hdr" => "ab_off" BEGIN
LPF "COUNT_V10_HEAD_EFFECTS" STR_VAR "opcode" = "328" "parameter2" = "%op328_p2%" RET "count" END
LPF ~DELETE_EFFECT~ INT_VAR ~match_opcode~ = 328 ~check_headers~ = (~%count%~ <= 1 ? 0 : 1) ~multi_match~ = (~%count%~ - 1) ~header~ = ~%hdr%~ ~match_parameter2~ = IDS_OF_SYMBOL ("SPLSTATE" "BUFF_PRO_SPELLS") END
LPF "COUNT_V10_HEAD_EFFECTS" STR_VAR "opcode" = "233" "parameter2" = "%op233_p2%" RET "count" END
LPF ~DELETE_EFFECT~ INT_VAR ~match_opcode~ = 233 ~check_headers~ = (~%count%~ <= 1 ? 0 : 1) ~multi_match~ = (~%count%~ - 1) ~header~ = ~%hdr%~ ~match_parameter2~ = IDS_OF_SYMBOL ("STATS" "WIZARD_SPELL_DEFLECTION") END
END
END
BUT_ONLY_IF_IT_CHANGES
END
// luke
// Improved Invisibility
// Applying "Improved" Invisibility will cause the effect to be duplicated, with the duplicate using "Normal" invisibility.
//// There's no reason to apply both Normal and Improved invisibility in the same spell/item (unless you want them to have different probabilities/hd limits, but this is not the case).
WITH_SCOPE BEGIN
COPY_EXISTING "%WIZARD_IMPROVED_INVISIBILITY%.spl" "override"
"ohbwi405.spl" "override"
"spdr401.spl" "override" // Avenger
"%PSIONIC_SUPERIOR_INVISIBILITY%.spl" "override"
"%NON_DETECTION_SELF%.spl" "override"
LAUNCH_PATCH_FUNCTION ~DELETE_EFFECT~ INT_VAR ~match_opcode~ = 20 ~match_parameter2~ = 0 END
BUT_ONLY_IF_IT_CHANGES
END
// luke
// Emotion, Hopelessness