Jump to content

BG2 Modder Resource - Effect Batch Macros


Recommended Posts

I have a few questions, if ya don't mind!

 

1) I assume that "cosmetic" is a variable set by the BG2 Fixpack (is this correct)? Assuming so, is this variable set in any (or all) of the EE's? I assume not, but ya never know!

 

2) Do you want us to share our custom created batches (i'll call them)? So far, I've created both a rage/berserk removal and immunity batch for a few custom spells. It's not much--I'll be adding quite a few more--but someone might find them useful.

 

2.1) Also, I notice that these batches seem to be bg2/bg2ee specific, especially string references. For example, it looks like the haste immunity batch protects against string "14023", which is the 'hasted' notification in bg2ee (I assume it is the same in bg2), but does not protect against "26019", which is the 'hasted' notification in BGEE (and maybe BG1). I'll be altering them to check for the game engine and then protect against the relevant strings. Would it be useful if I share these?

 

...I guess that's it

Link to comment

1) I assume that "cosmetic" is a variable set by the BG2 Fixpack (is this correct)? Assuming so, is this variable set in any (or all) of the EE's? I assume not, but ya never know!

 

No, it's set internally by the macro. It's set to 1 for any spell, creatures with bios (e.g. joinable NPCs), and droppable items. Portrait icons showing up for any of these don't matter except in a handful of circumstances, which is why the force_cosmetic variable is there.

 

2) Do you want us to share our custom created batches (i'll call them)? So far, I've created both a rage/berserk removal and immunity batch for a few custom spells. It's not much--I'll be adding quite a few more--but someone might find them useful.

 

Sure, it's the reason I rewrote these

 

2.1) Also, I notice that these batches seem to be bg2/bg2ee specific, especially string references. For example, it looks like the haste immunity batch protects against string "14023", which is the 'hasted' notification in bg2ee (I assume it is the same in bg2), but does not protect against "26019", which is the 'hasted' notification in BGEE (and maybe BG1). I'll be altering them to check for the game engine and then protect against the relevant strings. Would it be useful if I share these?

 

 

Yeah, they're BG2-specific for the strings and the file versions, e.g. they'll work for IWDEE/PsTEE creatures (v1) but not original IWD (v9) or PsT (v1.2) creatures, Share 'em if you got 'em.

Link to comment

Cool.

 

(These are EE only. A few adjustments will need to be made to use with non-ee versions. I believe/assume that the string references are the same...)

 

I created this one just for Exaltation (and, possibly, spells like it) The description says that it protects against the effects it cures, but it doesn't protect against berserk. That doesn't really matter in the standard game--there are possible exceptions--but it potentially matters if you have any spells with these effects. So...

 

(edited to remove unnecessary protections from different games)

 

 

REVISED FOR ALL EE GAMES

 

(Only added altered batches. Mind the "...". Those represent gaps...

// turns slow immunity into full immunity
DEFINE_PATCH_MACRO ~cd_immunity_slow_arrays~ BEGIN
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_key BEGIN
    101,  "-10", 40, "same",  "-10",  "-10", "same" => 1 // immunity to slow
  END
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    206, "-1",  "-10", "spwm164",  "-10", "-10", "same" => 1 // protection from spell, slow
    206, "-1",  "-10", "spin977",  "-10", "-10", "same" => 1 // protection from spell, golem slow
    206, "-1",  "-10", "spin983",  "-10", "-10", "same" => 1 // protection from spell, slow
    206, "-1",  "-10", "spwish25", "-10", "-10", "same" => 1 // protection from spell, slow
    206, "-1",  "-10", "spwi312",  "-10", "-10", "same" => 1 // protection from spell, slow
    206, "-1",  "-10", "spin575",  "-10", "-10", "same" => 1 // protection from spell, vortex web
    267, 14000, "-10",    "",  "-10", "-10", "same" => 1 // protection from string "slow"  (BG2EE)   In IWDEE and BGEE...not sure if it's used  
  END
  PATCH_IF cosmetic = 1 BEGIN
    DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
      169, "-10", 41, "same", "-10", "-10", "same" => 1 // prevent slow icon
    END
  END
  PATCH_IF GAME_IS ~bgee~ BEGIN
    DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
     267, 31772, "-10",     "",  "-10", "-10", "same" => 1 // protection from string slowed (BGEE)
    END
  END
  PATCH_IF GAME_IS ~bg2ee eet iwdee~ BEGIN
    DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN    
     267, 14668, "-10",    "",  "-10", "-10", "same" => 1 // protection from string "slowed" (BG2EE/IWDEE)
    END
  END
  PATCH_IF GAME_IS ~eet~ BEGIN   //just in case...
    DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
     267, 11799, "-10",    "",  "-10", "-10", "same" => 1 // protection from string "slow" (EET)--Used?  Just in case
    END
  END
  PATCH_IF GAME_IS ~iwdee~ BEGIN   //just in case...
    DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
     267, 37787, "-10",    "",  "-10", "-10", "same" => 1 // protection from string "slowed" (IWDEE)  Just in case
     267, 37638, "-10",    "",  "-10", "-10", "same" => 1 // protection from string "slow" (IWDEE)  Just in case
    END
  END
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
  END // nothing to delete...except there is...
  PATCH_IF GAME_IS ~bg2ee eet iwdee~ BEGIN
    DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
     267, 31772, "-10",     "",  "-10", "-10", "same" => 1 // protection from string slowed (BGEE)
    END
  END
  PATCH_IF GAME_IS ~bgee~ BEGIN
    DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
     267, 14668, "-10",    "",  "-10", "-10", "same" => 1 // protection from string "slowed" (BG2EE/IWDEE)
    END
  END
END



// turns confusion immunity into full immunity
DEFINE_PATCH_MACRO ~cd_immunity_confusion_arrays~ BEGIN
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_key BEGIN
    101,  "-10", 128, "same",  "-10",  "-10", "same" => 1 // immunity to confusion
  END
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    296, "-10", "-10", "spconfus",  "-10", "-10", "same" => 1 // confusion visuals
  END
  PATCH_IF cosmetic = 1 BEGIN
    DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
      169, "-10",  2, "same", "-10", "-10", "same" => 1 // prevent rigid thinking icon
      169, "-10",  3, "same", "-10", "-10", "same" => 1 // prevent confused icon
      169, "-10", 47, "same", "-10", "-10", "same" => 1 // prevent chaos icon
    END
  END
  PATCH_IF GAME_IS ~bgee~ BEGIN
    DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
     267, 25807, "-10",     "",  "-10", "-10", "same" => 1 // protection from string "confused" (BGEE)
     267, 26184, "-10",     "",  "-10", "-10", "same" => 1 // protection from string "Rigid Thinking" (BGEE)
    END
  END
  PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
    DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
     267, 14782, "-10",     "",  "-10", "-10", "same" => 1 // protection from string "confused"      (BG2EE)
     267, 14791, "-10",     "",  "-10", "-10", "same" => 1 // protection from string "Rigid Thinking" (BG2EE)
    END
  END
  PATCH_IF GAME_IS ~eet~ BEGIN   //just in case...
    DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
     267, 17394, "-10",     "",  "-10", "-10", "same" => 1 // protection from string "confused"      (EET)
     267, 17393, "-10",     "",  "-10", "-10", "same" => 1 // protection from string "Rigid Thinking" (EET)
    END
  END
  PATCH_IF GAME_IS ~iwdee~ BEGIN
    DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
     267, 37604, "-10",     "",  "-10", "-10", "same" => 1 // protection from string "confused" (IWDEE)
     267, 37603, "-10",     "",  "-10", "-10", "same" => 1 // protection from string "Rigid Thinking" (IWDEE)
    END
  END
DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN 
END // nothing to delete ...except
  PATCH_IF GAME_IS ~bgee~ BEGIN
    DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
     267, 37604, "-10",     "",  "-10", "-10", "same" => 1 // protection from string "confused" (IWDEE)
     267, 37603, "-10",     "",  "-10", "-10", "same" => 1 // protection from string "Rigid Thinking" (IWDEE)
     267, 14782, "-10",     "",  "-10", "-10", "same" => 1 // protection from string "confused"       (BG2EE)
     267, 14791, "-10",     "",  "-10", "-10", "same" => 1 // protection from string "Rigid Thinking" (BG2EE)
    END
  END
  PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
    DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
     267, 37604, "-10",     "",  "-10", "-10", "same" => 1 // protection from string "confused" (IWDEE)
     267, 37603, "-10",     "",  "-10", "-10", "same" => 1 // protection from string "Rigid Thinking" (IWDEE)
     267, 25807, "-10",     "",  "-10", "-10", "same" => 1 // protection from string "confused" (BGEE)
     267, 26184, "-10",     "",  "-10", "-10", "same" => 1 // protection from string "Rigid Thinking" (BGEE)
    END
  END
  PATCH_IF GAME_IS ~iwdee~ BEGIN
    DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
     267, 14782, "-10",     "",  "-10", "-10", "same" => 1 // protection from string "confused" (BG2EE)
     267, 14791, "-10",     "",  "-10", "-10", "same" => 1 // protection from string "Rigid Thinking" (BG2EE)
     267, 25807, "-10",     "",  "-10", "-10", "same" => 1 // protection from string "confused" (BGEE)
     267, 26184, "-10",     "",  "-10", "-10", "same" => 1 // protection from string "Rigid Thinking" (BGEE)
    END
  END
END



// turns level drain immunity into full immunity
DEFINE_PATCH_MACRO ~cd_immunity_level_drain_arrays~ BEGIN
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_key BEGIN
    101,  "-10", 216, "same",  "-10",  "-10", "same" => 1 // immunity to level drain
  END
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
  END
  PATCH_IF cosmetic = 1 BEGIN
    DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
      169, "-10", 59, "same", "-10", "-10", "same" => 1 // prevent level drain icon
      142, "-10", 90, "same", "-10", "-10", "same" => 1 // display npp icon
    END
  END
  PATCH_IF GAME_IS ~bgee~ BEGIN  //
    DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
      267, 25802, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "one level drained"   (BGEE)
      267, 25803, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "two levels drained"   (BGEE)
      267, 25804, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "three levels drained"  (BGEE)
      267, 25805, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "four levels drained"   (BGEE)
      267, 25806, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "five levels drained"   (BGEE)
    END
  END
  PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
    DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
      267, 41495, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "one level drained"   (BG2EE)
      267, 40968, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "two levels drained"  (BG2EE)
      267, 40969, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "three levels drained"  (BG2EE)
      267, 40979, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "four levels drained"   (BG2EE)
      267, 41616, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "five levels drained"  (BG2EE)
    END
  END
  PATCH_IF GAME_IS ~iwdee~ BEGIN  //FIND OTHER STRINGS!
    DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
      267, 35498, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "one level drained"  (IWDEE)
      267, 35497, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "two levels drained"    (IWDEE)
      267, 35496, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "three levels drained"   (IWDEE)
      267, 35472, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "four levels drained"   (IWDEE)
      267, 35495, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "five levels drained"   (IWDEE)
    END
  END
DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN 
END // nothing to delete ...not
  PATCH_IF GAME_IS ~bgee~ BEGIN
    DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
      267, 35498, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "one level drained"  (IWDEE)
      267, 35497, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "two levels drained"    (IWDEE)
      267, 35496, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "three levels drained"   (IWDEE)
      267, 35472, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "four levels drained"   (IWDEE)
      267, 35495, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "five levels drained"   (IWDEE)
      267, 41495, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "one level drained"   (BG2EE)
      267, 40968, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "two levels drained"  (BG2EE)
      267, 40969, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "three levels drained"  (BG2EE)
      267, 40979, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "four levels drained"   (BG2EE)
      267, 41616, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "five levels drained"  (BG2EE)
    END
  END
  PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
    DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
      267, 35498, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "one level drained"  (IWDEE)
      267, 35497, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "two levels drained"    (IWDEE)
      267, 35496, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "three levels drained"   (IWDEE)
      267, 35472, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "four levels drained"   (IWDEE)
      267, 35495, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "five levels drained"   (IWDEE)
      267, 25802, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "one level drained"   (BGEE)
      267, 25803, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "two levels drained"   (BGEE)
      267, 25804, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "three levels drained"  (BGEE)
      267, 25805, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "four levels drained"   (BGEE)
      267, 25806, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "five levels drained"   (BGEE)
    END
  END
  PATCH_IF GAME_IS ~iwdee~ BEGIN
    DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
      267, 41495, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "one level drained"   (BG2EE)
      267, 40968, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "two levels drained"  (BG2EE)
      267, 40969, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "three levels drained"  (BG2EE)
      267, 40979, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "four levels drained"   (BG2EE)
      267, 41616, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "five levels drained"  (BG2EE)
      267, 25802, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "one level drained"   (BGEE)
      267, 25803, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "two levels drained"   (BGEE)
      267, 25804, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "three levels drained"  (BGEE)
      267, 25805, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "four levels drained"   (BGEE)
      267, 25806, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "five levels drained"   (BGEE)
    END
  END
END

...

// turns hold immunity into full immunity
// should run cd_immunity_hold_special_arrays before this
DEFINE_PATCH_MACRO ~cd_immunity_hold_arrays~ BEGIN
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_key BEGIN
    101,  "-10", 109, "",  "-10",  "-10", "same" => 1 // immunity to paralyzation
    101,  "-10", 175, "",  "-10",  "-10", "same" => 1 // immunity to hold
  END
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    296, "-10", "-10",     "spmindat", "-10", "-10", "same" => 1 // protection from animation
    296, "-10", "-10",     "spflayer", "-10", "-10", "same" => 1 // protection from animation
  END
  PATCH_IF cosmetic = 1 BEGIN
    DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
      169, "-10", 13, "", "-10", "-10", "same" => 1 // prevent hold icon
    END
  END
  PATCH_IF GAME_IS ~bgee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    267, 25866, "-10", "", "-10", "-10", "same"  => 1 // protection from string "held" (BGEE)
    267, 31799, "-10", "", "-10", "-10", "same"  => 1 // protection from string "held" (BGEE)
    267, 14650, "-10", "", "-10", "-10", "same"  => 1 // protection from string "Paralyzed" (BGEE)
   END
  END
  PATCH_IF GAME_IS ~bg2ee eet iwdee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    267, 14102, "-10",     "",     "-10", "-10", "same" => 1 // protection from string "held" (BG2EE/IWDEE)
   END
  END
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN 
  END // nothing to delete
  PATCH_IF GAME_IS ~bg2ee eet iwdee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
    267, 31799, "-10", "", "-10", "-10", "same"  => 1 // protection from string "held" (BGEE)
   END
  END
  PATCH_IF GAME_IS ~bgee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
    267, 14102, "-10", "", "-10", "-10", "same" => 1 // protection from string "held" (BG2EE/IWDEE)
   END
  END
END


...

// turns fear immunity into full immunity
DEFINE_PATCH_MACRO ~cd_immunity_fear_arrays~ BEGIN
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_key BEGIN // these three go last so they don't block their own extras effects
//    101,  "-10",  23, "same",  "-10",  "-10", "last" => 1 // immunity to cure horror?
    101,  "-10",  24, "same",  "-10",  "-10", "last" => 1 // immunity to horror
    101,  "-10", 106, "same",  "-10",  "-10", "last" => 1 // immunity to morale break modifier
  END
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
     23, "-10", "-10",     "same",     1,     0, "first" => 1 // reset morale
    161, "-10", "-10",     "same",     1,     0, "same"  => 1 // remove fear
    296, "-10", "-10", "cdhorror", "-10", "-10", "same"  => 1 // protection from animation
    106, "-10",     1,     "same",     1,     0, "first" => 1 // morale break
  END
  PATCH_IF cosmetic = 1 BEGIN
    DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
      169, "-10", 36, "same", "-10", "-10", "same" => 1 // prevent panic icon
      240, "-10", 36, "same", "-10", "-10", "same" => 1 // remove panic icon
      142, "-10", 37, "same", "-10", "-10", "same" => 1 // display resist fear icon
    END
  END
  PATCH_IF GAME_IS ~bgee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    267, 25818, "-10", "", "-10", "-10", "same"  => 1 // protection from string "panic"                 (BGEE)
    267, 20568, "-10", "", "-10", "-10", "same"  => 1 // protection from string "Morale Failure: Panic" (BGEE)
   END
  END
  PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    267, 14007, "-10", "", "-10", "-10", "same"  => 1 // protection from string "panic"   (BG2EE)
    267, 17427, "-10", "", "-10", "-10", "same"  => 1 // protection from string "panic"   (BG2EE)
   END
  END
  PATCH_IF GAME_IS ~iwdee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    267, 20568, "-10", "", "-10", "-10", "same"  => 1 // protection from string "Morale Failure: Panic"   (IWDEE)
    267, 35484, "-10", "", "-10", "-10", "same"  => 1 // protection from string "panic"   (IWDEE)
   END
  END
DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN END // nothing to delete
  PATCH_IF GAME_IS ~iwdee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
    267, 14007, "-10", "", "-10", "-10", "same"  => 1 // protection from string "panic"   (BG2EE)
    267, 17427, "-10", "", "-10", "-10", "same"  => 1 // protection from string "panic"   (BG2EE)
    267, 25818, "-10", "", "-10", "-10", "same"  => 1 // protection from string "panic"                 (BGEE)
    267, 20568, "-10", "", "-10", "-10", "same"  => 1 // protection from string "Morale Failure: Panic" (BGEE)
   END
  END
  PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
    267, 20568, "-10", "", "-10", "-10", "same"  => 1 // protection from string "Morale Failure: Panic"   (IWDEE)
    267, 35484, "-10", "", "-10", "-10", "same"  => 1 // protection from string "panic"   (IWDEE)
    267, 25818, "-10", "", "-10", "-10", "same"  => 1 // protection from string "panic"                 (BGEE)
    267, 20568, "-10", "", "-10", "-10", "same"  => 1 // protection from string "Morale Failure: Panic" (BGEE)
   END
  END
  PATCH_IF GAME_IS ~bgee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
    267, 20568, "-10", "", "-10", "-10", "same"  => 1 // protection from string "Morale Failure: Panic"   (IWDEE)
    267, 35484, "-10", "", "-10", "-10", "same"  => 1 // protection from string "panic"   (IWDEE)
    267, 14007, "-10", "", "-10", "-10", "same"  => 1 // protection from string "panic"   (BG2EE)
    267, 17427, "-10", "", "-10", "-10", "same"  => 1 // protection from string "panic"   (BG2EE)
   END
  END
END



// turns charm immunity into full immunity
DEFINE_PATCH_MACRO ~cd_immunity_charm_arrays~ BEGIN
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_key BEGIN
    101,  "-10",  5, "same",  "-10",  "-10", "same" => 1 // immunity to charm
  END
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    296, "-10", "-10", "spnwchrm", "-10", "-10", "same"  => 1 // protection from animation
  END
  PATCH_IF cosmetic = 1 BEGIN
    DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
      169, "-10",  0, "same", "-10", "-10", "same" => 1 // prevent charm icon
      169, "-10",  1, "same", "-10", "-10", "same" => 1 // prevent dire charm icon
      169, "-10", 43, "same", "-10", "-10", "same" => 1 // prevent domination icon
      142, "-10", 52, "same", "-10", "-10", "same" => 1 // display mind shield icon
    END
  END
  PATCH_IF GAME_IS ~bgee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    267, 26206, "-10",     "same", "-10", "-10", "same"  => 1 // protection from string "dominated" (BGEE)
    267, 31787, "-10",     "same", "-10", "-10", "same"  => 1 // protection from string "charmed"  (BGEE)
    267, 14780, "-10",     "same", "-10", "-10", "same"  => 1 // protection from string "dire charmed" (BG2EE/BGEE)
   END
  END
  PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    267,  8364, "-10",     "same", "-10", "-10", "same"  => 1 // protection from string "dominated"  (BG2EE)
    267, 14672, "-10",     "same", "-10", "-10", "same"  => 1 // protection from string "charmed"     (BG2EE)
    267, 14780, "-10",     "same", "-10", "-10", "same"  => 1 // protection from string "dire charmed"  (BG2EE/BGEE)
   END
  END
  PATCH_IF GAME_IS ~iwdee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    267, 35544, "-10",     "same", "-10", "-10", "same"  => 1 // protection from string "dominated"  (IWDEE)
    267, 37801, "-10",     "same", "-10", "-10", "same"  => 1 // protection from string "charmed"     (IWDEE)
    267, 17392, "-10",     "same", "-10", "-10", "same"  => 1 // protection from string "dire charmed"  (IWDEE)
   END
  END
 DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN 
 END //
  PATCH_IF GAME_IS ~bgee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
    267, 35544, "-10",     "same", "-10", "-10", "same"  => 1 // protection from string "dominated"  (IWDEE)
    267, 37801, "-10",     "same", "-10", "-10", "same"  => 1 // protection from string "charmed"     (IWDEE)
    267,  8364, "-10",     "same", "-10", "-10", "same"  => 1 // protection from string "dominated"  (BG2EE)
    267, 14672, "-10",     "same", "-10", "-10", "same"  => 1 // protection from string "charmed"     (BG2EE)
    267, 17392, "-10",     "same", "-10", "-10", "same"  => 1 // protection from string "dire charmed"  (IWDEE)
   END
  END
  PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
    267, 26206, "-10",     "same", "-10", "-10", "same"  => 1 // protection from string "dominated" (BGEE)
    267, 31787, "-10",     "same", "-10", "-10", "same"  => 1 // protection from string "charmed"  (BGEE)
    267, 35544, "-10",     "same", "-10", "-10", "same"  => 1 // protection from string "dominated"  (IWDEE)
    267, 37801, "-10",     "same", "-10", "-10", "same"  => 1 // protection from string "charmed"     (IWDEE)
    267, 17392, "-10",     "same", "-10", "-10", "same"  => 1 // protection from string "dire charmed"  (IWDEE)
   END
  END
  PATCH_IF GAME_IS ~iwdee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
    267,  8364, "-10",     "same", "-10", "-10", "same"  => 1 // protection from string "dominated"  (BG2EE)
    267, 14672, "-10",     "same", "-10", "-10", "same"  => 1 // protection from string "charmed"     (BG2EE)
    267, 14780, "-10",     "same", "-10", "-10", "same"  => 1 // protection from string "dire charmed"  (BG2EE/BGEE)
    267, 26206, "-10",     "same", "-10", "-10", "same"  => 1 // protection from string "dominated" (BGEE)
    267, 31787, "-10",     "same", "-10", "-10", "same"  => 1 // protection from string "charmed"  (BGEE)
   END
  END
END

        

// turns haste immunity into full immunity
DEFINE_PATCH_MACRO ~cd_immunity_haste_arrays~ BEGIN
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_key BEGIN
    101,  "-10", 16, "same",  "-10",  "-10", "same" => 1 // immunity to haste
  END
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    206,     0,  "-10", "spin572",  "-10", "-10", "same" => 1 // protection from spell, haste
    206,     0,  "-10", "spin828",  "-10", "-10", "same" => 1 // protection from spell, haste
    206,     0,  "-10", "spra301",  "-10", "-10", "same" => 1 // protection from spell, haste
    206,     0,  "-10", "spwi305",  "-10", "-10", "same" => 1 // protection from spell, haste
    // explicit blocking of imp haste (spwi613) not needed as its relevant effects are blocked with other immunities in the batch
  END
  PATCH_IF cosmetic = 1 BEGIN
    DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
      169, "-10", 38, "same", "-10", "-10", "same" => 1 // prevent haste icon
    END
  END
  PATCH_IF GAME_IS ~bgee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    267, 26019, "-10",    "same",  "-10", "-10", "same" => 1 // protection from string "hasted" (BGEE)
   END
  END
  PATCH_IF GAME_IS ~bg2ee eet iwdee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    267, 14023, "-10",    "same",  "-10", "-10", "same" => 1 // protection from string "hasted" (BG2EE/IWDEE)
   END
  END
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN 
  END // nothing to delete
  PATCH_IF GAME_IS ~bgee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
    267, 14023, "-10",    "same",  "-10", "-10", "same" => 1 // protection from string "hasted" (BG2EE/IWDEE)
   END
  END
  PATCH_IF GAME_IS ~bg2ee eet iwdee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
    267, 26019, "-10",    "same",  "-10", "-10", "same" => 1 // protection from string "hasted" (BGEE)
   END
  END
END



// turns disease immunity into full immunity
DEFINE_PATCH_MACRO ~cd_immunity_disease_arrays~ BEGIN
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_key BEGIN
    101,  "-10", 78, "same",  "-10",  "-10", "same" => 1 // immunity to disease
  END
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
  END
  PATCH_IF cosmetic = 1 BEGIN
    DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
      169, "-10", 7, "same", "-10", "-10", "same" => 1 // prevent diseased icon
    END
  END
  PATCH_IF GAME_IS ~bgee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    267, 31238, "-10", "",  "-10", "-10", "same" => 1 // protection from string "Diseased" (BGEE)
    267, 26453, "-10", "",  "-10", "-10", "same" => 1 // protection from string "Stricken by a foul disease" (BGEE)
   END
  END
  PATCH_IF GAME_IS ~bg2ee eet iwdee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    267, 39752, "-10", "same",  "-10", "-10", "same" => 1 // protection from string "stricken by a foul disease"  (BG2EE/IWDEE)
   END
  END
  PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    267, 54337, "-10", "same",  "-10", "-10", "same" => 1 // protection from string "diseased"   (BG2EE/ALso EET)
   END
  END
  PATCH_IF GAME_IS ~iwdee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    267, 35593, "-10", "same",  "-10", "-10", "same" => 1 // protection from string "diseased"  (IWDEE)
   END
  END
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN 
  END // nothing to delete
  PATCH_IF GAME_IS ~bgee~ BEGIN  //that's a lie!!!
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
    267, 35593, "-10", "same",  "-10", "-10", "same" => 1 // protection from string "diseased"  (IWDEE)
    267, 39752, "-10", "same",  "-10", "-10", "same" => 1 // protection from string "stricken by a foul disease"  (BG2EE/IWDEE)
   END
  END
  PATCH_IF GAME_IS ~bg2ee eet iwdee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
    267, 31238, "-10", "",  "-10", "-10", "same" => 1 // protection from string "Diseased" (BGEE)
    267, 26453, "-10", "",  "-10", "-10", "same" => 1 // protection from string "Stricken by a foul disease" (BGEE)
   END
  END
  PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
    267, 35593, "-10", "same",  "-10", "-10", "same" => 1 // protection from string "diseased"  (IWDEE)
   END
  END
END



// turns poison immunity into full immunity
DEFINE_PATCH_MACRO ~cd_immunity_poison_arrays~ BEGIN
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_key BEGIN
    101,  "-10", 25, "same",  "-10",  "-10", "same" => 1 // immunity to poison
  END
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
  END
  PATCH_IF cosmetic = 1 BEGIN
    DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
      169, "-10",   6, "same", "-10", "-10", "same" => 1 // prevent poison icon
      169, "-10", 137, "same", "-10", "-10", "same" => 1 // prevent bleeding icon //Should this be here???
      142, "-10",  30, "same", "-10", "-10", "same" => 1 // display protection from poison icon
    END
  END
  PATCH_IF GAME_IS ~bgee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    267, 25425, "-10", "same",  "-10", "-10", "same" => 1 // protection from string "poisoned" (BGEE)
    267, 26215, "-10", "same",  "-10", "-10", "same" => 1 // protection from string "poison" (BGEE)
   END
  END
  PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    267, 14662, "-10", "same",  "-10", "-10", "same" => 1 // protection from string "poisoned" (BG2EE)
    267, 14017, "-10", "same",  "-10", "-10", "same" => 1 // protection from string "poison"   (BG2EE)
   END
  END
  PATCH_IF GAME_IS ~iwdee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    267, 37607, "-10", "same",  "-10", "-10", "same" => 1 // protection from string "poisoned" (IWDEE)
    267, 36317, "-10", "same",  "-10", "-10", "same" => 1 // protection from string "poison"   (IWDEE)
   END
  END
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN END // nothing to delete
  PATCH_IF GAME_IS ~bgee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
    267, 37607, "-10", "same",  "-10", "-10", "same" => 1 // protection from string "poisoned" (IWDEE)
    267, 36317, "-10", "same",  "-10", "-10", "same" => 1 // protection from string "poison"   (IWDEE)
    267, 14662, "-10", "same",  "-10", "-10", "same" => 1 // protection from string "poisoned" (BG2EE)
    267, 14017, "-10", "same",  "-10", "-10", "same" => 1 // protection from string "poison"   (BG2EE)
   END
  END
  PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
    267, 37607, "-10", "same",  "-10", "-10", "same" => 1 // protection from string "poisoned" (IWDEE)
    267, 36317, "-10", "same",  "-10", "-10", "same" => 1 // protection from string "poison"   (IWDEE)
    267, 25425, "-10", "same",  "-10", "-10", "same" => 1 // protection from string "poisoned" (BGEE)
    267, 26215, "-10", "same",  "-10", "-10", "same" => 1 // protection from string "poison" (BGEE)
   END
  END
  PATCH_IF GAME_IS ~iwdee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
    267, 14662, "-10", "same",  "-10", "-10", "same" => 1 // protection from string "poisoned" (BG2EE)
    267, 14017, "-10", "same",  "-10", "-10", "same" => 1 // protection from string "poison"   (BG2EE)
    267, 25425, "-10", "same",  "-10", "-10", "same" => 1 // protection from string "poisoned" (BGEE)
    267, 26215, "-10", "same",  "-10", "-10", "same" => 1 // protection from string "poison" (BGEE)
   END
  END
END




...



// turns petrification immunity into full immunity
DEFINE_PATCH_MACRO ~cd_immunity_petrification_arrays~ BEGIN
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_key BEGIN
    101, "-10", 134, "same",  "-10",  "-10", "same" => 1 // immunity to petrification
  END
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
  END
  PATCH_IF GAME_IS ~bgee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    267,  25863, "-10", "same", "-10",  "-10", "same" => 1 // disable string "petrified"   (BGEE)
   END
  END
  PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    267,  14665, "-10", "same", "-10",  "-10", "same" => 1 // disable string "petrified"   (BG2EE)
   END
  END
  PATCH_IF GAME_IS ~iwdee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    267,  38043, "-10", "same", "-10",  "-10", "same" => 1 // disable string "petrified"   (IWDEE)
   END
  END
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN 
  END // nothing to delete
  PATCH_IF GAME_IS ~bgee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
    267,  14665, "-10", "same", "-10",  "-10", "same" => 1 // disable string "petrified"   (BG2EE)
    267,  38043, "-10", "same", "-10",  "-10", "same" => 1 // disable string "petrified"   (IWDEE)
   END
  END
  PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
    267,  25863, "-10", "same", "-10",  "-10", "same" => 1 // disable string "petrified"   (BGEE)
    267,  38043, "-10", "same", "-10",  "-10", "same" => 1 // disable string "petrified"   (IWDEE)
   END
  END
  PATCH_IF GAME_IS ~iwdee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
    267,  25863, "-10", "same", "-10",  "-10", "same" => 1 // disable string "petrified"   (BGEE)
    267,  14665, "-10", "same", "-10",  "-10", "same" => 1 // disable string "petrified"   (BG2EE)
   END
  END
END




// turns kill target immunity into full immunity
DEFINE_PATCH_MACRO ~cd_immunity_kill_target_arrays~ BEGIN
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_key BEGIN
    101, "-10", 13, "same",  "-10",  "-10", "same" => 1 // immunity to kill target
  END
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
  END
  PATCH_IF GAME_IS ~bgee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
//    267,  64285, "-10", "same", "-10",  "-10", "same" => 1 // disable string "vorpal hit" (BGEE?)
    267,  25282, "-10", "same", "-10",  "-10", "same" => 1 // disable string "death"      (BGEE)
    267,  31250, "-10", "same", "-10",  "-10", "same" => 1 // disable string "undead destroyed"   (BGEE)
   END
  END
  PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    267,  64285, "-10", "same", "-10",  "-10", "same" => 1 // disable string "vorpal hit"       (BG2EE)
    267,  14026, "-10", "same", "-10",  "-10", "same" => 1 // disable string "death"            (BG2EE)
    267,  10554, "-10", "same", "-10",  "-10", "same" => 1 // disable string "undead destroyed" (BG2EE)
   END
  END
  PATCH_IF GAME_IS ~iwdee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    267,  35592, "-10", "same", "-10",  "-10", "same" => 1 // disable string "vorpal hit"    (IWDEE)
    267,  35591, "-10", "same", "-10",  "-10", "same" => 1 // disable string "death"         (IWDEE)
    267,  35600, "-10", "same", "-10",  "-10", "same" => 1 // disable string "undead destroyed"  (IWDEE)
    267,  40195, "-10", "same", "-10",  "-10", "same" => 1 // disable string "Outer planar destroyed"  (IWDEE)
   END
  END
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN END // nothing to delete
END




// turns invisibility immunity into full immunity
DEFINE_PATCH_MACRO ~cd_immunity_invisibility_arrays~ BEGIN
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_key BEGIN
    101, "-10", 20, "same",  "-10",  "-10", "same" => 1 // immunity to invisibility
  END
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
  END
  PATCH_IF GAME_IS ~bgee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    267,  31747, "-10", "same", "-10",  "-10", "same" => 1 // disable string "invisible"   (BGEE)
   END
  END
  PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    267,  14773, "-10", "same", "-10",  "-10", "same" => 1 // disable string "invisible"  (BG2EE)
   END
  END
  PATCH_IF GAME_IS ~iwdee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    267,  37762, "-10", "same", "-10",  "-10", "same" => 1 // disable string "invisible"  (IWDEE)
   END
  END
DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN END //
  PATCH_IF GAME_IS ~bgee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
    267,  14773, "-10", "same", "-10",  "-10", "same" => 1 // disable string "invisible"  (BG2EE)
    267,  37762, "-10", "same", "-10",  "-10", "same" => 1 // disable string "invisible"  (IWDEE)
   END
  END
  PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
    267,  31747, "-10", "same", "-10",  "-10", "same" => 1 // disable string "invisible"   (BGEE)
    267,  37762, "-10", "same", "-10",  "-10", "same" => 1 // disable string "invisible"  (IWDEE)
   END
  END
  PATCH_IF GAME_IS ~iwdee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
    267,  31747, "-10", "same", "-10",  "-10", "same" => 1 // disable string "invisible"   (BGEE)
    267,  14773, "-10", "same", "-10",  "-10", "same" => 1 // disable string "invisible"  (BG2EE)
   END
  END
END




// turns silence immunity into full immunity
DEFINE_PATCH_MACRO ~cd_immunity_silence_arrays~ BEGIN
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_key BEGIN
    101, "-10", 38, "same",  "-10",  "-10", "same" => 1 // immunity to silence
  END
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
  END
  PATCH_IF cosmetic = 1 BEGIN
    DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
      169, "-10", 34, "same", "-10", "-10", "same" => 1 // prevent silenced icon
    END
  END
  PATCH_IF GAME_IS ~bgee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    267,  31791, "-10", "same", "-10",  "-10", "same" => 1 // disable string "silence"  (BGEE)
    267,  17425, "-10", "same", "-10",  "-10", "same" => 1 // disable string "silenced" (BGEE)
   END
  END
  PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    267,  14002, "-10", "same", "-10",  "-10", "same" => 1 // disable string "silence"  (BG2EE)
    267,  14676, "-10", "same", "-10",  "-10", "same" => 1 // disable string "silenced" (BG2EE)
   END
  END
  PATCH_IF GAME_IS ~iwdee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    267,  37805, "-10", "same", "-10",  "-10", "same" => 1 // disable string "silence"  (IWDEE)
    267,  37633, "-10", "same", "-10",  "-10", "same" => 1 // disable string "silenced" (IWDEE)
   END
  END
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN END // nothing to delete
  PATCH_IF GAME_IS ~bgee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
    267,  37805, "-10", "same", "-10",  "-10", "same" => 1 // disable string "silence"  (IWDEE)
    267,  37633, "-10", "same", "-10",  "-10", "same" => 1 // disable string "silenced" (IWDEE)
    267,  14002, "-10", "same", "-10",  "-10", "same" => 1 // disable string "silence"  (BG2EE)
    267,  14676, "-10", "same", "-10",  "-10", "same" => 1 // disable string "silenced" (BG2EE)
   END
  END
  PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
    267,  31791, "-10", "same", "-10",  "-10", "same" => 1 // disable string "silence"  (BGEE)
    267,  17425, "-10", "same", "-10",  "-10", "same" => 1 // disable string "silenced" (BGEE)
    267,  37805, "-10", "same", "-10",  "-10", "same" => 1 // disable string "silence"  (IWDEE)
    267,  37633, "-10", "same", "-10",  "-10", "same" => 1 // disable string "silenced" (IWDEE)
   END
  END
  PATCH_IF GAME_IS ~iwdee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
    267,  31791, "-10", "same", "-10",  "-10", "same" => 1 // disable string "silence"  (BGEE)
    267,  17425, "-10", "same", "-10",  "-10", "same" => 1 // disable string "silenced" (BGEE)
    267,  14002, "-10", "same", "-10",  "-10", "same" => 1 // disable string "silence"  (BG2EE)
    267,  14676, "-10", "same", "-10",  "-10", "same" => 1 // disable string "silenced" (BG2EE)
   END
  END
END



// turns blindness immunity into full immunity
DEFINE_PATCH_MACRO ~cd_immunity_blindness_arrays~ BEGIN
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_key BEGIN
    101, "-10", 74, "same",  "-10",  "-10", "same" => 1 // immunity to blindness
  END
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    267,  14674, "-10", "same", "-10",  "-10", "same" => 1 // disable string "blinded"   (BG2EE--Also, protects vs. batch added blindness string--i.e. for ALL games)
  END
  PATCH_IF cosmetic = 1 BEGIN
    DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
      169, "-10", 8, "same", "-10", "-10", "same" => 1 // prevent blindness icon
    END
  END
  PATCH_IF GAME_IS ~bgee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    267,  31786, "-10", "same", "-10",  "-10", "same" => 1 // disable string "blinded"   (BGEE)
    267,  26352, "-10", "same", "-10",  "-10", "same" => 1 // disable string "Blindness"   (BGEE)
    267,  17399, "-10", "same", "-10",  "-10", "same" => 1 // disable string "Blind"   (BGEE)
   END
  END
  PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    267,   1474, "-10", "same", "-10",  "-10", "same" => 1 // disable string "blind"  (BG2EE)
   END
  END
  PATCH_IF GAME_IS ~iwdee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    267,   37800, "-10", "same", "-10",  "-10", "same" => 1 // disable string "Blinded"  (IWDEE)
    267,   37608, "-10", "same", "-10",  "-10", "same" => 1 // disable string "Blind"  (IWDEE)
   END
  END
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN // these alts don't appear to be used...
  /*
    267,   1474, "-10", "same", "-10",  "-10", "same" => 1 // disable string "blind"
    267,  14071, "-10", "same", "-10",  "-10", "same" => 1 // display 'blindness' string
    267,  12015, "-10", "same", "-10",  "-10", "same" => 1 // disable string "blind"
    267,  12948, "-10", "same", "-10",  "-10", "same" => 1 // disable string "blind"
    267,  13017, "-10", "same", "-10",  "-10", "same" => 1 // disable string "blind"
    267,  17399, "-10", "same", "-10",  "-10", "same" => 1 // disable string "blind"   
 */
  END // nothing to delete
  PATCH_IF GAME_IS ~bgee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
    267,   1474, "-10", "same", "-10",  "-10", "same" => 1 // disable string "blind"  (BG2EE)
    267,   37800, "-10", "same", "-10",  "-10", "same" => 1 // disable string "Blinded"  (IWDEE)
    267,   37608, "-10", "same", "-10",  "-10", "same" => 1 // disable string "Blind"  (IWDEE)
   END
  END
  PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
    267,  31786, "-10", "same", "-10",  "-10", "same" => 1 // disable string "blinded"   (BGEE)
    267,  26352, "-10", "same", "-10",  "-10", "same" => 1 // disable string "Blindness"   (BGEE)
    267,  17399, "-10", "same", "-10",  "-10", "same" => 1 // disable string "Blind"   (BGEE)
    267,   37800, "-10", "same", "-10",  "-10", "same" => 1 // disable string "Blinded"  (IWDEE)
    267,   37608, "-10", "same", "-10",  "-10", "same" => 1 // disable string "Blind"  (IWDEE)
   END
  END
  PATCH_IF GAME_IS ~iwdee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
    267,   1474, "-10", "same", "-10",  "-10", "same" => 1 // disable string "blind"  (BG2EE)
    267,   37800, "-10", "same", "-10",  "-10", "same" => 1 // disable string "Blinded"  (IWDEE)
    267,   37608, "-10", "same", "-10",  "-10", "same" => 1 // disable string "Blind"  (IWDEE)
   END
  END
END


// turns deafness immunity into full immunity
DEFINE_PATCH_MACRO ~cd_immunity_deafness_arrays~ BEGIN
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_key BEGIN
    101, "-10", 80, "same",  "-10",  "-10", "same" => 1 // immunity to deafneas
  END
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
  END
  PATCH_IF cosmetic = 1 BEGIN
    DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
      169, "-10", 112, "same", "-10", "-10", "same" => 1 // prevent deaf icon
    END
  END
  PATCH_IF GAME_IS ~bgee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    267,  30258, "-10", "same", "-10",  "-10", "same" => 1 // disable string "Deafness"   (BGEE)
    267,  25102, "-10", "same", "-10",  "-10", "same" => 1 // disable string "Deaf"   (BGEE)
   END
  END
  PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    267,  54318, "-10", "same", "-10",  "-10", "same" => 1 // disable string "deaf" (BG2EE)
   END
  END
  PATCH_IF GAME_IS ~iwdee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    267,  14073, "-10", "same", "-10",  "-10", "same" => 1 // disable string "Deafness"   (IWDEE)
    267,  35952, "-10", "same", "-10",  "-10", "same" => 1 // disable string "Deaf"   (IWDEE)
   END
  END
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN END // nothing to delete
  PATCH_IF GAME_IS ~bgee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
    267,  14073, "-10", "same", "-10",  "-10", "same" => 1 // disable string "Deafness"   (IWDEE)
    267,  35952, "-10", "same", "-10",  "-10", "same" => 1 // disable string "Deaf"   (IWDEE)
    267,  54318, "-10", "same", "-10",  "-10", "same" => 1 // disable string "deaf" (BG2EE)
   END
  END
  PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
    267,  14073, "-10", "same", "-10",  "-10", "same" => 1 // disable string "Deafness"   (IWDEE)
    267,  35952, "-10", "same", "-10",  "-10", "same" => 1 // disable string "Deaf"   (IWDEE)
    267,  30258, "-10", "same", "-10",  "-10", "same" => 1 // disable string "Deafness"   (BGEE)
    267,  25102, "-10", "same", "-10",  "-10", "same" => 1 // disable string "Deaf"   (BGEE)
   END
  END
  PATCH_IF GAME_IS ~iwdee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
    267,  54318, "-10", "same", "-10",  "-10", "same" => 1 // disable string "deaf" (BG2EE)
    267,  30258, "-10", "same", "-10",  "-10", "same" => 1 // disable string "Deafness"   (BGEE)
    267,  25102, "-10", "same", "-10",  "-10", "same" => 1 // disable string "Deaf"   (BGEE)
   END
  END
END



...

// turns invisible detection immunity into full immunity
DEFINE_PATCH_MACRO ~cd_immunity_invisible_detection_arrays~ BEGIN
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_key BEGIN
    101, "-10", 116, "same",  "-10",  "-10", "same" => 1 // immunity to detect invisible
  END
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
  END
  PATCH_IF GAME_IS ~bgee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    267,  26179, "-10", "same", "-10",  "-10", "same" => 1 // disable string "dispel invisible" (BGEE)
   END
  END
  PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    267,  14109, "-10", "same", "-10",  "-10", "same" => 1 // disable string "dispel invisible" (BG2EE)
   END
  END
  PATCH_IF GAME_IS ~iwdee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    267,  36282, "-10", "same", "-10",  "-10", "same" => 1 // disable string "dispel invisible" (IWDEE)
   END
  END
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN END // nothing to delete
  PATCH_IF GAME_IS ~bgee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
    267,  14109, "-10", "same", "-10",  "-10", "same" => 1 // disable string "dispel invisible" (BG2EE)
    267,  36282, "-10", "same", "-10",  "-10", "same" => 1 // disable string "dispel invisible" (IWDEE)
   END
  END
  PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
    267,  26179, "-10", "same", "-10",  "-10", "same" => 1 // disable string "dispel invisible" (BGEE)
    267,  36282, "-10", "same", "-10",  "-10", "same" => 1 // disable string "dispel invisible" (IWDEE)
   END
  END
  PATCH_IF GAME_IS ~iwdee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
    267,  26179, "-10", "same", "-10",  "-10", "same" => 1 // disable string "dispel invisible" (BGEE)
    267,  14109, "-10", "same", "-10",  "-10", "same" => 1 // disable string "dispel invisible" (BG2EE)
   END
  END
END

...

// turns sleep immunity into full immunity
DEFINE_PATCH_MACRO ~cd_immunity_sleep_arrays~ BEGIN
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_key BEGIN
    101, "-10",  39, "same",  "-10",  "-10", "same" => 1 // immunity to sleep
    101, "-10", 217, "same",  "-10",  "-10", "same" => 1 // immunity to pw: sleep
  END
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
  END
  PATCH_IF cosmetic = 1 BEGIN
    DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
      169, "-10", 14, "same", "-10", "-10", "same" => 1 // prevent sleep icon
    END
  END
  PATCH_IF GAME_IS ~bgee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    267,  26371, "-10", "same", "-10",  "-10", "same" => 1 // disable string "sleep" (BGEE)
   END
  END
  PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    267,  14001, "-10", "same", "-10",  "-10", "same" => 1 // disable string "sleep" (BG2EE)
   END
  END
  PATCH_IF GAME_IS ~iwdee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    267,  37613, "-10", "same", "-10",  "-10", "same" => 1 // disable string "sleep"  (IWDEE)
   END
  END
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN END // nothing to delete
  PATCH_IF GAME_IS ~bgee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
    267,  14001, "-10", "same", "-10",  "-10", "same" => 1 // disable string "sleep" (BG2EE)
    267,  37613, "-10", "same", "-10",  "-10", "same" => 1 // disable string "sleep"  (IWDEE)
   END
  END
  PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
    267,  37613, "-10", "same", "-10",  "-10", "same" => 1 // disable string "sleep"  (IWDEE)
    267,  26371, "-10", "same", "-10",  "-10", "same" => 1 // disable string "sleep" (BGEE)
   END
  END
  PATCH_IF GAME_IS ~iwdee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
    267,  14001, "-10", "same", "-10",  "-10", "same" => 1 // disable string "sleep" (BG2EE)
    267,  26371, "-10", "same", "-10",  "-10", "same" => 1 // disable string "sleep" (BGEE)
   END
  END
END

// turns stun immunity into full immunity
DEFINE_PATCH_MACRO ~cd_immunity_stun_arrays~ BEGIN
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_key BEGIN
    101, "-10",  45, "same",  "-10",  "-10", "same" => 1 // immunity to stun
    101, "-10", 210, "same",  "-10",  "-10", "same" => 1 // immunity to pw: stun
  END
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
  END
  PATCH_IF cosmetic = 1 BEGIN
    DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
      169, "-10", 55, "same", "-10", "-10", "same" => 1 // prevent stun icon
    END
  END
  PATCH_IF GAME_IS ~bgee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    267,   26050, "-10", "same", "-10",  "-10", "same" => 1 // disable string "stunned"  (BGEE)
    267,   25862, "-10", "same", "-10",  "-10", "same" => 1 // disable string "stun"  (BGEE)
   END
  END
  PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    267,   1280, "-10", "same", "-10",  "-10", "same" => 1 // disable string "stunned"   (BG2EE)
    267,  14043, "-10", "same", "-10",  "-10", "same" => 1 // disable string "stun"      (BG2EE)
   END
  END
  PATCH_IF GAME_IS ~iwdee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    267,   35568, "-10", "same", "-10",  "-10", "same" => 1 // disable string "stunned"  (IWDEE)
    267,   35567, "-10", "same", "-10",  "-10", "same" => 1 // disable string "stun"  (IWDEE)
   END
  END
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN END // nothing to delete
  PATCH_IF GAME_IS ~bgee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
    267,   1280, "-10", "same", "-10",  "-10", "same" => 1 // disable string "stunned"   (BG2EE)
    267,  14043, "-10", "same", "-10",  "-10", "same" => 1 // disable string "stun"      (BG2EE)
    267,   35568, "-10", "same", "-10",  "-10", "same" => 1 // disable string "stunned"  (IWDEE)
    267,   35567, "-10", "same", "-10",  "-10", "same" => 1 // disable string "stun"  (IWDEE)
   END
  END
  PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
    267,   26050, "-10", "same", "-10",  "-10", "same" => 1 // disable string "stunned"  (BGEE)
    267,   25862, "-10", "same", "-10",  "-10", "same" => 1 // disable string "stun"  (BGEE)
    267,   35568, "-10", "same", "-10",  "-10", "same" => 1 // disable string "stunned"  (IWDEE)
    267,   35567, "-10", "same", "-10",  "-10", "same" => 1 // disable string "stun"  (IWDEE)
   END
  END
  PATCH_IF GAME_IS ~iwdee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
    267,   26050, "-10", "same", "-10",  "-10", "same" => 1 // disable string "stunned"  (BGEE)
    267,   25862, "-10", "same", "-10",  "-10", "same" => 1 // disable string "stun"  (BGEE)
    267,   1280, "-10", "same", "-10",  "-10", "same" => 1 // disable string "stunned"   (BG2EE)
    267,  14043, "-10", "same", "-10",  "-10", "same" => 1 // disable string "stun"      (BG2EE)
   END
  END
END

// ensures stun is always accompanied by string and icon
DEFINE_PATCH_MACRO ~cd_full_stun_arrays~ BEGIN
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_key BEGIN
    45, "-10", "-10", "same",  "-10",  "-10", "same" => 1 // blindness
  END
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    142, "-10",    55, "same", "-10", "-10", "same" => 1 // display 'stun' icon
  END
  PATCH_IF GAME_IS ~bgee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    139,  26050, "-10", "same",     1,     0, "same" => 1 // display 'stunned' string  (BGEE)
   END
  END
  PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    139,  1280, "-10", "same",     1,     0, "same" => 1 // display 'stunned' string   (BG2EE)
   END
  END
  PATCH_IF GAME_IS ~iwdee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    139,  35568, "-10", "same",     1,     0, "same" => 1 // display 'stunned' string   (IWDEE)
   END
  END
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN END
  PATCH_IF GAME_IS ~bgee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
    139,  1280, "-10", "same",     1,     0, "same" => 1 // display 'stunned' string   (BG2EE)
    139,  35568, "-10", "same",     1,     0, "same" => 1 // display 'stunned' string   (IWDEE)
   END
  END
  PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
    139,  26050, "-10", "same",     1,     0, "same" => 1 // display 'stunned' string  (BGEE)
    139,  35568, "-10", "same",     1,     0, "same" => 1 // display 'stunned' string   (IWDEE)
   END
  END
  PATCH_IF GAME_IS ~iwdee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
    139,  26050, "-10", "same",     1,     0, "same" => 1 // display 'stunned' string  (BGEE)
    139,  1280, "-10", "same",     1,     0, "same" => 1 // display 'stunned' string   (BG2EE)
   END
  END
END



...


 

NEW BATCHES

//berserk immunity
DEFINE_PATCH_MACRO ~b_immunity_berserk_arrays~ BEGIN
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_key BEGIN
    101,  "-10", "-10", "same",  "-10",  "-10", "same" => 1 //Exaltation doesn't protect vs berserk despite description
    101,  "-10", 3, "same",  "-10",  "-10", "same" => 1 // immunity to berserk state
    101,  "-10", 245, "same",  "-10",  "-10", "same" => 1 // immunity to berserk state
    101,  "-10", 246, "same",  "-10",  "-10", "same" => 1 // immunity to berserk state
    101,  "-10", 247, "same",  "-10",  "-10", "same" => 1 // immunity to berserk state
  END
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN //nope
    169, "-10", 4, "", "-10", "-10", "same" => 1 // prevent berserk icon
  END
PATCH_IF GAME_IS ~iwdee~ BEGIN //well...
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    324, "0", "0", "sppr522",  "-10", "-10", "same" => 1 // protection from spell, animal rage
    324, "0", "0", "sppr422",  "-10", "-10", "same" => 1 // protection from spell, blood rage
    169, "-10", 173, "", "-10", "-10", "same" => 1 // protection from animal rage icon
    169, "-10", 176, "", "-10", "-10", "same" => 1 // protection from blood rage icon
  END
END
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN 
  END // nadda but...
PATCH_IF NOT GAME_IS ~iwdee~ BEGIN //well...
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
    324, "0", "0", "sppr522",  "-10", "-10", "same" => 1 // protection from spell, animal rage
    324, "0", "0", "sppr422",  "-10", "-10", "same" => 1 // protection from spell, blood rage
    169, "-10", 173, "", "-10", "-10", "same" => 1 // protection from animal rage icon
    169, "-10", 176, "", "-10", "-10", "same" => 1 // protection from blood rage icon
  END
END


END

Rage/Berserk removal...
//Rage/berserk removal
DEFINE_PATCH_MACRO ~b_removal_rage_arrays~ BEGIN
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_key BEGIN
    4,  "-10", "-10", "same",  "-10",  "-10", "same" => 1 //cure: berserking
  END
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    321, "0", "0", "spcl152",  "-10", "-10", "same" => 1 // remove spell, barbi rage
    240, "-10", 138, "", "-10", "-10", "same" => 1 // remove barbi rage icon
    240, "-10", 4, "", "-10", "-10", "same" => 1 // remove berserk icon
    321, "0", "0", "b_tem03",  "-10", "-10", "same" => 1 // remove spell, Tempus incite rage special
    240, "-10", 141, "",   "-10",  "-10", "same" => 1 // remove enrage icon
    321, "0", "0", "spcl321",  "-10", "-10", "same" => 1 // remove spell,  enrage special
  END
PATCH_IF GAME_IS ~iwdee~ BEGIN  //iwdee specific icons--handle IWDification/B_Spells a different way
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    321, "0", "0", "sppr522",  "-10", "-10", "same" => 1 // remove spell, animal rage
    321, "0", "0", "sppr422",  "-10", "-10", "same" => 1 // remove spell, blood rage
    240, "-10", 173, "", "-10", "-10", "same" => 1 // remove animal rage icon
    240, "-10", 176, "", "-10", "-10", "same" => 1 // remove blood rage icon
  END
END
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
  END // nadda...except
PATCH_IF NOT GAME_IS ~iwdee~ BEGIN  //
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
    321, "0", "0", "sppr522",  "-10", "-10", "same" => 1 // remove spell, animal rage
    321, "0", "0", "sppr422",  "-10", "-10", "same" => 1 // remove spell, blood rage
    240, "-10", 173, "", "-10", "-10", "same" => 1 // remove animal rage icon
    240, "-10", 176, "", "-10", "-10", "same" => 1 // remove blood rage icon
  END
END
END

Rage/Berserk immunity

 

//Rage/berserk immunity
DEFINE_PATCH_MACRO ~b_immunity_rage_arrays~ BEGIN
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_key BEGIN
    101,  "-10", 3, "same",  "-10",  "-10", "same" => 1 // immunity to berserk state
    101,  "-10", 245, "same",  "-10",  "-10", "same" => 1 // immunity to berserk state
    101,  "-10", 246, "same",  "-10",  "-10", "same" => 1 // immunity to berserk state
    101,  "-10", 247, "same",  "-10",  "-10", "same" => 1 // immunity to berserk state
  END
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    169, "-10", 138, "", "-10", "-10", "same" => 1 // prevent barbi rage icon
    169, "-10", 4, "", "-10", "-10", "same" => 1 // prevent berserk icon
    324, "0", "0", "spcl152",  "-10", "-10", "same" => 1 // protection from spell, barbi rage special
    324, "0", "0", "b_tem03",  "-10", "-10", "same" => 1 // protection from spell, Tempus incite rage
    169, "-10", 141, "", "-10", "-10", "same" => 1 // prevent enrage icon
    324, "0", "0", "spcl321",  "-10", "-10", "same" => 1 // protection from spell, enrage special
  END
  PATCH_IF GAME_IS ~bgee~ BEGIN
    DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    267, 25829, "-10",     "",  "-10", "-10", "same" => 1 // protection from string re rage (BGEE)
  END
  END
  PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    267, 20723, "-10",     "",  "-10", "-10", "same" => 1 // protection from string re rage (BG2EE)
   END
  END
  PATCH_IF GAME_IS ~iwdee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    267, 36021, "-10",     "",  "-10", "-10", "same" => 1 // protection from string re rage (IWDEE)
    324, "0", "0", "sppr522",  "-10", "-10", "same" => 1 // protection from spell, animal rage
    324, "0", "0", "sppr422",  "-10", "-10", "same" => 1 // protection from spell, blood rage
    169, "-10", 173, "", "-10", "-10", "same" => 1 // protection from animal rage icon
    169, "-10", 176, "", "-10", "-10", "same" => 1 // protection from blood rage icon
   END
  END
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN 
  END // nadda er....
  PATCH_IF GAME_IS ~iwdee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
    267, 20723, "-10",     "",  "-10", "-10", "same" => 1 // protection from string re rage (BG2EE)
    267, 25829, "-10",     "",  "-10", "-10", "same" => 1 // protection from string re rage (BGEE)
   END
  END
  PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
    267, 25829, "-10",     "",  "-10", "-10", "same" => 1 // protection from string re rage (BGEE)
    267, 36021, "-10",     "",  "-10", "-10", "same" => 1 // protection from string re rage (IWDEE)
    324, "0", "0", "sppr522",  "-10", "-10", "same" => 1 // protection from spell, animal rage
    324, "0", "0", "sppr422",  "-10", "-10", "same" => 1 // protection from spell, blood rage
    169, "-10", 173, "", "-10", "-10", "same" => 1 // protection from animal rage icon
    169, "-10", 176, "", "-10", "-10", "same" => 1 // protection from blood rage icon
  END
  END
  PATCH_IF GAME_IS ~bgee~ BEGIN
   DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
    267, 20723, "-10",     "",  "-10", "-10", "same" => 1 // protection from string re rage (BG2EE)
    267, 36021, "-10",     "",  "-10", "-10", "same" => 1 // protection from string re rage (IWDEE)
    324, "0", "0", "sppr522",  "-10", "-10", "same" => 1 // protection from spell, animal rage
    324, "0", "0", "sppr422",  "-10", "-10", "same" => 1 // protection from spell, blood rage
    169, "-10", 173, "", "-10", "-10", "same" => 1 // protection from animal rage icon
    169, "-10", 176, "", "-10", "-10", "same" => 1 // protection from blood rage icon
   END
  END
END

 

 

NEW BATCHES

Edited by Grammarsalad
Link to comment

Cam, this is something of a tutorial for using this batch, at least as I plan to use it. It seems relevant and useful, but let me know if this is out of place, of if I am leading others astray with my stupidity, or similar and I'll delete it or change it as necessary. I'm just really excited about this tool!

 

Okay, so I wanted to drop a note about how awesome these macros are for me. Maybe they can be awesome for you, too!

 

I am creating a mod that adds A LOT of new spells to the game via ADD_SPELL (all IWDEE spells to BG(2)EE and SoD for starters).

 

This creates a couple of problems that are easily solvable with this code (et al. I will get into some of those details in the hopes of aiding other fledgling modders with these issues).

 

Problem 1: some of my added spells protect against or otherwise interact with other added spells. But, where two added spells interact, I have no way of knowing ahead of time the filenames of those particular spells. I have some really messy code to do this, but with this code I can erase most of it (I'm sure that a better coder would not have such issues, but alas!)

 

Problem 2: In a given install, other mods may install spells that should interact with my spells. I can do checks for specific spells that I know about in advance, but this code allows me to send a wide net to catch more spells easier.

 

Okay, so let me give a concrete example. One spell that I am adding from IWDEE is the wizard spell Emotion: Fear. Another spell I'm adding is Blood Rage. Now, blood rage has been the bane of my existence because it protects against so many spells, but anyway it protects against, and removes fear effects. I'll go into fear removal as an example of one way (not the only way, I'm sure) to use this code to make your life a little bit easier.

 

Here is the beauty of the system: I don't have to specifically worry about Blood Rage anymore. All I need to do is alter the cd_fear_removal_arrays to suit my needs, add my relevant spells to an array, alter the and then, at the very end of my install, run a regexp inside an ACTION_PHP_EACH, apply cd_fear_removal_arrays, use other relevant commands like ALTER_EFFECT, and then Boom! The targeted spells will add the relevant effects and I can get on with my life!

 

The above is very general because, it turns out, you can do SO MUCH. But, let's get concrete and specific.

 

The original cd_fear_removal_arrays has, as it's key, effect 161 (cure: fear). That's probably all you need for they key batch; any spell that is going to cure fear should use this opcode, no? So, let's move on.

 

In the extra batches, I will add this line:

 

      321, "-10", "-10", "FEAR_R", 1, 0, "same" => 1 // remove spell effects: generic

Opcode 321 is EE specific, so don't use this in a non EE game. Honestly, I forget how vanilla fear removal goes, but be sure to use whatever effect that uses to remove the effects of a given spell. Anyway, 321 is just the effect I need to remove my custom spls. "FEAR_R" is just a placeholder that will be ALTERed in the regexp to my spell using an array variable.

 

Okay, now, for the array. There are a number of ways to create a custom array, I'm sure, but here is the way I do it. After I add my spell, there is this wonderful Weidu command RES_NUM_OF_SPELL_NAME which allows one to save the filename of the spell you have just added to a variable. You can then use that variable to add the filename to an array which can then be called. So, this is what I do at some point after I add a fear spell (here, I'll use emotion: fear as an example):

 

ADD_SPELL ~Spells/data/iwd_spells/wizard_4/b_w428.spl~ 2 4 ~WIZARD_EMOTION_FEAR~ //
//...stuff


//to clear earlier versions of the spell
LAF RES_NUM_OF_SPELL_NAME
  STR_VAR spell_name = ~WIZARD_EMOTION_FEAR~
  RET spell_res
END
//more stuff...
//fear immunity list
ACTION_DEFINE_ASSOCIATIVE_ARRAY prot BEGIN


~%spell_res%~ => fear


END

Top to bottom: When I add the spell the spell will have the internal name, WIZARD_EMOTION_FEAR written to SPELL.ids. (you otherwise name the spell just as per COPY). When it comes to save my (unknown) filename to a variable, I use RES_NUM_OF_SPELL_NAME exactly as written. The only thing that would be different is the ~WIZARD_EMOTION_FEAR~, which would just be ~YOUR_INTERNAL_SPELLNAME~. Your file name will be saved as the variable spell_res.

 

Okay, now the next part is where your filename gets added to your array.

 

ACTION_DEFINE_ASSOCIATIVE_ARRAY prot BEGIN

 

assigns a name to your array which will be called for later. Here, my name is "prot", but you can name it whatever works for you.

 

~%spell_res%~ => fear
This line is where your filename gets added to the array. Your array will actually be <file name> => fear. Note that the 'fear' part can be whatever you want, and you can use it to define different kinds of effects to apply to different kinds of uses (e.g. I use ~%spell_res%~ => fear for fear removal/protection, ~%spell_res%~ => death for death protection, etc. all in my prot array).
END is just END for that particular array :)
Okay, now for the exciting part (for me, anyway). Here, we need to call for the array, and then use regexp to apply the right effects to the right spells.
A couple of things to note: There is already a warning in the code, but don't use this with cd_immunity_free_action_arrays
As it says in the comments, "...unlike other batches, do *not* use this one in a regexp--it'll turn a small web immunity into fullblown FA."
Also, the code I'm going to give is very bare bones to illustrate what I'm doing. It is very likely that the final code should contain other relevant PATCH_IF's (e.g. it will copy ALL spl's, including innates, bard songs, and so on. Not all of the spls it copies may be appropriate and these should be excluded with PATCH_IF or similar):
ACTION_PHP_EACH prot AS block => rock BEGIN   //
  ACTION_IF (~%rock%~ STRING_EQUAL ~fear~) BEGIN  //


  COPY_EXISTING_REGEXP GLOB ~.*\.spl~ ~override~ //copy over all spl files
   PATCH_IF (SOURCE_SIZE > 0x71) BEGIN // avoid crashing on empty items //
     LPF cd_apply_batch STR_VAR array_name = cd_fear_removal_arrays END //fear removal arrays (modified for 321 with "FEAR_R" for generic spls)
       LPF ALTER_EFFECT INT_VAR match_opcode = 321 STR_VAR match_resource = ~FEAR_R~ resource = EVAL ~%block%~ END
   END //
  BUT_ONLY//


 END
END

I've put spaces between the ARRAY code and the regexp code (the spaces aren't necessary).

 

ACTION_PHP_EACH prot AS block => rock BEGIN

 

This does a couple of things. First, it calls your array (here, my "prot" array), and applies the variables "block" and "rock" for your <file name> and 'fear' denotation, respectively. This is what allows me to do this in the next line:

 

ACTION_IF (~%rock%~ STRING_EQUAL ~fear~) BEGIN

 

Remember how I said that I use the same array for multiple protection types? Well, here, only the ones designated 'fear' will be considered (as opposed to 'death' etc.) That is, only my fear spells will be applied to the relevant fear removal spells.

This is just normal regexp stuff:

 

COPY_EXISTING_REGEXP GLOB ~.*\.spl~ ~override~ //copy over all spl files
PATCH_IF (SOURCE_SIZE > 0x71) BEGIN // avoid crashing on empty items //

This line:
LPF cd_apply_batch STR_VAR array_name = cd_fear_removal_arrays END //fear removal arrays (modified for 321 with "FEAR_R" for generic spls)
Applies the (altered) fear removal array. Because the array checks for any spell that has the 161 effect, and only when it detects such an effect does it add the extra stuff, including my 'dummy' 321 effect, I can then do this:
LPF ALTER_EFFECT INT_VAR match_opcode = 321 STR_VAR match_resource = ~FEAR_R~ resource = EVAL ~%block%~ END
This little beauty will look for any 321 opcode that has "FEAR_R" in it's resource key, and will then replace that text with the value of 'block' (which will be the filename of your spell).
Note that the BUT_ONLY is essential if you don't want to copy ALL spl files into the override!
This code will iterate through all spl files for each 'member' of 'fear' in your prot array, add the 'dummy' 321 effect, and then change it to the relevant file name.
Link to comment

I was going to post some updates, but I (finally) read through grammarsalad's post above and have some comments.

ACTION_PHP_EACH prot AS block => rock BEGIN   //
  ACTION_IF (~%rock%~ STRING_EQUAL ~fear~) BEGIN  //


  COPY_EXISTING_REGEXP GLOB ~.*\.spl~ ~override~ //copy over all spl files
   PATCH_IF (SOURCE_SIZE > 0x71) BEGIN // avoid crashing on empty items //
     LPF cd_apply_batch STR_VAR array_name = cd_fear_removal_arrays END //fear removal arrays (modified for 321 with "FEAR_R" for generic spls)
       LPF ALTER_EFFECT INT_VAR match_opcode = 321 STR_VAR match_resource = ~FEAR_R~ resource = EVAL ~%block%~ END
   END //
  BUT_ONLY//


 END
END

This is going to be needlessly slow--you're calling a copy of all spells for every entry in your prot array, and then forcing an additional pass with ALTER. You'd be better served updating the array defines on the fly and then calling it once at the end. For example...

Define your array like so in a file named MyMod/immunity_defines.tpa

// turns fear removal into full removal
DEFINE_PATCH_MACRO ~cd_fear_removal_arrays~ BEGIN
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_key BEGIN
    161, "-10", "-10", "same",  "-10",  "-10", "same" => 1 // fear removal
  END
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN END
  PATCH_IF FILE_EXISTS_IN_GAME ~monkfist.2da~ BEGIN // ee game
    DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
      321, "-10", "-10", "spin105", 1, 0, "same" => 1 // remove spell effects: horror, innate (removes visuals)
      321, "-10", "-10", "spwi205", 1, 0, "same" => 1 // remove spell effects: horror, arcane (removes visuals)
//insert_cd_fear_removal_arrays
    END
  END
  PATCH_IF cosmetic = 1 BEGIN
    DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
      240, "-10", 36, "same", 1, 0, "same" => 1 // remove panic icon
    END
  END
  DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN END // nothing to delete
END


The "//insert_cd_fear_removal_arrays" bit is added for an easy replace. Then use this in the main tp2

ACTION_PHP_EACH prot AS block => rock BEGIN
  ACTION_IF (~%rock%~ STRING_EQUAL ~fear~) BEGIN

    COPY ~MyMod/immunity_defines.tpa~ ~MyMod/immunity_defines.tpa~
      REPLACE_TEXTUALLY ~\(//insert_cd_fear_removal_arrays\)~ ~321, "-10", "-10", "%block%", 1, 0, "same" => 1
\1~

  END
END

REINCLUDE ~MyMod/immunity_defines.tpa~

COPY_EXISTING_REGEXP GLOB ~^.+\.spl$~ ~override~ //copy over all spl files
  LPF cd_apply_batch STR_VAR array_name = cd_fear_removal_arrays END
  BUT_ONLY


One regexp copy, no matter how many times you've added stuff to the array. You could even extend it further with other protections and still end up with one copy by using the same trick:

ACTION_PHP_EACH prot AS block => rock BEGIN
  ACTION_IF (~%rock%~ STRING_EQUAL ~fear~) BEGIN

    COPY ~MyMod/immunity_defines.tpa~ ~MyMod/immunity_defines.tpa~
      REPLACE_TEXTUALLY ~\(//insert_cd_fear_removal_arrays\)~ ~321, "-10", "-10", "%block%", 1, 0, "same" => 1
\1~

  END

  ACTION_IF (~%rock%~ STRING_EQUAL ~some_other_thing~) BEGIN

    COPY ~MyMod/immunity_defines.tpa~ ~MyMod/immunity_defines.tpa~
      REPLACE_TEXTUALLY ~\(//insert_cd_immunity_some_other_thing\)~ ~321, "-10", "-10", "%block%", 1, 0, "same" => 1 // 321 or 206 or whatever you need here
\1~

  END
  // etc.
END

REINCLUDE ~MyMod/immunity_defines.tpa~

COPY_EXISTING_REGEXP GLOB ~^.+\.spl$~ ~override~ //copy over all spl files
  LPF cd_apply_batch STR_VAR array_name = cd_fear_removal_arrays END
  LPF cd_apply_batch STR_VAR array_name = cd_immunity_some_other_thing END
  // etc.
  BUT_ONLY

Also remember that the it's not just spells that need updates but items and creatures, too.

Link to comment

@CamDawg

1) Just a quick heads up about this (lines 99–102):

I mean, generally speaking, that's certainly true. The only "issue" is that some cosmetic effects (in particular delayed sound effects – the ones saying an effect is terminated) will still go through (even though they're supposed not to fire).

Let us consider CLERIC_HOLD_PERSON ("sppr208.spl") as an example.

If you cast it at an UNDEAD, its termination sound (op174, timing=4, duration=60) will still play regardless of their immunity to op175.

Sure, it's not that bad, but it might be annoying / confusing...? I'm asking because I'm making creature skins and I'm not sure if I should block all these resrefs via op206 (op318 in case of ITMs) or not...

2) As kjeron pointed out here, Paralyze and Hold should be treated as two different effects (even though they share the same stat, icon, etc.). I mean, why having two separate opcodes then...?

As a result, ~cd_immunity_hold_arrays~ and ~cd_immunity_hold_special_arrays~ should not also grant immunity to Paralyze (op109).

Some concrete examples. Let us consider CLERIC_CHAOTIC_COMMANDS ("sppr508.spl"). IMHO, it should only block op175. In so doing, you're still vulnerable to Carrion Crawlers, Lich/Ghoul/Ghast touch attacks, and the like... Ditto for BERSERKER_RAGE and related spells/abilities/items... Probably only CLERIC_FREE_ACTION ("sppr403.spl") and related spells/abilities/items should block both op175 and op109...

3) ~cd_immunity_web_arrays~ should not block op109 (as you surely know, op157, unlike the other overlay opcodes (op154 – Entangle / 158 – Grease), naturally paralyzes the targeted creature(s)... WIZARD_WEB and the like should not apply a separate op109 effect).

4) As far as ~cd_immunity_sleep_arrays~ is concerned: well, this is a separate can of worms (and a very big one!).

As you surely know, CLERIC_CHAOTIC_COMMANDS ("sppr508.spl") and related spells/abilities/items block both WIZARD_SLEEP (good) and CLERIC_EARTHQUAKE (bad/unintended)... So to sum up: you should never grant immunity to op39 blindly...

Edited by Luke
Link to comment

Most of this can be answered simply with: these were written for oBG2. The EEs don't need to apply 16 EFFs for elven charm resistance; you just use a pair of 318/324s at the top of the effect stack. Looking back, the proper way to deal with the targeted 175 effects would be to make a subspell, and have the main spell route it through a targeted EFF, which is something actually been moving towards for future versions.

2 hours ago, Luke said:

2) As kjeron pointed out here, Paralyze and Hold should be treated as two different effects (even though they share the same stat, icon, etc.). I mean, why having two separate opcodes then...?

3) ~cd_immunity_web_arrays~ should not block op109 (as you surely know, op157, unlike the other overlay opcodes (op154 – Entangle / 158 – Grease), naturally paralyzes the targeted creature(s)... WIZARD_WEB and the like should not apply a separate op109 effect).

Another Fixpack legacy. In general, we were reluctant to just take a hatchet to the original spells; in hindsight Fixpack would be better served making a finer distinction for the usage of op 109. I'll review for the next version.

2 hours ago, Luke said:

4) As far as ~cd_immunity_sleep_arrays~ is concerned: well, this is a separate can of worms (and a very big one!).

As you surely know, CLERIC_CHAOTIC_COMMANDS ("sppr508.spl") and related spells/abilities/items block both WIZARD_SLEEP (good) and CLERIC_EARTHQUAKE (bad/unintended)... So to sum up: you should never grant immunity to op39 blindly...

I'm not sure you're following how the immunity batches work. Nothing gets done unless the key opcodes--in this case, immunities to op39 or op217--are present. The only way the batch is adding an immunity to op39 is if a spell/item has an existing immunity to op217 but not op39--which nothing does. The goal is to block all of the stuff that normally gets missed (blocking the portrait icon, strings, etc.) not add the immunity itself.

If I'm misunderstanding, and this is a lament that immunity to op39 blocks stuff it shouldn't: right there with you. It'd be nice to have a separate unconscious opcode but, until we do, anything that protects from sleep is also going to (unintentionally) partially block effects from Earthquake and Wing Buffet. For reasons elided above, trying to 206 all sleep spells is not an extensible solution.

Link to comment
On 1/13/2022 at 3:49 PM, CamDawg said:

The EEs don't need to apply 16 EFFs for elven charm resistance; you just use a pair of 318/324s at the top of the effect stack.

I agree with you, but when you introduced op318/324 (along with op328), you forgot to recode all existing (vanilla) SPL/ITM files.

Well, to be precise, the IWDEE version of CLERIC_HOLD_PERSON (along with the WIZARD counterpart) has benefitted from it, since it has an op324 (GENERAL != HUMANOID) effect at the top of the effect stack (in fact, EFF files are not needed on EE games). However, that's not enough: the BG versions have not been recoded to benefit from those two opcodes, plus a lot more. And that's why this is not strictly related to oBG2.

For instance, WIZARD_HOLD_MONSTER ("spwi507.spl") lacks the following op324 effects (at the top of the effect stack):

Spoiler
  • GENERAL = UNDEAD
  • GENERAL = PLANT
  • GENERAL = WEAPON (Mordenkainen's Sword)
  • RACE = SLIME
  • RACE = DRAGON
  • RACE = GOLEM
  • RACE = MIST (unsure about this one, guess they should be treated as UNDEAD...? That is, they should have the same immunities...?)
  • RACE = WILL-O-WISP
  • SPLSTATE = CHAOTIC_COMMANDS
  • SPLSTATE = FREE_ACTION
  • SPLSTATE = BARBARIAN_RAGE
  • SPLSTATE = BERSERKER_RAGE
  • SPLSTATE = MINSC_BERSERK
  • SPLSTATE = POTION_OF_CLARITY
  • something else...?

In so doing, the spell termination sound (along with any other cosmetic effect) will not play. Moreover, it will also provide better feedback for the player (the so-called STRREF_FEEDBACK_IMMUNE_RESOURCE).

For comparison (op109 vs. op175), Carrion Crawler/Lich/Ghoul/Ghast attacks lack the following op318/324 effects (at the top of the effect stack):

Spoiler
  • GENERAL = UNDEAD
  • GENERAL = PLANT
  • GENERAL = WEAPON (Mordenkainen's Sword)
  • RACE = SLIME
  • RACE = DRAGON
  • RACE = GOLEM
  • RACE = ELEMENTAL
  • RACE = MIST (unsure about this one, guess they should be treated as UNDEAD...? That is, they should have the same immunities...?)
  • RACE = WILL-O-WISP
  • SPLSTATE = FREE_ACTION
  • something else...?

Generally speaking (AFAICT), the problem does not lie in op109 usage vs op175 usage. The issue is that when something provides immunity (op101) to Hold, it almost always (always?) provides immunity to Paralyze (and vice-versa). And this is generally not correct.

And by the way, this is not limited to op109 and op175. All spells/abilities/items applying op5 (Charm creature), op76 (Feeblemindedness), op24 (Panic), op39 (Sleep – along with op217), op78 (Disease), op45 (Stun – along with op210), op216 (Level drain), etc... should receive a similar treatment...

So to sum up, and if you want, I can provide you with some code that fixes all these vanilla resources... Should be installed as an early tweak, so that subsequent mods that clone (take as a reference) these resources will automatically adapt... And mods that create such resources from scratch will hopefully adapt...

On 1/13/2022 at 3:49 PM, CamDawg said:

If I'm misunderstanding, and this is a lament that immunity to op39 blocks stuff it shouldn't: right there with you. It'd be nice to have a separate unconscious opcode but, until we do, anything that protects from sleep is also going to (unintentionally) partially block effects from Earthquake and Wing Buffet.

Yes, I was talking about this collateral issue.

I tried to fix it, but as you said, it's difficult to take into account all mod-added resources out there that do not respect certain canon features. It is highly likely they'll be misidentified by my code, so basically I should patch them manually (static list)... And when you cannot fully automate something, then that's somewhat bad...

So yes, you should come up with either another separate unconscious opcode, or tweak the existing op39 to behave as op24 (i.e., if parameter2 is set to 1, it bypasses/ignores op101 – example usage here. Also feel free to include it here for EE games). Guess that a third possibility (at least on EE games) could be to tweak opcode 337, i.e.: it should work with Timing Mode 0 (see "spwi818a.spl") and should not ignore effects using Timing Mode 9...

Edited by Luke
Link to comment
On 1/13/2022 at 3:49 PM, CamDawg said:

The EEs don't need to apply 16 EFFs for elven charm resistance; you just use a pair of 318/324s at the top of the effect stack.

Now that I think of it, is opcode 101 even needed on EE games...?

I mean, if everything is properly patched with op318/324, then op101 becomes redundant/useless, right...? Maybe only boss creatures (e.g. Demogorgon/Belhifet/etc...) should use it (just because they're boss creatures and thus should ignore the lore...? Not sure about this...)

Link to comment

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...