Jump to content


Photo

BG2 Modder Resource - Effect Batch Macros


18 replies to this topic

#16 Grammarsalad

Grammarsalad
  • Modders
  • 445 posts
  • Gender:Male

Posted 11 July 2017 - 04:19 PM

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 



#17 CamDawg

CamDawg

    Seven billion ton robot monster

  • Gibberling Poobah
  • 9222 posts
  • Gender:Not Telling

Posted 11 July 2017 - 04:44 PM

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.


I came here with a simple dream: a dream of killing all humans. And this is how it must end? Who's the real seven billion ton robot monster here? Not I. Not... I.


#18 Grammarsalad

Grammarsalad
  • Modders
  • 445 posts
  • Gender:Male

Posted 11 July 2017 - 10:46 PM

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, 16 July 2017 - 09:07 AM.


#19 Grammarsalad

Grammarsalad
  • Modders
  • 445 posts
  • Gender:Male

Posted 26 July 2017 - 08:47 PM

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.  




Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users