
/////////////////////////////////////////////////////////////////

DEFINE_ACTION_FUNCTION animals BEGIN

INCLUDE ~bp/lib/bp_main.tph~

LAF animal_scripts END


ACTION_IF NOT FILE_EXISTS_IN_GAME ~catjagsu.cre~ BEGIN
  COPY ~bp/cre/catjagsu.cre~ ~override~ //Panther
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
END

ACTION_IF NOT FILE_EXISTS_IN_GAME ~catjagwp.cre~ BEGIN
  COPY ~bp/cre/catjagwp.cre~ ~override~ //Panther
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
END

ACTION_IF FILE_EXISTS_IN_GAME ~catliosu.cre~ BEGIN
  COPY_EXISTING ~catliosu.cre~ ~override~ //Lion
    WRITE_BYTE 0x240 5 //Morale break (was 0)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  BUT_ONLY
END ELSE BEGIN
  COPY ~bp/cre/catliosu.cre~ ~override~
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
END

ACTION_IF FILE_EXISTS_IN_GAME ~catliowp.cre~ BEGIN
  COPY_EXISTING ~catliowp.cre~ ~override~ //Joolon
    WRITE_LONG 0x18 20 //Power level (was 0)
    WRITE_SHORT 0x24 45 //Current HP (was 107)
    WRITE_SHORT 0x26 45 //Maximum HP (was 107)
    WRITE_SHORT 0x46 6 //Natural AC (was 2)
    WRITE_SHORT 0x48 6 //Effective AC (was 2)
    WRITE_BYTE 0x52 15 //THAC0 (was 12)
    WRITE_BYTE 0x54 13 //Save vs death (was 8)
    WRITE_BYTE 0x55 15 //Save vs wands (was 12)
    WRITE_BYTE 0x56 14 //Save vs polymorph (was 8)
    WRITE_BYTE 0x57 16 //Save vs breath (was 12)
    WRITE_BYTE 0x58 16 //Save vs spells (was 12)
    WRITE_BYTE 0x5d 0 //Resist magic (was 10)
    WRITE_BYTE 0x234 5 //Level 1 (was 8)
    WRITE_BYTE 0x238 18 //Strength (was 19)
    WRITE_BYTE 0x23b 9 //Wisdom (was 11)
    WRITE_BYTE 0x23c 9 //Dexterity (was 14)
    WRITE_BYTE 0x23d 9 //Constitution (was 17)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    REPLACE_CRE_ITEM ~figring1~ #0 #0 #0 ~NONE~ ~RRING~
    REPLACE_CRE_ITEM ~catlio~ #0 #0 #0 ~NONE~ ~WEAPON1~ EQUIP
  BUT_ONLY
END ELSE BEGIN
  COPY ~bp/cre/catliowp.cre~ ~override~
END

ACTION_IF FILE_EXISTS_IN_GAME ~chetah1.cre~ BEGIN
  COPY_EXISTING ~chetah1.cre~ ~override~ //Cheetah
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    WRITE_BYTE 0x275 1 //Gender (was 6)
  BUT_ONLY
END ELSE BEGIN
  COPY ~bp/cre/chetah1.cre~ ~override~
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
END

ACTION_IF FILE_EXISTS_IN_GAME ~chetah2.cre~ BEGIN
  COPY_EXISTING ~chetah2.cre~ ~override~ //Cheetah
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    WRITE_BYTE 0x275 1 //Gender (was 6)
  BUT_ONLY
END ELSE BEGIN
  COPY ~bp/cre/chetah2.cre~ ~override~
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
END

ACTION_IF NOT FILE_EXISTS_IN_GAME ~leopard1.cre~ BEGIN  //TDD
  COPY ~bp/cre/leopard1.cre~ ~override~
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
END

ACTION_IF NOT FILE_EXISTS_IN_GAME ~leopard2.cre~ BEGIN //TDD
  COPY ~bp/cre/leopard2.cre~ ~override~
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
END

ACTION_IF NOT FILE_EXISTS_IN_GAME ~lion1.cre~ BEGIN //TDD
  COPY ~bp/cre/lion1.cre~ ~override~
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
END

ACTION_IF NOT FILE_EXISTS_IN_GAME ~lion2.cre~ BEGIN //TDD
  COPY ~bp/cre/lion2.cre~ ~override~
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
END

ACTION_IF NOT FILE_EXISTS_IN_GAME ~tiger1.cre~ BEGIN  // TDD
  COPY ~bp/cre/tiger1.cre~ ~override~
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
END

ACTION_IF NOT FILE_EXISTS_IN_GAME ~tiger2.cre~ BEGIN  // TDD
  COPY ~bp/cre/tiger2.cre~ ~override~
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
END


COPY_EXISTING ~wolfchar.cre~ ~override~ //Wolf
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    SAY NAME1 #6629 // LongName (~Wolf~)
    SAY NAME2 #6629 // ShortName (~Wolf~)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~wolfdi.cre~ ~override~ //Dire Wolf
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x260 ~~ #8 // General (was HUNTER)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~wolfdisu.cre~ ~override~ //Dire Wolf
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    WRITE_BYTE 0x275 1 // IDSGender (was 6)
    REMOVE_CRE_ITEM ~P1-8M1~
    REPLACE_CRE_ITEM ~P1-8~ #0 #0 #0 ~NONE~ ~WEAPON1~ EQUIP
  END
BUT_ONLY

COPY_EXISTING ~catche01.cre~ ~override~ //Cheetah
              ~catjag01.cre~ ~override~ //Panther
              ~catleo01.cre~ ~override~ //Leopard
              ~catlim01.cre~ ~override~ //Mountain Lion
              ~catlio01.cre~ ~override~ //Lion
              ~catlis01.cre~ ~override~ //Spotted Lion
              ~catlyn01.cre~ ~override~ //Giant Lynx
              ~catpan01.cre~ ~override~ //Panther
              ~cattig01.cre~ ~override~ //Wild Tiger
              ~dadog.cre~ ~override~    //Dog
              ~dogwar01.cre~ ~override~ //War Dog
              ~dogwil01.cre~ ~override~ //Wild Dog
              ~fsdog.cre~ ~override~    //War Dog
              ~glbear2.cre~ ~override~ //Black Bear
              ~nwolf.cre~ ~override~    //Wolf
              ~snake01.cre~ ~override~ //Snake
              ~snakeb01.cre~ ~override~ //Boalisk
              ~snakeg01.cre~ ~override~ //Giant Snake
              ~uddog.cre~ ~override~     //Wild Dog
              ~wolf01.cre~ ~override~   //Wolf
              ~wolfdi01.cre~ ~override~ //Dire Wolf
              ~wolfdr01.cre~ ~override~ //Dread Wolf
              ~wolfva01.cre~ ~override~ //Vampiric Wolf
              ~wolfwo01.cre~ ~override~ //Worg
              ~trevil05.cre~ ~override~ //Panther
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_ASCII 0x268 ~bpwdasgt~ #8
  END
BUT_ONLY

COPY_EXISTING ~dogwasu.cre~ ~override~ //War Dog
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x248 ~wardog~ #8 // Override (was NONE)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~plywolf.cre~ ~override~ //Wolf
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    SAY NAME1 #6629 // LongName (~Wolf~)
    SAY NAME2 #6629 // ShortName (~Wolf~)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~vorsquir.cre~ ~override~ //Vorpal Squirrel
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 5 // CurrHP (was 2)
    WRITE_SHORT 0x26 5 // MaxHP (was 2)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY


END

/////////////////////////////////////////////////////////////////////////////////////////
DEFINE_ACTION_FUNCTION beholders BEGIN

INCLUDE ~bp/lib/bp_main.tph~

LAF beholder_scripts END

COPY ~bp/cre/behspy01.cre~ ~override~
     ~bp/cre/behspy02.cre~ ~override~
     ~bp/cre/behspy03.cre~ ~override~
    WRITE_ASCII 0x250 ~cresht01~ #8
    WRITE_ASCII 0x268 ~bpgauth1~ #8

COPY ~bp/cre/hivemoth.cre~ ~override~
  SAY NAME1 @221 //Hive Mother
  SAY NAME2 @221 //Hive Mother
    WRITE_ASCII 0x248 ~cresht01~ #8
    WRITE_ASCII 0x258 ~bpbehhiv~ #8
    WRITE_ASCII 0x260 ~bpleader~ #8
    WRITE_ASCII 0x268 ~bpwdasgt~ #8

COPY ~bp/cre/gauthsu.cre~ ~override~
    WRITE_ASCII 0x248 ~cresht01~ #8
    WRITE_ASCII 0x260 ~bpgauth1~ #8
    WRITE_ASCII 0x268 ~bpwdasgt~ #8

COPY ~bp/cre/tyrorb.cre~ ~override~
  SAY NAME1 @251 //Death Tyrant
  SAY NAME2 @251 //Death Tyrant
    WRITE_ASCII 0x248 ~cresht01~ #8
    WRITE_ASCII 0x260 ~bpbehund~ #8
    WRITE_ASCII 0x268 ~bpwdasgt~ #8

COPY_EXISTING ~behdir01.cre~ ~override~ //Director
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x248 ~cresht01~ #8
    WRITE_ASCII 0x260 ~bpbehdir~ #8
    WRITE_ASCII 0x268 ~bpwdasgt~ #8
    WRITE_ASCII 0x280 ~behdir01~ #32 //Death variable
  END
BUT_ONLY

COPY_EXISTING ~beheld01.cre~ ~override~ //Elder Orb
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x248 ~cresht01~ #8
    WRITE_ASCII 0x260 ~bpbeheld~ #8
    WRITE_ASCII 0x268 ~bpwdasgt~ #8
    ADD_MEMORIZED_SPELL ~spwi112~ #0 ~wizard~ (5)
    ADD_MEMORIZED_SPELL ~spwi219~ #1 ~wizard~ (3)
    ADD_MEMORIZED_SPELL ~spwi311~ #2 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi408~ #3 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi509~ #4 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi609~ #5 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi611~ #5 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi612~ #5 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi702~ #6 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi716~ #6 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi813~ #7 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi815~ #7 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi898~ #7 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi909~ #8 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi912~ #8 ~wizard~
  END
BUT_ONLY

COPY_EXISTING ~behgau01.cre~ ~override~ //Gauth
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x248 ~cresht01~ #8
    WRITE_ASCII 0x260 ~bpgauth1~ #8
    WRITE_ASCII 0x268 ~bpwdasgt~ #8
  END
BUT_ONLY

COPY_EXISTING ~behhiv01.cre~ ~override~ //Hive Mother
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x248 ~cresht01~ #8
    WRITE_ASCII 0x258 ~bpleader~ #8
    WRITE_ASCII 0x260 ~bpbehhiv~ #8
    WRITE_ASCII 0x268 ~bpwdasgt~ #8
    ADD_MEMORIZED_SPELL ~spin477~ #0 ~innate~ (4)
    ADD_MEMORIZED_SPELL ~sppr607~ #5 ~priest~
    ADD_MEMORIZED_SPELL ~sppr613~ #5 ~priest~
    ADD_MEMORIZED_SPELL ~sppr698~ #5 ~priest~
    ADD_MEMORIZED_SPELL ~sppr711~ #6 ~priest~
    ADD_MEMORIZED_SPELL ~spwi219~ #1 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi408~ #3 ~wizard~ (3)
    ADD_MEMORIZED_SPELL ~spwi508~ #4 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi519~ #4 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi606~ #5 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi609~ #5 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi615~ #5 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi703~ #6 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi714~ #6 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi813~ #7 ~wizard~ (3)
    ADD_MEMORIZED_SPELL ~spwi907~ #8 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi910~ #8 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi913~ #8 ~wizard~
    LAUNCH_PATCH_FUNCTION DELETE_CRE_EFFECT
      INT_VAR opcode_to_delete = 52 //Color: Very Bright by RGB
    END
    LAUNCH_PATCH_FUNCTION ADD_CRE_EFFECT
      INT_VAR opcode = 52 //Color: Very Bright by RGB
      timing = 9 //Permanent after death
      target = 1 //Self
      parameter1 = 84215040 //Color designation (RGB 5,5,5)
      parameter2 = 2 //Major color
      resist_dispel = 2 //Not dispel/bypass
     END
  END
BUT_ONLY

COPY_EXISTING ~behold01.cre~ ~override~ //Beholder
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x260 ~~ #8
    WRITE_ASCII 0x268 ~bpbehold~ #8
  END
BUT_ONLY

COPY_EXISTING ~behspe01.cre~ ~override~ //Beholder
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x248 ~cresht01~ #8
    WRITE_ASCII 0x260 ~bpbehspe~ #8
    WRITE_ASCII 0x268 ~bpwdasgt~ #8
  END
BUT_ONLY

COPY_EXISTING ~behund01.cre~ ~override~ //Death Tyrant
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x248 ~cresht01~ #8
    WRITE_ASCII 0x260 ~bpbehund~ #8
    WRITE_ASCII 0x268 ~bpwdasgt~ #8
  END
BUT_ONLY

COPY_EXISTING ~bazgau01.cre~ ~override~ //Gauth
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x248 ~cresht01~ #8
    WRITE_ASCII 0x260 ~bpgauth1~ #8 // Default (was WTASIGHT)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8
  END
BUT_ONLY

COPY_EXISTING ~rngbeh01.cre~ ~override~ //Beholder
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x248 ~cresht01~ #8
    WRITE_ASCII 0x260 ~bpbehund~ #8 // Default (was WTASIGHT)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8
  END
BUT_ONLY

COPY_EXISTING ~udbeho01.cre~ ~override~ //Beholder
              ~udbeho02.cre~ ~override~ //Beholder
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x248 ~cresht01~ #8
    WRITE_ASCII 0x260 ~bpbehold~ #8 // Default (was WTASIGHT)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8
  END
BUT_ONLY

COPY_EXISTING ~udelder.cre~ ~override~ //Beholder
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x268 ~bpbeheld~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY


COPY_EXISTING ~hlhive.cre~ ~override~ //Hive Mother
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x248 ~cresht01~ #8
    WRITE_ASCII 0x258 ~bpbehhiv~ #8 // Race (was NONE)
    WRITE_ASCII 0x260 ~bpleader~ #8 // General (was BEHOLD01)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    ADD_MEMORIZED_SPELL ~sppr698~ #5 ~priest~
    ADD_MEMORIZED_SPELL ~sppr607~ #5 ~priest~
    ADD_MEMORIZED_SPELL ~sppr613~ #5 ~priest~
    ADD_MEMORIZED_SPELL ~sppr717~ #6 ~priest~
    ADD_MEMORIZED_SPELL ~spwi219~ #1 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi408~ #3 ~wizard~ (3)
    ADD_MEMORIZED_SPELL ~spwi508~ #4 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi519~ #4 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi615~ #5 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi609~ #5 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi606~ #5 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi714~ #6 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi703~ #6 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi813~ #7 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi803~ #7 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi907~ #8 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi910~ #8 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi913~ #8 ~wizard~
    ADD_MEMORIZED_SPELL ~spin477~ #0 ~innate~ (4)
  END
BUT_ONLY

COPY_EXISTING ~hlorb.cre~ ~override~ //Elder Orb
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x248 ~cresht01~ #8
    WRITE_ASCII 0x260 ~bpbeheld~ #8 // General (was BEHOLD01)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    ADD_MEMORIZED_SPELL ~spwi112~ #0 ~wizard~ (5)
    ADD_MEMORIZED_SPELL ~spwi219~ #1 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi311~ #2 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi408~ #3 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi509~ #4 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi612~ #5 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi609~ #5 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi611~ #5 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi716~ #6 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi702~ #6 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi813~ #7 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi815~ #7 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi898~ #7 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi912~ #8 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi909~ #8 ~wizard~
  END
BUT_ONLY



END

/////////////////////////////////////////////////////////////////////////////////////////
DEFINE_ACTION_FUNCTION demons BEGIN

INCLUDE ~bp/lib/bp_main.tph~
LAF demon_rules END


ACTION_IF FILE_EXISTS_IN_GAME ~errtu01.cre~ BEGIN
  COPY_EXISTING ~errtu01.cre~ ~override~ //Errtu
    WRITE_LONG 0x14 45120 //XP value (was 70000)
    WRITE_SHORT 0x46 ~-6~ //Natural AC (was 4)
    WRITE_SHORT 0x48 ~-6~ //Effective AC (was 0)
    WRITE_ASCII 0x250 ~tanari~ #8 //Class script
    WRITE_ASCII 0x268 ~bpdemon~ #8 //Default script (was wtasight)
  BUT_ONLY
END


ACTION_IF FILE_EXISTS_IN_GAME ~gelugon1.cre~ BEGIN
  COPY_EXISTING ~gelugon1.cre~ ~override~ //Gelugon
    LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
    PATCH_IF vl BEGIN
        WRITE_LONG 0x14 7640 //XP value (was 12000)
      WRITE_SHORT 0x46 ~-2~ //Natural AC (was 4)
      WRITE_SHORT 0x48 ~-2~ //Effective AC (was 2)
      WRITE_ASCII 0x250 ~bptanari~ #8 //Class script
      WRITE_ASCII 0x268 ~bpdemon~ #8 //Default script (was wtasight)
    END
  BUT_ONLY
END


COPY_EXISTING ~abisred1.cre~ ~override~ //Abishai
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 77
    WRITE_SHORT 0x26 77
    WRITE_SHORT 0x46 ~-2~
    WRITE_SHORT 0x48 ~-2~
    WRITE_ASCII 0x250 ~bptanari~ #8 //Class script
    WRITE_ASCII 0x268 ~bpdemon~ #8
  END
BUT_ONLY

COPY_EXISTING ~abydem01.cre~ ~override~ //Tanar'ri
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_ASCII 0x250 ~bptanari~ #8 //Class script
    WRITE_ASCII 0x260 ~~ #8
    WRITE_ASCII 0x268 ~bpdemon~ #8
  END
BUT_ONLY

COPY_EXISTING ~balor01.cre~ ~override~ //Balor
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x268 ~bpdemon~ #8
  END
BUT_ONLY

COPY_EXISTING ~cambion1.cre~ ~override~ //Cambion
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_SHORT 0x24 66 // CurrHP (was 60)
    WRITE_SHORT 0x26 66 // MaxHP (was 60)
    WRITE_BYTE 0x64 90 // DtectIll (was 0)
    WRITE_BYTE 0x68 90 // Stealth (was 0)
    // WRITE_BYTE 0x6e 2 // Unu0(Large swords prof) (was 0)
    // WRITE_BYTE 0x6f 2 // Unu1(Small swords prof) (was 0)
    // WRITE_BYTE 0x70 2 // Unu2(Bows prof) (was 0)
    // WRITE_BYTE 0x71 2 // Unu3(Spears prof) (was 0)
    // WRITE_BYTE 0x72 2 // Unu4(Blunt prof) (was 0)
    // WRITE_BYTE 0x73 2 // Unu5(Spiked prof) (was 0)
    // WRITE_BYTE 0x74 2 // Unu6(Axe prof) (was 0)
    // WRITE_BYTE 0x75 2 // Unu7(Missile prof) (was 0)
    WRITE_ASCII 0x260 ~~ #8 // General (was CTHIE20B)
    WRITE_ASCII 0x268 ~bpdemthf~ #8 // Default (was WTASIGHT)
    ADD_MEMORIZED_SPELL ~spin483~ #0 ~innate~ (5)
    LAUNCH_PATCH_FUNCTION ADD_CRE_EFFECT
      INT_VAR opcode = 233 //Color: Very Bright by RGB
      timing = 9 //Permanent after death
      target = 1 //Self
      parameter1 = 3 //Color designation (RGB 5,5,5)
      parameter2 = 89 //Bastard Sword
     END
  END
BUT_ONLY

COPY_EXISTING ~cambion2.cre~ ~override~ //Cambion
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x268 ~bpdemthf~ #8 // Default (was WTASIGHT)
    ADD_MEMORIZED_SPELL ~spin483~ #0 ~innate~ (5)
    LAUNCH_PATCH_FUNCTION ADD_CRE_EFFECT
      INT_VAR opcode = 233 //Color: Very Bright by RGB
      timing = 9 //Permanent after death
      target = 1 //Self
      parameter1 = 3 //Color designation (RGB 5,5,5)
      parameter2 = 89 //Bastard Sword
     END
  END
BUT_ONLY

COPY_EXISTING ~demabi01.cre~ ~override~ //Abishai
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    // SAY NAME1 #68105 // LongName (was 68104)
    WRITE_ASCII 0x250 ~bptanari~ #8 //Class script
    WRITE_ASCII 0x268 ~bpdemon~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~dembal01.cre~ ~override~ //Balor
              ~dembal02.cre~ ~override~ //Balor
              ~demgla01.cre~ ~override~ //Glabrezu
              ~demglab.cre~ ~override~ //Glabrezu
              ~demglab2.cre~ ~override~ //Glabrezu
              ~demglasu.cre~ ~override~ //Glabrezu
              ~demlord.cre~ ~override~ //Lesser Demon Lord
              ~demnab01.cre~ ~override~ //Nabassu
              ~demnabsu.cre~ ~override~ //Nabassu
              ~kdemon01.cre~ ~override~ //Cambion
              ~obsdem05.cre~ ~override~ //Nabassu
              ~rumar02.cre~ ~override~ //Nabassu
              ~udbalor.cre~ ~override~ //Balor
              ~udnaba.cre~ ~override~ //Nabassu
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x268 ~bpdemon~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~demgla01.cre~ ~override~ //Glabrezu
              ~demglab.cre~ ~override~ //Glabrezu
              ~demglab2.cre~ ~override~ //Glabrezu
              ~demglasu.cre~ ~override~ //Glabrezu
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x258 ~bpglabrz~ #8 // Default (was WTASIGHT)
    WRITE_ASCII 0x268 ~bpdemon~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~demcor01.cre~ ~override~ //Cornugon
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    // SAY NAME1 #68100 // LongName (was 68099)
    WRITE_ASCII 0x268 ~bpdemon~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~demmau01.cre~ ~override~ //Maurezhi
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    // SAY NAME1 #68360 // LongName (was 68359)
    WRITE_ASCII 0x250 ~bppri10a~ #8 // Class (was NONE)
    WRITE_ASCII 0x268 ~bpdemon~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~demnab02.cre~ ~override~ //Nabassu
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x248 ~bptanari~ #8 // Override (was DEMNAB02)
    WRITE_ASCII 0x268 ~bpdemon~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~demosum3.cre~ ~override~ //Glabrezu
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x248 ~bpglabrz~ #8 // Override (was GRPSHT01)
    WRITE_ASCII 0x268 ~bpdemon~ #8 // Default (was GLABREZ)
  END
BUT_ONLY

COPY_EXISTING ~dempit.cre~ ~override~ //Pit Fiend
              ~dempit01.cre~ ~override~ //Pit Fiend
              ~dempitsu.cre~ ~override~ //Pit Fiend
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_SHORT 0x24 100 // CurrHP (was 80)
    WRITE_SHORT 0x26 100 // MaxHP (was 80)
    WRITE_ASCII 0x268 ~bpdemon~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~demsuc01.cre~ ~override~ //Succubus
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x248 ~demsuc~ #8 // Override (was NONE)
    WRITE_ASCII 0x268 ~bpdemon~ #8 // Default (was DEMSUC)
  END
BUT_ONLY

COPY_EXISTING ~deriny01.cre~ ~override~ //Erinyes
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x248 ~erinyes~ #8 // Override (was NONE)
    WRITE_ASCII 0x268 ~bpdemon~ #8 // Default (was ERINYES)
  END
BUT_ONLY

ACTION_IF FILE_EXISTS_IN_GAME ~dembalr1.cre~ BEGIN
  COPY_EXISTING ~dembalr1.cre~ ~override~ //Balor
    WRITE_LONG 0x14 6500 //XP value (was 26000)
    WRITE_ASCII 0x268 ~bpdemon~ #8 //Default script (was wtasight)
  BUT_ONLY
END

ACTION_IF FILE_EXISTS_IN_GAME ~demnabr1.cre~ BEGIN
  COPY_EXISTING ~demnabr1.cre~ ~override~ //Nabassu
    WRITE_LONG 0x14 4640 //XP value (was 16000)
    WRITE_ASCII 0x268 ~bpdemon~ #8 //Default script (was wtasight)
  BUT_ONLY
END

ACTION_IF FILE_EXISTS_IN_GAME ~demnabr2.cre~ BEGIN
  COPY_EXISTING ~demnabr2.cre~ ~override~ //Nabassu
    WRITE_LONG 0x14 4260 //XP value (was 16000)
    WRITE_ASCII 0x268 ~bpdemon~ #8 //Default script (was wtasight)
  BUT_ONLY
END

COPY_EXISTING ~dglab01.cre~ ~override~ //Glabrezu
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x248 ~bpglabrz~ #8 // Override (was NONE)
    WRITE_ASCII 0x268 ~bpdemon~ #8 // Default (was GLABREZ)
  END
BUT_ONLY

COPY_EXISTING ~deaddem1.cre~ ~override~ //Cornugon
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x248 ~cornugon~ #8 // Override (was NONE)
    WRITE_ASCII 0x268 ~bpdemon~ #8 // Default (was CORNUGON)
  END
BUT_ONLY

COPY_EXISTING ~deathkni.cre~ ~override~ //Demon Knight
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x250 ~bpmag18a~ #8 // Class (was NONE)
    WRITE_ASCII 0x268 ~bpdemon~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~fangel01.cre~ ~override~ //Fallen Solar
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    // SAY NAME1 #73290 // LongName (was 68303)
    WRITE_ASCII 0x250 ~bpmag10b~ #8 // Class (was NONE)
    WRITE_ASCII 0x268 ~bpdemon~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~illcamb.cre~ ~override~ //Cambion
              ~illcamb2.cre~ ~override~ //Cambion
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_SHORT 0x24 55 // CurrHP (was 50)
    WRITE_SHORT 0x26 55 // MaxHP (was 50)
    WRITE_BYTE 0x64 70 // DtectIll (was 0)
    WRITE_BYTE 0x68 90 // Stealth (was 0)
    WRITE_ASCII 0x268 ~bpdemthf~ #8 // Default (was WTASIGHT)
    ADD_MEMORIZED_SPELL ~spcl423~ #0 ~innate~ (3)
    ADD_MEMORIZED_SPELL ~spin487~ #0 ~innate~ (3)
    ADD_MEMORIZED_SPELL ~spin483~ #0 ~innate~ (3)
  END
BUT_ONLY

COPY_EXISTING ~obsdem01.cre~ ~override~ //Lea'liyl
              ~tanari01.cre~ ~override~ //Tanar'ri
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_ASCII 0x260 ~bpdemon~ #8 // General (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~planet01.cre~ ~override~ //Planetar
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    // SAY NAME1 #63490 // LongName (was 63489)
    WRITE_ASCII 0x250 ~bpmag14d~ #8 // Class (was NONE)
    WRITE_ASCII 0x268 ~bpdemon~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~dbonef01.cre~ ~override~ //Bone Fiend
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    // SAY NAME1 #70639 // LongName (was 70638)
    WRITE_ASCII 0x268 ~bpdemon~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~icmarili.cre~ ~override~ //Marilith
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x28 57488 // AnimationID (was 0)
    WRITE_ASCII 0x268 ~bpdemon~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

ACTION_IF FILE_EXISTS_IN_GAME ~redabi.cre~ BEGIN  //TDD,used in BP
  COPY ~bp/cre/redabi01.cre~ ~override~
    SAY NAME1 @308 //Red Abishai
    SAY NAME2 @308 //Red Abishai
END

COPY_EXISTING ~yochlo01.cre~ ~override~ //Yochlol
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_BYTE 0x53 4 // NOAtt (was 2)
    WRITE_ASCII 0x268 ~bpdemon~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~uddeath.cre~ ~override~ //Demon Knight
              ~uddeath2.cre~ ~override~ //Demon Knight
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x250 ~bpmag18c~ #8 // Class (was NONE)
    WRITE_ASCII 0x268 ~bpdemon~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~uddemon.cre~ ~override~ //Lesser Demon Lord
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 160 // CurrHP (was 120)
    WRITE_SHORT 0x26 160 // MaxHP (was 120)
    WRITE_ASCII 0x268 ~bpdemon~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY


END

/////////////////////////////////////////////////////////////////////////////////////////
DEFINE_ACTION_FUNCTION djinni BEGIN

COPY_EXISTING ~sumdjinn.cre~ ~override~ //Djinni
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x248 ~bpsumdj~ #8 // Override (was GENSHT01)
    WRITE_ASCII 0x260 ~bpdjinni~ #8 // General (was )
    WRITE_ASCII 0x268 ~bpwzasgt~ #8 // General (was )
    WRITE_BYTE 0x275 6 // IDSGender (was 4)
  END
BUT_ONLY

COPY_EXISTING ~sumefree.cre~ ~override~ //Efreeti
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x248 ~~ #8 // Override (was GENSHT01)
    WRITE_ASCII 0x260 ~bpefreet~ #8 // General (was )
    WRITE_ASCII 0x268 ~bpwzasgt~ #8 // General (was )
  END
BUT_ONLY

COPY_EXISTING ~djinnisu.cre~ ~override~ //Djinni
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x260 ~bpdjinni~ #8 // General (was )
    WRITE_ASCII 0x268 ~bpwzasgt~ #8 // General (was )
  END
BUT_ONLY

COPY_EXISTING ~ppdjinn.cre~ ~override~ //Genie
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x250 ~bpdjinni~ #8 // Class (was NONE)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~ppdjinn2.cre~ ~override~ //Djinni
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x260 ~bpdjinni~ #8 // General (was NONE)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~gendji01.cre~ ~override~ //Djinni
              ~gendjn01.cre~ ~override~ //Djinni
              ~trgeni01.cre~ ~override~
              ~trgeni02.cre~ ~override~
              ~trgeni03.cre~ ~override~
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x248 ~humansht~ #8 // Override (was GENSHT01)
    WRITE_ASCII 0x260 ~bpdjinni~ #8 // General (was )
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // General (was )
  END
BUT_ONLY
              
COPY_EXISTING ~genefn01.cre~ ~override~ //Efreeti
              ~genefr01.cre~ ~override~ //Efreeti
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x248 ~humansht~ #8 // Override (was GENSHT01)
    WRITE_ASCII 0x260 ~bpefreet~ #8 // General (was )
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // General (was )
  END
BUT_ONLY
              
COPY_EXISTING ~ddguard1.cre~ ~override~
              ~ddguard2.cre~ ~override~
              ~ddguard3.cre~ ~override~
              ~ddguard4.cre~ ~override~
              ~ddguard5.cre~ ~override~
              ~ddguard6.cre~ ~override~
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x260 ~bpefreet~ #8 // General (was )
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // General (was )
  END
BUT_ONLY
              
COPY_EXISTING ~kgenie2.cre~ ~override~ //Genie
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x260 ~bpdao01~ #8 // General (was )
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // General (was )
  END
BUT_ONLY
              
COPY_EXISTING ~gendao01.cre~ ~override~ //Dao
              ~genie01.cre~ ~override~ //Genie
              ~genie02.cre~ ~override~ //Genie
              ~genie03.cre~ ~override~ //Genie
              ~genie04.cre~ ~override~ //Genie
              ~genie1.cre~ ~override~ //Genie
              ~kgenie1.cre~ ~override~ //Genie
              ~kgenie2.cre~ ~override~ //Genie
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x248 ~humansht~ #8 // Override (was GENSHT01)
    WRITE_ASCII 0x260 ~bpdao01~ #8 // General (was )
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // General (was )
  END
BUT_ONLY
              

ACTION_IF FILE_EXISTS_IN_GAME ~genietrv.cre~ BEGIN
  COPY_EXISTING ~genietrv.cre~ ~override~ //Genie
    WRITE_LONG 0x14 1875 //XP value (was 5000)
    WRITE_ASCII 0x248 ~humansht~ #8 // Override (was GENSHT01)
    WRITE_ASCII 0x250 ~dao01~ #8 //Class script (was none)
    WRITE_ASCII 0x268 ~wdasight~ #8 //Default script (was wtasight)
  BUT_ONLY
END ELSE BEGIN
  COPY ~bp/cre/genietrv.cre~ ~override~
    SAY NAME1 @213 //Genie
    SAY NAME2 @213 //Genie
    WRITE_ASCII 0x248 ~humansht~ #8 // Override (was GENSHT01)
END

ACTION_IF NOT FILE_EXISTS_IN_GAME ~bpwdasgt.bcs~ BEGIN
  ACTION_IF MOD_IS_INSTALLED ~setup-bp.tp2~ ~175~ BEGIN
    COMPILE ~bp/baf/shouts/no_strings_2/bpwdasgt.baf~
  END ELSE BEGIN
    COMPILE ~bp/baf/re-baf/core/bpwdasgt.baf~
  END
END

ACTION_IF NOT FILE_EXISTS_IN_GAME ~humansht.bcs~ BEGIN
  ACTION_IF MOD_IS_INSTALLED ~setup-bp.tp2~ ~175~ BEGIN
    COMPILE ~bp/baf/shouts/no_strings/humansht.baf~
  END ELSE BEGIN
    COMPILE ~bp/baf/shouts/strings/humansht.baf~
  END
END

ACTION_IF NOT FILE_EXISTS_IN_GAME ~bpwzasgt.bcs~ BEGIN
  ACTION_IF MOD_IS_INSTALLED ~setup-bp.tp2~ ~175~ BEGIN
    COMPILE ~bp/baf/shouts/no_strings_2/bpwzasgt.baf~
  END ELSE BEGIN
    COMPILE ~bp/baf/shouts/strings/bpwzasgt.baf~
  END
END 

ACTION_IF NOT FILE_EXISTS_IN_GAME ~bpdao01.bcs~ BEGIN
  COMPILE ~bp/baf/re-baf/misc/bpdao01.baf~
END

ACTION_IF NOT FILE_EXISTS_IN_GAME ~bpefreet.bcs~ BEGIN
  COMPILE ~bp/baf/re-baf/misc/bpefreet.baf~
END

ACTION_IF NOT FILE_EXISTS_IN_GAME ~bpdjinni.bcs~ BEGIN
  COMPILE ~bp/baf/re-baf/misc/bpdjinni.baf~
END

ACTION_IF NOT FILE_EXISTS_IN_GAME ~bpsumdj.bcs~ BEGIN
  COMPILE ~bp/baf/re-baf/misc/bpsumdj.baf~
END


END

/////////////////////////////////////////////////////////////////////////////////////////
DEFINE_ACTION_FUNCTION dragons BEGIN



COPY ~bp/cre/drag.cre~ ~override~
    WRITE_ASCII 0x258 ~bpdragbc~ #8 // Default (was WTASIGHT)
    WRITE_ASCII 0x258 ~bpmag10b~ #8 // Default (was WTASIGHT)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)

ACTION_IF FILE_EXISTS_IN_GAME ~dragtope.cre~ BEGIN
  COPY_EXISTING ~dragtope.cre~ ~override~ //Tapanasacar
    WRITE_LONG INITIAL_MEETING (0 - 1)
    WRITE_LONG BATTLE_CRY2 (0 - 1)
    WRITE_LONG BATTLE_CRY3 (0 - 1)
    WRITE_LONG BATTLE_CRY4 (0 - 1)
    WRITE_LONG BATTLE_CRY5 (0 - 1)
    WRITE_LONG ATTACK1 (0 - 1)
    WRITE_LONG ATTACK2 (0 - 1)
    WRITE_LONG ATTACK3 (0 - 1)
    WRITE_LONG DAMAGE (0 - 1)
    WRITE_LONG DYING (0 - 1)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    WRITE_BYTE 0x272 0x92 //Race (dragon)
    WRITE_BYTE 0x273 0xc0 //Class (silver_dragon)
    LAUNCH_PATCH_FUNCTION DELETE_CRE_EFFECT
      INT_VAR opcode_to_delete = 189 //Casting time modifier
    END
  BUT_ONLY
END ELSE BEGIN
  COPY ~bp/cre/dragtope.cre~ ~override~
    SAY NAME1 @190 //Tapanasacar
    SAY NAME2 @190 //Tapanasacar
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
END

ACTION_IF FILE_EXISTS_IN_GAME ~dragund.cre~ BEGIN
  COPY_EXISTING ~dragund.cre~ ~override~ //Icebraniken
    WRITE_LONG 0x14 38750 //XP value (was 0)
    PATCH_IF MOD_IS_INSTALLED ~setup-infinityanimations.tp2~ 0 BEGIN
      WRITE_SHORT 0x28 0x1100 //Animation (dragon_white_young)
    END
    WRITE_SHORT 0x46 ~-8~ //Natural AC (was -3)
    WRITE_SHORT 0x48 ~-8~ //Effective AC (was -3)
    WRITE_BYTE 0x53 3 //Attacks per round (was 3/2)
    WRITE_BYTE 0x5a 125 //Resist cold (was 0)
    WRITE_BYTE 0x5b 75 //Resist electricity (was 0)
    WRITE_BYTE 0x5d 35 //Resist magic (was 0)
    WRITE_BYTE 0x5f 125 //Resist magic cold (was 0)
    WRITE_BYTE 0x60 40 //Resist slashing (was 0)
    WRITE_BYTE 0x61 30 //Resist crushing (was 0)
    WRITE_BYTE 0x62 20 //Resist piercing (was 0)
    WRITE_BYTE 0x63 80 //Resist missile (was 0)
    WRITE_BYTE 0x271 0xff //Race (monster)
    WRITE_BYTE 0x272 0x92 //Race (dragon)
    WRITE_BYTE 0x273 0xbf //Class (shadow_dragon)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 //Default script (was wtasight)
    REMOVE_CRE_ITEM ~dragsha1~ ~dragund~
    ADD_CRE_ITEM ~dragsha1~ #0 #0 #0 ~NONE~ ~AMULET~
    ADD_CRE_ITEM ~dragund~ #0 #0 #0 ~NONE~ ~WEAPON1~ EQUIP
  BUT_ONLY
END

COPY_EXISTING ~dragblac.cre~ ~override~ //Nizidramanii'yt
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    SAY NAME1 #57927  // LongName (~Nizidramanii'yt~)
    SAY NAME2 #57927  // ShortName (~Nizidramanii'yt~)
    WRITE_ASCII 0x34 ~dragbls~ #8 // SmallPortrait (was NONE)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~dragbrow.cre~ ~override~ //
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    SAY NAME1 #57927  // LongName (~Nizidramanii'yt~)
    SAY NAME2 #57927  // ShortName (~Nizidramanii'yt~)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~dragpurp.cre~ ~override~ //Purple Dragon
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    // SAY NAME1 #72049 // LongName (was 72048)
    WRITE_ASCII 0x258 ~bpmag10b~ #8 // Race (was NONE)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~dragred.cre~ ~override~ //Red Dragon
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    SAY NAME1 #2576  // LongName (~Red Dragon~)
    SAY NAME2 #2576  // ShortName (~Red Dragon~)
    WRITE_ASCII 0x34 ~firks~ #8 // SmallPortrait (was NONE)
    WRITE_ASCII 0x248 ~bpdragre~ #8 // Override (was DRAGRED)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    REMOVE_KNOWN_SPELL ~spwi304~
    REMOVE_KNOWN_SPELL ~spwi305~
  END
BUT_ONLY

// Azazello (added BPSHADRA script)
// Dragon Behavior Fix: http://www.shsforums.net/index.php?showtopic=30038
COPY_EXISTING ~dragshad.cre~ ~override~ //Thaxll'ssillyia
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    SAY NAME1 #33905  // LongName (~Thaxll'ssillyia~)
    SAY NAME2 #33905  // ShortName (~Thaxll'ssillyia~)
    WRITE_ASCII 0x34 ~shads~ #8 // SmallPortrait (was NONE)
    WRITE_ASCII 0x248 ~bpshadra~ #8 // Override (was DRAGSHAD)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~dragsilv.cre~ ~override~ //Silver Dragon
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    SAY NAME1 #8454 // LongName (~Silver Dragon~)
    SAY NAME2 #8454 // ShortName (~Silver Dragon~)
    WRITE_ASCII 0x34 ~dragws~ #8 // SmallPortrait (was NONE)
    WRITE_SHORT 0x4c 4 // ACMissl (was -4)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~dragyell.cre~ ~override~ //Yellow Dragon
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    // SAY NAME1 #67124 // LongName (was 67123)
    WRITE_ASCII 0x250 ~bpmag10b~ #8 // Class (was NONE)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

ACTION_IF FILE_EXISTS_IN_GAME ~chrdrag.cre~ BEGIN
  COPY ~bp/cre/chrdrag.cre~ ~override~
    SAY NAME1 @175 //Chromatic Dragon
    SAY NAME2 @175 //Chromatic Dragon
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
END

COPY_EXISTING ~shadra01.cre~ ~override~ //Thaxll'ssillyia
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    SAY NAME1 #33905 // LongName (~Thaxll'ssillyia~)
    SAY NAME2 #33905 // ShortName (~Thaxll'ssillyia~)
    WRITE_SHORT 0x24 180 // CurrHP (was 160)
    WRITE_SHORT 0x26 180 // MaxHP (was 160)
    WRITE_ASCII 0x34 ~shads~ #8 // SmallPortrait (was NONE)
    WRITE_SHORT 0x4c 2 // ACMissl (was -2)
    WRITE_BYTE 0x242 0 // MrlReco (was 45)
    WRITE_LONG 0x244 1073741824 // KitInfo (was 0)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

ACTION_IF FILE_EXISTS_IN_GAME ~dd0012.are~ BEGIN
  COPY_EXISTING ~shadra01.cre~ ~override~ //Thaxll'ssillyia
    PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
      ADD_CRE_ITEM ~MINTRANM~ #0 #0 #0 ~NONE~ ~INV~
    END
BUT_ONLY
  END


COPY_EXISTING ~udsilver.cre~ ~override~ //Adalon
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    SAY NAME1 #4743 // LongName (~Adalon~)
    SAY NAME2 #4743 // ShortName (~Adalon~)
    WRITE_ASCII 0x34 ~dragws~ #8 // SmallPortrait (was NONE)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COMPILE ~bp/baf/re-baf/dragon~

ACTION_IF NOT FILE_EXISTS_IN_GAME ~bpwdasgt.bcs~ BEGIN
  ACTION_IF MOD_IS_INSTALLED ~setup-bp.tp2~ ~175~ BEGIN
    COMPILE ~bp/baf/shouts/no_strings_2/bpwdasgt.baf~
  END ELSE BEGIN
    COMPILE ~bp/baf/re-baf/core/bpwdasgt.baf~
  END
END

ACTION_IF NOT FILE_EXISTS_IN_GAME ~bpmag10b.bcs~ BEGIN
  COMPILE ~bp/baf/re-baf/core/bpmag10b.baf~
END


END


/////////////////////////////////////////////////////////////////////////////////////////
DEFINE_ACTION_FUNCTION drow BEGIN

INCLUDE ~bp/lib/bp_main.tph~

LAF drow_scripts END

COPY ~bp/cre/bpdrfm10.cre~ ~override~
     ~bp/cre/bpdrwa08.cre~ ~override~
     ~bp/cre/bpdrwa09.cre~ ~override~
     ~bp/cre/bpdrwz10.cre~ ~override~
     ~bp/cre/bpdrwz20.cre~ ~override~


ACTION_IF FILE_EXISTS_IN_GAME ~cavdrow1.cre~ BEGIN
  COPY_EXISTING ~cavdrow1.cre~ ~override~ //Drow
    WRITE_LONG 0x14 2125 //XP value (was 4000)
    WRITE_ASCII 0x268 ~bpwtsigt~ #8 
    WRITE_BYTE 0x27b 51 //Alignment (CE was 18 LN)
  BUT_ONLY
END

ACTION_IF FILE_EXISTS_IN_GAME ~cavdrow2.cre~ BEGIN
  COPY_EXISTING ~cavdrow2.cre~ ~override~ //Drow
    WRITE_LONG 0x14 2300 //XP value (was 4000)
    WRITE_BYTE 0x53 2 //Attacks per round (was 1)
    WRITE_BYTE 0x238 16 //Strength (was 9)
    WRITE_BYTE 0x23a 12 //Intelligence (was 9)
    WRITE_BYTE 0x23b 14 //Wisdom (was 9)
    WRITE_BYTE 0x23c 18 //Dexterity (was 9)
    WRITE_BYTE 0x23d 13 //Constitution (was 9)
    WRITE_BYTE 0x23e 16 //Charisma (was 9)
    WRITE_ASCII 0x268 ~bpwtsigt~ #8 
    WRITE_BYTE 0x27b 51 //Alignment (CE was 18 LN)
  BUT_ONLY
END

ACTION_IF FILE_EXISTS_IN_GAME ~cavdrow3.cre~ BEGIN
  COPY_EXISTING ~cavdrow3.cre~ ~override~ //Drow
    WRITE_LONG 0x14 2900 //XP value (was 4000)
    WRITE_BYTE 0x235 0 //Level 2 (was 10)
    WRITE_BYTE 0x236 0 //Level 3 (was 10)
    WRITE_ASCII 0x250 ~bppri10a~ #8 
    WRITE_ASCII 0x268 ~bpwtsigt~ #8 
    WRITE_BYTE 0x27b 51 //Alignment (CE was 0)
  BUT_ONLY
END


COPY_EXISTING ~dadrow1.cre~ ~override~ //Drow Servant
              ~dadrow14.cre~ ~override~ //Drow
              ~dadrow18.cre~ ~override~ //Spelljammer Drow
              ~dadrow21.cre~ ~override~ //Drow
              ~dadrow22.cre~ ~override~ //Drow
              ~dadrow25.cre~ ~override~ //Drow
              ~dadrow26.cre~ ~override~ //Drow
              ~dadrow6.cre~ ~override~ //Drow Leader
              ~dadrow3.cre~ ~override~ //Drow Slave Trader
              ~dadrow5.cre~ ~override~ //Drow Priestess
              ~dadrow7.cre~ ~override~ //Drow
              ~dadrow9.cre~ ~override~ //Drow Torturer
              ~daqilue.cre~ ~override~ //Qilue
              ~drofod03.cre~ ~override~ //Drow
              ~drofod04.cre~ ~override~ //Drow Priestess
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x268 ~bpwtsigt~ #8 
    WRITE_BYTE 0x274 5 
  END
BUT_ONLY

COPY_EXISTING ~dadrow2.cre~ ~override~ //Drow Servant
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_BYTE 0x52 13 // THAC0 (was 16)
    WRITE_ASCII 0x250 ~bpmag14c~ #8 
    WRITE_ASCII 0x268 ~bpwtsigt~ #8 
    WRITE_BYTE 0x274 5 // IDSSpecifc (was 10)
    REPLACE_CRE_ITEM ~DAGG05~ #20 #0 #0 ~NONE~ ~WEAPON2~
  END
BUT_ONLY

COPY_EXISTING ~dadrow4.cre~ ~override~ //Drow Servant
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_BYTE 0x52 13 // THAC0 (was 16)
    WRITE_ASCII 0x260 ~bppri12a~ #8 
    WRITE_ASCII 0x268 ~bpwtsigt~ #8 
    WRITE_BYTE 0x274 5 // IDSSpecifc (was 10)
    REPLACE_CRE_ITEM ~DAGG05~ #20 #0 #0 ~NONE~ ~WEAPON2~
  END
BUT_ONLY

COPY_EXISTING ~dadrow8.cre~ ~override~ //Drow Torturer
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x250 ~bpmage8a~ #8 // Class (was PRIET10B)
    WRITE_ASCII 0x268 ~bpwtsigt~ #8 
    WRITE_BYTE 0x274 5 // IDSSpecifc (was 0)
    REPLACE_CRE_ITEM ~DAGG02~ #0 #0 #0 ~NONE~ ~WEAPON1~ EQUIP
    REPLACE_CRE_ITEM ~DAGG05~ #20 #0 #0 ~NONE~ ~WEAPON2~
  END
BUT_ONLY

COPY_EXISTING ~dadrow9.cre~ ~override~ //Drow Torturer
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x268 ~bpwtsigt~ #8 
    WRITE_BYTE 0x274 5 // IDSSpecifc (was 0)
    REPLACE_CRE_ITEM ~RNDTRE02~ #0 #0 #0 ~NONE~ ~INV~
  END
BUT_ONLY

COPY_EXISTING ~dadrow10.cre~ ~override~ //Drow Torturer
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x250 ~bppri10b~ #8 // Class (was PRIET10B)
    WRITE_ASCII 0x268 ~bpwtsigt~ #8 
    WRITE_BYTE 0x274 5 // IDSSpecifc (was 0)
    REPLACE_CRE_ITEM ~RNDTRE02~ #0 #0 #0 ~NONE~ ~INV~
  END
BUT_ONLY

COPY_EXISTING ~dadrow11.cre~ ~override~ //Drow Torturer
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x260 ~bppri12a~ #8 // General (was WTARSGT)
    WRITE_ASCII 0x268 ~bpwtsigt~ #8 
    WRITE_BYTE 0x274 5 // IDSSpecifc (was 0)
    REPLACE_CRE_ITEM ~RNDTRE03~ #0 #0 #0 ~NONE~ ~INV~
  END
BUT_ONLY

COPY_EXISTING ~dadrow12.cre~ ~override~ //Overseer Handmaiden
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x250 ~bppri14t~ #8 // Class (was PRIET14T)
    WRITE_ASCII 0x260 ~bpleader~ #8 // General (was NONE)
    WRITE_ASCII 0x268 ~bpwtsigt~ #8 
    WRITE_BYTE 0x274 5 // IDSSpecifc (was 0)
  END
BUT_ONLY

COPY_EXISTING ~dadrow13.cre~ ~override~ //Drow
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x258 ~bpmag12b~ #8 // Race (was MAGE9A)
    WRITE_ASCII 0x268 ~bpwtsigt~ #8 
    WRITE_BYTE 0x274 5 // IDSSpecifc (was 0)
    REPLACE_CRE_ITEM ~STAF02~ #0 #0 #0 ~NONE~ ~WEAPON1~
    REPLACE_CRE_ITEM ~DART02~ #30 #0 #0 ~NONE~ ~WEAPON2~ EQUIP
  END
BUT_ONLY

COPY_EXISTING ~dadrow15.cre~ ~override~ //Drow
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x258 ~bpmage8a~ #8 // Race (was MAGE9A)
    WRITE_ASCII 0x268 ~bpwtsigt~ #8 
    WRITE_BYTE 0x274 5 // IDSSpecifc (was 0)
  END
BUT_ONLY

COPY_EXISTING ~dadrow16.cre~ ~override~ //Drow
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x250 ~bpmag14m~ #8 // General (was WTARSGT)
    WRITE_ASCII 0x260 ~bpwtrsgt~ #8 // General (was WTARSGT)
    WRITE_BYTE 0x274 5 // IDSSpecifc (was 0)
  END
BUT_ONLY

COPY_EXISTING ~dadrow17.cre~ ~override~ //Drow
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x260 ~bppri12a~ #8 // General (was WTARSGT)
    WRITE_ASCII 0x268 ~bpwtsigt~ #8 
    WRITE_BYTE 0x274 5 // IDSSpecifc (was 0)
    REPLACE_CRE_ITEM ~RNDTRE04~ #0 #0 #0 ~NONE~ ~INV~
  END
BUT_ONLY

COPY_EXISTING ~dadrow19.cre~ ~override~ //Drow
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x268 ~bpwtsigt~ #8 
    WRITE_BYTE 0x274 5 // IDSSpecifc (was 0)
    REPLACE_CRE_ITEM ~RNDTRE04~ #0 #0 #0 ~NONE~ ~INV~
  END
BUT_ONLY

COPY_EXISTING ~dadrow20.cre~ ~override~ //Drow
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x260 ~bppri12a~ #8 
    WRITE_ASCII 0x268 ~bpwtsigt~ #8 
  END
BUT_ONLY

COPY_EXISTING ~dadrow23.cre~ ~override~ //Drow
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x250 ~bpprt12b~ #8 
    WRITE_ASCII 0x268 ~bpwtsigt~ #8 
    WRITE_BYTE 0x274 5 // IDSSpecifc (was 0)
    REMOVE_MEMORIZED_SPELL ~sppr511~
    REMOVE_MEMORIZED_SPELL ~sppr607~
    REMOVE_MEMORIZED_SPELL ~sppr603~
    ADD_MEMORIZED_SPELL ~sppr599~ #4 ~priest~ (2)
    ADD_MEMORIZED_SPELL ~sppr607~ #5 ~priest~
    ADD_MEMORIZED_SPELL ~sppr698~ #5 ~priest~ (2)
  END
BUT_ONLY

COPY_EXISTING ~dadrow24.cre~ ~override~ //Drow
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x268 ~bpwtsigt~ #8 
    WRITE_BYTE 0x274 5 // IDSSpecifc (was 0)
    REPLACE_CRE_ITEM ~RNDTRE02~ #0 #0 #0 ~NONE~ ~INV~
  END
BUT_ONLY

COPY_EXISTING ~drofod01.cre~ ~override~ //Drow
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_BYTE 0x23c 19 // Dex (was 9)
    WRITE_ASCII 0x268 ~bpwtsigt~ #8 
    WRITE_BYTE 0x274 5 // IDSSpecifc (was 0)
  END
BUT_ONLY

COPY_EXISTING ~drofod02.cre~ ~override~ //Drow
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x268 ~bpwtsigt~ #8 
    WRITE_BYTE 0x274 5 // IDSSpecifc (was 0)
    REPLACE_CRE_ITEM ~STAF02~ #0 #0 #0 ~NONE~ ~WEAPON1~
    REPLACE_CRE_ITEM ~DART02~ #30 #0 #0 ~NONE~ ~WEAPON2~
  END
BUT_ONLY

COPY_EXISTING ~drofod03.cre~ ~override~ //Drow
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x260 ~bpcarc2b~ #8 
    WRITE_ASCII 0x268 ~bpwtsigt~ #8 
  END
BUT_ONLY

COPY_EXISTING ~drofod04.cre~ ~override~ //Drow
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x248 ~bpprst12~ #8 
    WRITE_ASCII 0x268 ~bpwtsigt~ #8 
  END
BUT_ONLY

COPY_EXISTING ~drow01.cre~ ~override~ //Drow
              ~drow02.cre~ ~override~ //Drow
              ~uddoor03.cre~ ~override~ //Drow
              ~uddoor07.cre~ ~override~ //Drow
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x268 ~bpwtsigt~ #8 
  END
BUT_ONLY

COPY_EXISTING ~drow03.cre~ ~override~ //Drow Wizard
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x260 ~bpmag10c~ #8 
    WRITE_ASCII 0x268 ~bpwtsigt~ #8 
    REPLACE_CRE_ITEM ~SLNG04~ #0 #0 #0 ~NONE~ ~WEAPON2~
    REPLACE_CRE_ITEM ~BULL03~ #40 #0 #0 ~NONE~ ~QUIVER1~
  END
BUT_ONLY

COPY_EXISTING ~drow04.cre~ ~override~ //Drow
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x260 ~bpprie8c~ #8 
    WRITE_ASCII 0x268 ~bpwtsigt~ #8 
  END
BUT_ONLY

COPY_EXISTING ~drow05.cre~ ~override~ //Drow
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x260 ~bppri12c~ #8 
    WRITE_ASCII 0x268 ~bpwtsigt~ #8 
  END
BUT_ONLY

COPY_EXISTING ~drow06.cre~ ~override~ //Drow
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x250 ~bpmag14d~ #8 
    WRITE_ASCII 0x268 ~bpwtsigt~ #8 
    WRITE_BYTE 0x274 5 // IDSSpecifc (was 0)
    REPLACE_CRE_ITEM ~DART01~ #30 #0 #0 ~NONE~ ~WEAPON2~
  END
BUT_ONLY

COPY_EXISTING ~drow07.cre~ ~override~ //Drow Priestess
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x260 ~bpprt12b~ #8 
    WRITE_ASCII 0x268 ~bpwtsigt~ #8 
    REMOVE_MEMORIZED_SPELL ~sppr511~
    REMOVE_MEMORIZED_SPELL ~sppr608~
    REMOVE_MEMORIZED_SPELL ~sppr603~
    REMOVE_MEMORIZED_SPELL ~sppr698~
    ADD_MEMORIZED_SPELL ~sppr599~ #4 ~priest~ (2)
    ADD_MEMORIZED_SPELL ~sppr699~ #5 ~priest~
    ADD_MEMORIZED_SPELL ~sppr698~ #5 ~priest~ (2)
  END
BUT_ONLY


COPY_EXISTING ~udardul.cre~ ~override~ //Matron Mother Ardulace
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x260 ~bppri18c~ #8 
    WRITE_ASCII 0x268 ~bpwtsigt~ #8 
    REMOVE_MEMORIZED_SPELL ~sppr511~
    REMOVE_MEMORIZED_SPELL ~sppr608~
    ADD_MEMORIZED_SPELL ~sppr599~ #4 ~priest~
    ADD_MEMORIZED_SPELL ~sppr699~ #5 ~priest~
  END
BUT_ONLY

COPY_EXISTING ~udchal.cre~ ~override~ //Chalinthra
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x260 ~bppri18c~ #8 
    WRITE_ASCII 0x268 ~bpwtsigt~ #8 
    WRITE_BYTE 0x274 5 // IDSSpecifc (was 0)
    REMOVE_MEMORIZED_SPELL ~sppr511~
    REMOVE_MEMORIZED_SPELL ~sppr603~
    REMOVE_MEMORIZED_SPELL ~sppr608~
    ADD_MEMORIZED_SPELL ~sppr599~ #4 ~priest~
    ADD_MEMORIZED_SPELL ~sppr698~ #5 ~priest~
    ADD_MEMORIZED_SPELL ~sppr699~ #5 ~priest~
  END
BUT_ONLY

COPY_EXISTING ~uddoor02.cre~ ~override~ //Drow
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x268 ~bpwtsigt~ #8 
    WRITE_BYTE 0x274 5 // IDSSpecifc (was 129)
  END
BUT_ONLY

COPY_EXISTING ~uddoor05.cre~ ~override~ //Drow Wizard
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_BYTE 0x5d 86 // RstMagc (was 0)
    WRITE_ASCII 0x250 ~bpmag18a~ #8 
    WRITE_ASCII 0x268 ~bpwtsigt~ #8 
    WRITE_BYTE 0x274 5 // IDSSpecifc (was 129)
    REPLACE_CRE_ITEM ~DAGG05~ #20 #0 #0 ~NONE~ ~WEAPON2~
  END
BUT_ONLY

COPY_EXISTING ~uddoor06.cre~ ~override~ //Drow Priestess
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_ASCII 0x260 ~bppri18a~ #8 
    WRITE_ASCII 0x268 ~bpwtsigt~ #8 
    WRITE_BYTE 0x274 5 // IDSSpecifc (was 129)
    REPLACE_CRE_ITEM ~DWBLUN01~ #0 #0 #0 ~NONE~ ~WEAPON1~ EQUIP
    REPLACE_CRE_ITEM ~DWSHLD01~ #0 #0 #0 ~NONE~ ~SHIELD~
    REPLACE_CRE_ITEM ~DWCHAN02~ #0 #0 #0 ~NONE~ ~ARMOR~
    REPLACE_CRE_ITEM ~HELM01~ #0 #0 #0 ~NONE~ ~HELMET~
    LAUNCH_PATCH_FUNCTION ADD_CRE_EFFECT
      INT_VAR opcode = 233 //Color: Very Bright by RGB
      timing = 9 //Permanent after death
      target = 1 //Self
      parameter1 = 1 //Color designation (RGB 5,5,5)
      parameter2 = 100 //Flail/Morning Star
     END
  END
BUT_ONLY


COPY_EXISTING ~uddoor08.cre~ ~override~ //Drow
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_BYTE 0x5d 78 // RstMagc (was 0)
    WRITE_BYTE 0x64 75 // DtectIll (was 0)
    WRITE_BYTE 0x68 95 // Stealth (was 100)
    WRITE_ASCII 0x258 ~bpdrow~ #8 // Race (was GPUSE)
    WRITE_ASCII 0x260 ~~ #8 // General (was THIEF14T)
    WRITE_ASCII 0x268 ~bpthief~ #8 // Default (was WTASIGHT)
    WRITE_BYTE 0x274 5 // IDSSpecifc (was 129)
    ADD_MEMORIZED_SPELL ~spcl423~ #0 ~innate~ (4)
    ADD_MEMORIZED_SPELL ~spin483~ #0 ~innate~ (4)
  END
BUT_ONLY

COPY_EXISTING ~uddoor09.cre~ ~override~ //Drow
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_BYTE 0x64 75 // DtectIll (was 0)
    WRITE_BYTE 0x68 95 // Stealth (was 100)
    WRITE_ASCII 0x258 ~bpdrow~ #8 // Race (was )
    WRITE_ASCII 0x260 ~~ #8 // General (was WTASIGHT)
    WRITE_ASCII 0x268 ~bpthief~ #8 // Default (was NONE)
    WRITE_BYTE 0x274 5 // IDSSpecifc (was 129)
    ADD_MEMORIZED_SPELL ~spcl423~ #0 ~innate~ (4)
    ADD_MEMORIZED_SPELL ~spin483~ #0 ~innate~ (4)
  END
BUT_ONLY

COPY_EXISTING ~uddrow01.cre~ ~override~ //Drow
              ~uddrow02.cre~ ~override~
              ~uddrow03.cre~ ~override~
              ~uddrow04.cre~ ~override~
              ~uddrow05.cre~ ~override~
              ~uddrow06.cre~ ~override~
              ~uddrow07.cre~ ~override~
              ~uddrow08.cre~ ~override~
              ~uddrow09.cre~ ~override~
              ~uddrow10.cre~ ~override~
              ~uddrow11.cre~ ~override~
              ~uddrow13.cre~ ~override~
              ~uddrow16.cre~ ~override~
              ~uddrow22.cre~ ~override~
              ~uddrow23.cre~ ~override~
              ~uddrow24.cre~ ~override~
              ~uddrow25.cre~ ~override~
              ~uddrow26.cre~ ~override~
              ~uddrow27.cre~ ~override~
              ~uddrow28.cre~ ~override~
              ~uddrow29.cre~ ~override~
              ~uddrow32.cre~ ~override~
              ~uddrow33.cre~ ~override~
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x268 ~bpwtsigt~ #8 
  END
BUT_ONLY

COPY_EXISTING ~uddrow12.cre~ ~override~ //Drow
              ~uddrow14.cre~ ~override~
              ~uddrow15.cre~ ~override~
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x260 ~bpprie6a~ #8 
    WRITE_ASCII 0x268 ~bpwtsigt~ #8 
    REPLACE_CRE_ITEM ~DART01~ #20 #0 #0 ~NONE~ ~WEAPON2~
  END
BUT_ONLY

COPY_EXISTING ~uddrow17.cre~ ~override~ //Drow
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x260 ~bpmag10b~ #8 
    WRITE_ASCII 0x268 ~bpwtsigt~ #8 
    WRITE_BYTE 0x274 5 // IDSSpecifc (was 0)
    REPLACE_CRE_ITEM ~DART01~ #20 #0 #0 ~NONE~ ~WEAPON2~
  END
BUT_ONLY

COPY_EXISTING ~uddrow18.cre~ ~override~ //Drow
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_BYTE 0x274 5 // IDSSpecifc (was 0)
    WRITE_ASCII 0x260 ~bpmag12a~ #8 
    WRITE_ASCII 0x268 ~bpwtsigt~ #8 
    REPLACE_CRE_ITEM ~DAGG05~ #20 #0 #0 ~NONE~ ~WEAPON2~
  END
BUT_ONLY

COPY_EXISTING ~uddrow19.cre~ ~override~ //Drow
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_BYTE 0x274 5 // IDSSpecifc (was 0)
    WRITE_ASCII 0x250 ~bpmag14d~ #8 
    WRITE_ASCII 0x268 ~bpwtsigt~ #8 
    REPLACE_CRE_ITEM ~DAGG05~ #20 #0 #0 ~NONE~ ~WEAPON2~
  END
BUT_ONLY

COPY_EXISTING ~uddrow20.cre~ ~override~ //Egg Guard
              ~uddrow21.cre~ ~override~ //Egg Guard
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 100 // CurrHP (was 10)
    WRITE_SHORT 0x26 100 // MaxHP (was 10)
    WRITE_ASCII 0x268 ~bpwtsigt~ #8 
  END
BUT_ONLY

COPY_EXISTING ~uddrow30.cre~ ~override~ //Drow
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    REPLACE_CRE_ITEM ~DAGG16~ #20 #0 #0 ~NONE~ ~WEAPON2~
    WRITE_ASCII 0x260 ~bpmag10b~ #8 
    WRITE_ASCII 0x268 ~bpwtsigt~ #8 
  END
BUT_ONLY

COPY_EXISTING ~uddrow31.cre~ ~override~ //Priestess of Lolth
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x260 ~bppri10a~ #8 
    WRITE_ASCII 0x268 ~bpwtsigt~ #8 
  END
BUT_ONLY

COPY_EXISTING ~uddrow34.cre~ ~override~ //Drow Wizard
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    REPLACE_CRE_ITEM ~DAGG05~ #20 #0 #0 ~NONE~ ~WEAPON2~
    WRITE_ASCII 0x260 ~bpmag10c~ #8 
    WRITE_ASCII 0x268 ~bpwtsigt~ #8 
  END
BUT_ONLY

COPY_EXISTING ~uddrow35.cre~ ~override~ //Priestess of Lolth
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x260 ~bpprie8b~ #8 
    WRITE_ASCII 0x268 ~bpwtsigt~ #8 
    WRITE_BYTE 0x274 5 // IDSSpecifc (was 77)
  END
BUT_ONLY

COPY_EXISTING ~uddrow36.cre~ ~override~ //Handmaiden of Lolth
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_BYTE 0x5d 76 // RstMagc (was 0)
    WRITE_ASCII 0x260 ~bpprt12b~ #8 
    WRITE_ASCII 0x268 ~bpwtsigt~ #8 
    WRITE_BYTE 0x274 5 // IDSSpecifc (was 77)
    REMOVE_MEMORIZED_SPELL ~sppr511~
    REMOVE_MEMORIZED_SPELL ~sppr608~
    REMOVE_MEMORIZED_SPELL ~sppr603~
    REMOVE_MEMORIZED_SPELL ~sppr698~
    ADD_MEMORIZED_SPELL ~sppr599~ #4 ~priest~ (2)
    ADD_MEMORIZED_SPELL ~sppr699~ #5 ~priest~
    ADD_MEMORIZED_SPELL ~sppr698~ #5 ~priest~ (2)
  END
BUT_ONLY

COPY_EXISTING ~uddrow50.cre~ ~override~ //Drow Wizard
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x248 ~bpmag20a~ #8
    WRITE_ASCII 0x268 ~bpwtsigt~ #8
    REPLACE_CRE_ITEM ~DART05~ #30 #0 #0 ~NONE~ ~WEAPON2~
  END
BUT_ONLY

COPY_EXISTING ~udimrae.cre~ ~override~ //Imrae
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x260 ~bpprt12b~ #8 
    WRITE_ASCII 0x268 ~bpwtsigt~ #8 
    REMOVE_MEMORIZED_SPELL ~sppr511~
    REMOVE_MEMORIZED_SPELL ~sppr608~
    REMOVE_MEMORIZED_SPELL ~sppr603~
    REMOVE_MEMORIZED_SPELL ~sppr698~
    ADD_MEMORIZED_SPELL ~sppr511~ #4 ~priest~
    ADD_MEMORIZED_SPELL ~sppr599~ #4 ~priest~
    ADD_MEMORIZED_SPELL ~sppr699~ #5 ~priest~
    ADD_MEMORIZED_SPELL ~sppr698~ #5 ~priest~ (2)
  END
BUT_ONLY

COPY_EXISTING ~udlesa.cre~ ~override~ //Lasaonar
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_BYTE 0x53 2 // NOAtt (was 1)
    WRITE_BYTE 0x5d 84 // RstMagc (was 0)
    WRITE_ASCII 0x268 ~cbwtasgt~ #8 // Default (was WTASIGHT)
    WRITE_BYTE 0x274 5 // IDSSpecifc (was 0)
    REMOVE_CRE_ITEM ~DWSW1H02~
  END
BUT_ONLY

COPY_EXISTING ~udphae01.cre~ ~override~ //Phaere
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x260 ~bppri12c~ #8 
    REMOVE_CRE_ITEM ~DWCHAN01~
    REPLACE_CRE_ITEM ~DWCHAN01~ #0 #0 #0 ~NONE~ ~ARMOR~
  END
BUT_ONLY

COPY_EXISTING ~udphae02.cre~ ~override~ //Phaere
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_BYTE 0x5d 76 // RstMagc (was 74)
    WRITE_ASCII 0x260 ~bppri12c~ #8 
    WRITE_ASCII 0x268 ~bpwtsigt~ #8 
    REMOVE_CRE_ITEM ~DWCHA01~ ~DWWHIP01~
    REPLACE_CRE_ITEM ~DWCHAN01~ #0 #0 #0 ~NONE~ ~ARMOR~
  END
BUT_ONLY


COPY_EXISTING ~udsola02.cre~ ~override~ //Solaufein
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_BYTE 0x53 2 // NOAtt (was 1)
    WRITE_ASCII 0x260 ~bp!plot~ #8 // General (was NONE)
  END
BUT_ONLY

COPY_EXISTING ~vicpri01.cre~ ~override~ //Handmaiden of Lolth
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x258 ~bpprt12b~ #8 
    WRITE_ASCII 0x268 ~bpwtsigt~ #8 
    REMOVE_MEMORIZED_SPELL ~sppr511~
    REMOVE_MEMORIZED_SPELL ~sppr603~
    ADD_MEMORIZED_SPELL ~sppr599~ #4 ~priest~
    ADD_MEMORIZED_SPELL ~sppr698~ #5 ~priest~
  END
BUT_ONLY



END


/////////////////////////////////////////////////////////////////////////////////////////
DEFINE_ACTION_FUNCTION duergar BEGIN

INCLUDE ~bp/lib/bp_main.tph~

LAF duergar_scripts END


COPY_EXISTING ~daduer1.cre~ ~override~ //Duergar
              ~daduer2.cre~ ~override~ //Duergar
              ~daduer3.cre~ ~override~ //Duergar
              ~daduer4.cre~ ~override~ //Duergar
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 43 // CurrHP (was 35)
    WRITE_SHORT 0x26 43 // MaxHP (was 35)
    WRITE_ASCII 0x260 ~bpduegar~ #8 // General (was NONE)
    WRITE_ASCII 0x268 ~bpdueall~ #8 // Default (was DUEWAR01)
    WRITE_BYTE 0x274 5 // IDSSpecifc (was 0)
    ADD_MEMORIZED_SPELL ~spin118~ #0 ~innate~ (3)
  END
BUT_ONLY


COPY_EXISTING ~duergar.cre~ ~override~ //Duergar
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x258 ~bpduegar~ #8 // Race (was NONE)
    WRITE_ASCII 0x268 ~bpdueall~ #8 // Default (was DUEWAR01)
    WRITE_BYTE 0x274 5 // IDSSpecifc (was 0)
    ADD_MEMORIZED_SPELL ~spin118~ #0 ~innate~ (3)
  END
BUT_ONLY

COPY_EXISTING ~duergar2.cre~ ~override~ //Duergar
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 54 // CurrHP (was 34)
    WRITE_SHORT 0x26 54 // MaxHP (was 34)
    WRITE_ASCII 0x250 ~bpduegar~ #8 // Class (was NONE)
    WRITE_ASCII 0x268 ~bpdueall~ #8 // Default (was DUEWAR01)
    WRITE_BYTE 0x274 5 // IDSSpecifc (was 0)
    ADD_MEMORIZED_SPELL ~spin118~ #0 ~innate~ (3)
  END
BUT_ONLY

COPY_EXISTING ~duergar3.cre~ ~override~ //Duergar
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 51 // CurrHP (was 41)
    WRITE_SHORT 0x26 51 // MaxHP (was 41)
    WRITE_ASCII 0x258 ~bpduegar~ #8 // Race (was NONE)
    WRITE_ASCII 0x268 ~bpdueall~ #8 // Default (was DUEWAR01)
    WRITE_BYTE 0x274 5 // IDSSpecifc (was 0)
  END
BUT_ONLY

COPY_EXISTING ~reckon.cre~ ~override~ //Duergar
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x258 ~bpduegar~ #8 // Race (was NONE)
    WRITE_ASCII 0x268 ~bpdueall~ #8 // Default (was DUEWAR01)
    WRITE_BYTE 0x274 5 // IDSSpecifc (was 0)
    ADD_MEMORIZED_SPELL ~spin118~ #0 ~innate~ (3)
  END
BUT_ONLY

COPY_EXISTING ~sewdue01.cre~ ~override~ //Duergar Sapper
              ~sewdue02.cre~ ~override~ //Duergar Sapper
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x250 ~humansht~ #8
    WRITE_ASCII 0x258 ~bpduegar~ #8 // Race (was NONE)
    WRITE_ASCII 0x268 ~bpdueall~ #8 // Default (was CFIGH20B)
    WRITE_BYTE 0x274 5 // IDSSpecifc (was 234)
    ADD_MEMORIZED_SPELL ~spin118~ #0 ~innate~ (3)
  END
BUT_ONLY

COPY_EXISTING ~uddear02.cre~ ~override~ //Uder Mordin
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_BYTE 0x64 25 // DtectIll (was 0)
    WRITE_BYTE 0x68 45 // Stealth (was 0)
    WRITE_BYTE 0x235 6 // HighestLevelSecond (was 1)
    WRITE_ASCII 0x268 ~bpthief~ #8 // Default (was WTASIGHT)
    ADD_MEMORIZED_SPELL ~spin483~ #0 ~innate~ (2)
    ADD_MEMORIZED_SPELL ~spin118~ #0 ~innate~ (3)
  END
BUT_ONLY

COPY_EXISTING ~uddear03.cre~ ~override~ //Finderlig
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x250 ~bpduegar~ #8 // Class (was NONE)
    WRITE_ASCII 0x268 ~bpdueall~ #8 // Default (was DUEWAR01)
    REPLACE_CRE_ITEM ~BLUN04~ #0 #0 #0 ~NONE~ ~WEAPON1~
  END
BUT_ONLY

COPY_EXISTING ~udduer01.cre~ ~override~ //Carlig
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_BYTE 0x5d 68 // RstMagc (was 0)
    WRITE_ASCII 0x250 ~bpduegar~ #8 // Class (was NONE)
    WRITE_ASCII 0x258 ~bpprie8a~ #8 // Default (was WTASIGHT)
    WRITE_ASCII 0x260 ~bpthief~ #8 // Default (was WTASIGHT)
    WRITE_ASCII 0x268 ~bpdueall~ #8 // Default (was DUEWAR01)
    ADD_MEMORIZED_SPELL ~spin118~ #0 ~innate~ (3)
  END
BUT_ONLY


END


/////////////////////////////////////////////////////////////////////////////////////////





/////////////////////////////////////////////////////////////////////////////////////////
DEFINE_ACTION_FUNCTION duergar_irenicus BEGIN

INCLUDE ~bp/lib/bp_main.tph~

LAF duergar_scripts END


COPY_EXISTING ~duecla01.cre~ ~override~ //Ilyich
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x248 ~ilyich~ #8 // Class (was NONE)
    WRITE_ASCII 0x250 ~bp!plot~ #8 // Class (was NONE)
    WRITE_ASCII 0x268 ~bpdueall~ #8 // Class (was NONE)
    WRITE_BYTE 0x274 5 // IDSSpecifc (was 0)
    WRITE_BYTE 0x27b 19 // Alignment (was 18)
    ADD_MEMORIZED_SPELL ~spin118~ #0 ~innate~ (4)
  END
BUT_ONLY

COPY ~bp/cre/duecla02.cre~ ~override~
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x268 ~bpdueall~ #8 // Class (was NONE)
    ADD_MEMORIZED_SPELL ~spin118~ #0 ~innate~ (4)
  END
BUT_ONLY

COPY_EXISTING ~duearc01.cre~ ~override~ //Duergar
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_ASCII 0x248 ~bpduearc~ #8 // Override (was SHOUT)
    WRITE_ASCII 0x268 ~bpdueall~ #8 // Default (was DUEARC01)
    WRITE_BYTE 0x274 5 // IDSSpecifc (was 0)
    WRITE_BYTE 0x27b 19 // Alignment (was 18)
    WRITE_ASCII 0x280 ~duearc01~ #32 // DeathVariable (was NONE)
    ADD_MEMORIZED_SPELL ~spin118~ #0 ~innate~ (3)
  END
BUT_ONLY

COPY_EXISTING ~duergar1.cre~ ~override~ //Duergar
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x250 ~bpduegar~ #8 // Class (was SHOUT)
    WRITE_ASCII 0x268 ~bpdueall~ #8 // Default (was DUEWAR01)
    WRITE_BYTE 0x274 5 // IDSSpecifc (was 0)
    ADD_MEMORIZED_SPELL ~spin118~ #0 ~innate~ (3)
  END
BUT_ONLY

COPY_EXISTING ~duemag01.cre~ ~override~ //Mage
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x248 ~bpduemag~ #8 // Override (was SHOUT)
    WRITE_ASCII 0x258 ~bpmage8~ #8 // Race (was DUEMAG02)
    WRITE_ASCII 0x268 ~bpdueall~ #8 // Default (was DUEMAG01)
    WRITE_BYTE 0x272 4 // IDSRace (was 1)
    WRITE_BYTE 0x274 5 // IDSSpecifc (was 0)
    WRITE_BYTE 0x27b 19 // Alignment (was 18)
    REMOVE_MEMORIZED_SPELL ~spwi112~
    REMOVE_MEMORIZED_SPELL ~spwi217~
    REMOVE_MEMORIZED_SPELL ~spwi303~
    REMOVE_MEMORIZED_SPELL ~spwi112~
    ADD_MEMORIZED_SPELL ~spwi112~ #0 ~wizard~ (5)
    ADD_MEMORIZED_SPELL ~spwi217~ #1 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi303~ #2 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi305~ #2 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi408~ #3 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi401~ #3 ~wizard~
    ADD_MEMORIZED_SPELL ~spin118~ #0 ~innate~ (3)
    REPLACE_CRE_ITEM ~BULL01~ #20 #0 #0 ~NONE~ ~QUIVER2~
  END
BUT_ONLY

COPY_EXISTING ~duemag02.cre~ ~override~ //Mage
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x250 ~bpmage8~ #8 // Class (was NONE)
    WRITE_ASCII 0x258 ~bpduemag~ #8 // Race (was NONE)
    WRITE_ASCII 0x268 ~bpdueall~ #8 // Default (was DUEMAG01)
    WRITE_BYTE 0x27b 19 // Alignment (was 18)
    REMOVE_MEMORIZED_SPELL ~spwi112~
    REMOVE_MEMORIZED_SPELL ~spwi217~
    REMOVE_MEMORIZED_SPELL ~spwi303~
    REMOVE_MEMORIZED_SPELL ~spwi112~
    ADD_MEMORIZED_SPELL ~spwi112~ #0 ~wizard~ (5)
    ADD_MEMORIZED_SPELL ~spwi217~ #1 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi303~ #2 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi305~ #2 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi401~ #3 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi408~ #3 ~wizard~
    ADD_MEMORIZED_SPELL ~spin118~ #0 ~innate~ (3)
    REPLACE_CRE_ITEM ~BULL01~ #20 #0 #0 ~NONE~ ~QUIVER2~
  END
BUT_ONLY

ACTION_IF NOT FILE_EXISTS_IN_GAME ~duearc02.cre~ BEGIN
  COPY ~bp/cre/duearc02.cre~ ~override~
    PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
      WRITE_ASCII 0x268 ~bpdueall~ #8 // Default (was DUEWAR01)
    END
  BUT_ONLY
END

ACTION_IF NOT FILE_EXISTS_IN_GAME ~duearc03.cre~ BEGIN
  COPY ~bp/cre/duearc03.cre~ ~override~
    PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
      WRITE_ASCII 0x268 ~bpdueall~ #8 // Default (was DUEWAR01)
    END
  BUT_ONLY
END

ACTION_IF NOT FILE_EXISTS_IN_GAME ~duearc04.cre~ BEGIN
  COPY ~bp/cre/duearc04.cre~ ~override~
    PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
      WRITE_ASCII 0x268 ~bpdueall~ #8 // Default (was DUEWAR01)
    END
  BUT_ONLY
END

ACTION_IF NOT FILE_EXISTS_IN_GAME ~duepre01.cre~ BEGIN
  COPY ~bp/cre/duepre01.cre~ ~override~
    PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
      WRITE_ASCII 0x268 ~bpdueall~ #8 // Default (was DUEWAR01)
    END
  BUT_ONLY
END

COPY_EXISTING ~duegau01.cre~ ~override~ //Duergar
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x248 ~duegau01~ #8 // Override (was SHOUT)
    WRITE_ASCII 0x258 ~bpduegau~ #8 // Race (was DUEGAU01)
    WRITE_ASCII 0x268 ~bpdueall~ #8 // Default (was DUEWAR01)
    WRITE_BYTE 0x274 5 // IDSSpecifc (was 0)
    WRITE_BYTE 0x27b 19 // Alignment (was 18)
    WRITE_ASCII 0x280 ~duegau01~ #32 // DeathVariable (was NONE)
    ADD_MEMORIZED_SPELL ~spin118~ #0 ~innate~ (3)
  END
BUT_ONLY

COPY_EXISTING ~duegau02.cre~ ~override~ //Duergar
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x248 ~duegau02~ #8 // Override (was SHOUT)
    WRITE_ASCII 0x258 ~bpduega2~ #8 // Race (was DUEGAU02)
    WRITE_ASCII 0x268 ~bpdueall~ #8 // Default (was DUEWAR01)
    WRITE_BYTE 0x274 5 // IDSSpecifc (was 0)
    WRITE_BYTE 0x27b 19 // Alignment (was 18)
    WRITE_ASCII 0x280 ~duegau02~ #32 // DeathVariable (was NONE)
    ADD_MEMORIZED_SPELL ~spin118~ #0 ~innate~ (3)
  END
BUT_ONLY


END


/////////////////////////////////////////////////////////////////////////////////////////
DEFINE_ACTION_FUNCTION elementals BEGIN

INCLUDE ~bp/lib/bp_main.tph~

LAF elemental_scripts END

COPY_EXISTING ~elair01.cre~ ~override~ //Air Elemental
              ~elairg01.cre~ ~override~ //Greater Air Elemental
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x260 ~~ #8 // General (was AIRELE01)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~elairl01.cre~ ~override~ //Lesser Air Elemental
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_BYTE 0x52 10 // THAC0 (was 13)
    WRITE_BYTE 0x238 18 // Str (was 19)
    WRITE_BYTE 0x239 51 // StrBon (was 0)
    WRITE_ASCII 0x260 ~~ #8 // General (was AIRELE01)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~elairsu1.cre~ ~override~ //Air Elemental
              ~elairsuw.cre~ ~override~ //Air Elemental
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_BYTE 0x238 18 // Str (was 19)
    WRITE_BYTE 0x239 51 // StrBon (was 0)
    WRITE_ASCII 0x268 ~bpwzasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~elairsu2.cre~ ~override~ //Air Elemental
              ~elairsu3.cre~ ~override~ //Air Elemental
              ~suair.cre~ ~override~ //Air Elemental
              ~suearth.cre~ ~override~ //Earth Elemental
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_BYTE 0x53 2 // NOAtt (was 1)
    WRITE_ASCII 0x268 ~bpwzasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~elaril01.cre~ ~override~ //Lesser Air Elemental
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_BYTE 0x53 7 // NOAtt (was 1)
    WRITE_BYTE 0x238 18 // Str (was 19)
    WRITE_BYTE 0x239 51 // StrBon (was 0)
    WRITE_ASCII 0x260 ~~ #8 // General (was AIRELE01)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~elear01.cre~ ~override~ //Earth Elemental
              ~udearth.cre~ ~override~ //Earth Elemental
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_BYTE 0x53 2 // NOAtt (was 1)
    WRITE_BYTE 0x234 12 // HighestLevelPrimary (was 10)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~elearg01.cre~ ~override~ //Greater Earth Elemental
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x46 0 // ACNatul (was 2)
    WRITE_SHORT 0x48 0 // ACEffec (was 2)
    WRITE_BYTE 0x53 2 // NOAtt (was 1)
    WRITE_BYTE 0x234 16 // HighestLevelPrimary (was 10)
    WRITE_BYTE 0x238 20 // Str (was 19)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~elearl01.cre~ ~override~ //Lesser Earth Elemental
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_BYTE 0x52 12 // THAC0 (was 13)
    WRITE_BYTE 0x53 7 // NOAtt (was 1)
    WRITE_BYTE 0x234 8 // HighestLevelPrimary (was 10)
    WRITE_BYTE 0x238 18 // Str (was 19)
    WRITE_BYTE 0x239 51 // StrBon (was 0)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~eleeel01.cre~ ~override~ //Lesser Earth Elemental
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x46 4 // ACNatul (was 2)
    WRITE_SHORT 0x48 4 // ACEffec (was 2)
    WRITE_BYTE 0x52 12 // THAC0 (was 13)
    WRITE_BYTE 0x53 7 // NOAtt (was 1)
    WRITE_BYTE 0x234 9 // HighestLevelPrimary (was 10)
    WRITE_BYTE 0x238 18 // Str (was 19)
    WRITE_BYTE 0x239 51 // StrBon (was 0)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~elefel01.cre~ ~override~ //Lesser Fire Elemental
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x46 4 // ACNatul (was 2)
    WRITE_SHORT 0x48 4 // ACEffec (was 2)
    WRITE_BYTE 0x53 7 // NOAtt (was 1)
    WRITE_BYTE 0x234 8 // HighestLevelPrimary (was 10)
    WRITE_BYTE 0x238 18 // Str (was 19)
    WRITE_BYTE 0x239 51 // StrBon (was 0)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~elemcryo.cre~ ~override~ //Cryonax
              ~finsol03.cre~ ~override~ //Cryonax
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    // SAY NAME1 #72807 // LongName (was 72806)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~elemhydr.cre~ ~override~ //Olhydra
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    // SAY NAME1 #73886 // LongName (was 73885)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~elemimix.cre~ ~override~ //Imix
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    // SAY NAME1 #72776 // LongName (was 72775)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~elemogre.cre~ ~override~ //Ogremoch
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    // SAY NAME1 #72801 // LongName (was 72800)
    WRITE_SHORT 0x24 425 // CurrHP (was 220)
    WRITE_SHORT 0x26 425 // MaxHP (was 220)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~elemyanc.cre~ ~override~ //Yan-C-Bin
              ~finsol02.cre~ ~override~ //Yan-C-Bin
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    // SAY NAME1 #72805 // LongName (was 72804)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~elemzaam.cre~ ~override~ //Zaaman Rul
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    // SAY NAME1 #72811 // LongName (was 72810)
    WRITE_ASCII 0x268 ~wgarsgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~elfir.cre~ ~override~ //Fire Elemental
              ~elfir01.cre~ ~override~ //Fire Elemental
              ~sufire.cre~ ~override~ //Fire Elemental
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_BYTE 0x53 2 // NOAtt (was 1)
    WRITE_BYTE 0x238 19 // Str (was 9)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~elfirg01.cre~ ~override~ //Greater Fire Elemental
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x46 0 // ACNatul (was 2)
    WRITE_SHORT 0x48 0 // ACEffec (was 2)
    WRITE_BYTE 0x52 6 // THAC0 (was 5)
    WRITE_BYTE 0x238 20 // Str (was 19)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~elfirl01.cre~ ~override~ //Lesser Fire Elemental
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x46 4 // ACNatul (was 2)
    WRITE_SHORT 0x48 4 // ACEffec (was 2)
    WRITE_BYTE 0x53 7 // NOAtt (was 1)
    WRITE_BYTE 0x238 18 // Str (was 19)
    WRITE_BYTE 0x239 51 // StrBon (was 0)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~elfirpr.cre~ ~override~ //Fire Elemental
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_BYTE 0x238 19 // Str (was 18)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~elwatg01.cre~ ~override~ //Greater Water Elemental
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_BYTE 0x52 6 // THAC0 (was 5)
    WRITE_BYTE 0x238 20 // Str (was 19)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~kearth.cre~ ~override~ //Earth Elemental
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x46 4 // ACNatul (was 2)
    WRITE_SHORT 0x48 4 // ACEffec (was 2)
    WRITE_BYTE 0x52 13 // THAC0 (was 9)
    WRITE_BYTE 0x53 7 // NOAtt (was 1)
    WRITE_BYTE 0x234 8 // HighestLevelPrimary (was 10)
    WRITE_BYTE 0x238 18 // Str (was 19)
    WRITE_BYTE 0x239 51 // StrBon (was 0)
    WRITE_ASCII 0x248 ~~ #8 // General (was a shout)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY
COPY_EXISTING ~mdair.cre~ ~override~ //Air Elemental
              ~mdair2.cre~ ~override~ //Air Elemental
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_BYTE 0x53 2 // NOAtt (was 1)
    WRITE_ASCII 0x260 ~~ #8 // General (was AIRELE01)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~mdairg.cre~ ~override~ //Greater Air Elemental
              ~mdhsss.cre~ ~override~ //Greater Air Elemental
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x46 0 // ACNatul (was 2)
    WRITE_SHORT 0x48 0 // ACEffec (was 2)
    WRITE_BYTE 0x53 8 // NOAtt (was 1)
    WRITE_BYTE 0x238 20 // Str (was 19)
    WRITE_ASCII 0x260 ~~ #8 // General (was AIRELE01)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~mdairg2.cre~ ~override~ //Greater Air Elemental
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x46 0 // ACNatul (was 2)
    WRITE_SHORT 0x48 0 // ACEffec (was 2)
    WRITE_BYTE 0x52 6 // THAC0 (was 5)
    WRITE_BYTE 0x53 8 // NOAtt (was 1)
    WRITE_BYTE 0x238 20 // Str (was 19)
    WRITE_ASCII 0x260 ~~ #8 // General (was AIRELE01)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~mdearth.cre~ ~override~ //Earth Elemental
              ~mdearth2.cre~ ~override~ //Earth Elemental
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x46 ~-2~ // ACNatul (was 2)
    WRITE_SHORT 0x48 ~-2~ // ACEffec (was 2)
    WRITE_BYTE 0x52 5 // THAC0 (was 0)
    WRITE_BYTE 0x53 8 // NOAtt (was 1)
    WRITE_BYTE 0x238 21 // Str (was 20)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~mekear01.cre~ ~override~ //Lesser Earth Elemental
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x46 4 // ACNatul (was 2)
    WRITE_SHORT 0x48 4 // ACEffec (was 2)
    WRITE_BYTE 0x53 7 // NOAtt (was 1)
    WRITE_BYTE 0x234 8 // HighestLevelPrimary (was 10)
    WRITE_BYTE 0x238 18 // Str (was 19)
    WRITE_BYTE 0x239 51 // StrBon (was 0)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~obsfir06.cre~ ~override~ //Greater Fire Elemental
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x46 0 // ACNatul (was 2)
    WRITE_SHORT 0x48 0 // ACEffec (was 2)
    WRITE_BYTE 0x53 8 // NOAtt (was 1)
    WRITE_BYTE 0x234 16 // HighestLevelPrimary (was 10)
    WRITE_BYTE 0x238 20 // Str (was 19)
    WRITE_ASCII 0x268 ~bpwzasgt~ #8 // Default (was )
  END
BUT_ONLY

COPY_EXISTING ~pairel01.cre~ ~override~ //Air Elemental
              ~udair.cre~ ~override~ //Air Elemental
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_BYTE 0x53 2 // NOAtt (was 1)
    WRITE_BYTE 0x234 12 // HighestLevelPrimary (was 10)
    WRITE_ASCII 0x260 ~~ #8 // General (was AIRELE01)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was )
  END
BUT_ONLY

COPY_EXISTING ~suelew1.cre~ ~override~ //Greater Fire Elemental
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x46 0 // ACNatul (was 2)
    WRITE_SHORT 0x48 0 // ACEffec (was 2)
    WRITE_BYTE 0x53 8 // NOAtt (was 1)
    WRITE_BYTE 0x234 16 // HighestLevelPrimary (was 10)
    WRITE_BYTE 0x238 20 // Str (was 19)
    WRITE_ASCII 0x248 ~~ #8 // General (was AIRELE01)
    WRITE_ASCII 0x268 ~bpwzasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~suelew2.cre~ ~override~ //Greater Fire Elemental
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x46 0 // ACNatul (was 2)
    WRITE_SHORT 0x48 0 // ACEffec (was 2)
    WRITE_BYTE 0x52 6 // THAC0 (was 5)
    WRITE_BYTE 0x53 8 // NOAtt (was 1)
    WRITE_BYTE 0x234 16 // HighestLevelPrimary (was 10)
    WRITE_BYTE 0x235 1 // HighestLevelSecond (was 30)
    WRITE_BYTE 0x238 20 // Str (was 19)
    WRITE_ASCII 0x248 ~~ #8 // General (was AIRELE01)
    WRITE_ASCII 0x268 ~bpwzasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~telelfir.cre~ ~override~ //Greater Fire Elemental
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x46 0 // ACNatul (was 2)
    WRITE_SHORT 0x48 0 // ACEffec (was 2)
    WRITE_BYTE 0x52 6 // THAC0 (was 5)
    WRITE_BYTE 0x53 8 // NOAtt (was 1)
    WRITE_BYTE 0x238 20 // Str (was 19)
    WRITE_ASCII 0x248 ~gensht01~ #8 // Override (was NONE)
    WRITE_ASCII 0x268 ~bpwzasgt~ #8 // Default (was BPWDASGT)
  END
BUT_ONLY

ACTION_IF NOT FILE_EXISTS_IN_GAME ~iceele.cre~ BEGIN
COPY ~bp/cre/iceele.cre~ ~override~
  SAY NAME1 @224 //Water Elemental
  SAY NAME2 @224 //Water Elemental
    WRITE_ASCII 0x268 ~bpwzasgt~ #8 // Default (was )
END

ACTION_IF NOT FILE_EXISTS_IN_GAME ~iceele01.cre~ BEGIN
COPY ~bp/cre/iceele01.cre~ ~override~
  SAY NAME1 @224 //Water Elemental
  SAY NAME2 @224 //Water Elemental
  WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was )
END

ACTION_IF FILE_EXISTS_IN_GAME ~elairpr3.cre~ BEGIN
  COPY_EXISTING ~elairpr3.cre~ ~override~ //Greater Air Elemental
    WRITE_SHORT 0x46 ~-2~ //Natural AC (was 2)
    WRITE_SHORT 0x48 ~-2~ //Effective AC (was 2)
    WRITE_BYTE 0x52 6 //THAC0 (was 0)
    WRITE_ASCII 0x268 ~bpwzasgt~ #8 // Default (was )
    WRITE_BYTE 0x273 186 //Class (elemental_air, was 188 elemental_earth)
  BUT_ONLY
END ELSE BEGIN
  COPY ~bp/cre/elairpr3.cre~ ~override~
    WRITE_ASCII 0x268 ~bpwzasgt~ #8 // Default (was )
END

COPY_EXISTING ~deckfele.cre~ ~override~ //Fire Elemental
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_BYTE 0x238 18 // Str (was 15)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~shearth.cre~ ~override~ //Earth Elemental
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_BYTE 0x53 2 // NOAtt (was 1)
    WRITE_BYTE 0x234 12 // HighestLevelPrimary (was 10)
    WRITE_BYTE 0x235 1 // HighestLevelSecond (was 30)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was )
  END
BUT_ONLY

COPY_EXISTING ~udelda.cre~ ~override~ //Greater Air Elemental
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x46 0 // ACNatul (was 2)
    WRITE_SHORT 0x48 0 // ACEffec (was 2)
    WRITE_BYTE 0x52 6 // THAC0 (was 5)
    WRITE_BYTE 0x53 8 // NOAtt (was 1)
    WRITE_BYTE 0x234 16 // HighestLevelPrimary (was 10)
    WRITE_BYTE 0x238 20 // Str (was 19)
    WRITE_ASCII 0x260 ~~ #8 // General (was AIRELE01)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was )
  END
BUT_ONLY

COPY_EXISTING ~udelde.cre~ ~override~ //Greater Earth Elemental
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_BYTE 0x52 6 // THAC0 (was 5)
    WRITE_BYTE 0x53 2 // NOAtt (was 1)
    WRITE_BYTE 0x234 16 // HighestLevelPrimary (was 10)
    WRITE_BYTE 0x238 20 // Str (was 19)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was )
  END
BUT_ONLY

COPY_EXISTING ~udeldf.cre~ ~override~ //Greater Fire Elemental
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x46 0 // ACNatul (was 2)
    WRITE_SHORT 0x48 0 // ACEffec (was 2)
    WRITE_BYTE 0x52 6 // THAC0 (was 5)
    WRITE_BYTE 0x53 8 // NOAtt (was 1)
    WRITE_BYTE 0x234 16 // HighestLevelPrimary (was 10)
    WRITE_BYTE 0x238 20 // Str (was 19)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was )
  END
BUT_ONLY

COPY_EXISTING ~udfire.cre~ ~override~ //Fire Elemental
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_BYTE 0x53 2 // NOAtt (was 1)
    WRITE_BYTE 0x234 12 // HighestLevelPrimary (was 10)
    WRITE_BYTE 0x238 19 // Str (was 9)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was )
  END
BUT_ONLY

COPY_EXISTING ~swaair01.cre~ ~override~ //Air Elemental
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_BYTE 0x52 6 // THAC0 (was 5)
    WRITE_BYTE 0x53 2 // NOAtt (was 1)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was )
  END
BUT_ONLY

COPY_EXISTING ~swaair02.cre~ ~override~ //Air Elemental
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x46 ~-2~ // ACNatul (was 2)
    WRITE_SHORT 0x48 ~-2~ // ACEffec (was 2)
    WRITE_BYTE 0x53 12 // NOAtt (was 1)
    WRITE_BYTE 0x234 24 // HighestLevelPrimary (was 12)
    WRITE_BYTE 0x238 21 // Str (was 19)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was )
  END
BUT_ONLY

COPY_EXISTING ~swaear01.cre~ ~override~ //Earth Elemental
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_BYTE 0x53 2 // NOAtt (was 1)
    WRITE_BYTE 0x234 16 // HighestLevelPrimary (was 12)
    WRITE_BYTE 0x238 20 // Str (was 19)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was )
  END
BUT_ONLY

COPY_EXISTING ~swaear02.cre~ ~override~ //Earth Elemental
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x46 0 // ACNatul (was 2)
    WRITE_SHORT 0x48 0 // ACEffec (was 2)
    WRITE_BYTE 0x52 6 // THAC0 (was 9)
    WRITE_BYTE 0x53 2 // NOAtt (was 1)
    WRITE_BYTE 0x234 24 // HighestLevelPrimary (was 12)
    WRITE_BYTE 0x238 21 // Str (was 19)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was )
  END
BUT_ONLY

COPY_EXISTING ~swafir01.cre~ ~override~ //Fire Elemental
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_BYTE 0x53 2 // NOAtt (was 1)
    WRITE_BYTE 0x234 16 // HighestLevelPrimary (was 12)
    WRITE_BYTE 0x238 19 // Str (was 18)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was )
  END
BUT_ONLY

COPY_EXISTING ~swafir02.cre~ ~override~ //Fire Elemental
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x46 0 // ACNatul (was 2)
    WRITE_SHORT 0x48 0 // ACEffec (was 2)
    WRITE_BYTE 0x52 6 // THAC0 (was 9)
    WRITE_BYTE 0x53 2 // NOAtt (was 1)
    WRITE_BYTE 0x234 24 // HighestLevelPrimary (was 12)
    WRITE_BYTE 0x238 20 // Str (was 18)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was )
  END
BUT_ONLY

COPY_EXISTING ~sumelair.cre~ ~override~ //Lesser Air Elemental
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_BYTE 0x53 7 // NOAtt (was 1)
    WRITE_BYTE 0x238 18 // Str (was 19)
    WRITE_BYTE 0x239 51 // StrBon (was 0)
    WRITE_ASCII 0x248 ~~ #8 // Override (was GENSHT01)
    WRITE_ASCII 0x260 ~~ #8 // General (was AIRELE01)
    WRITE_ASCII 0x268 ~bpwzasgt~ #8 // Default (was )
  END
BUT_ONLY

COPY_EXISTING ~sumelear.cre~ ~override~ //Lesser Earth Elemental
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_BYTE 0x238 18 // Str (was 19)
    WRITE_BYTE 0x239 51 // StrBon (was 0)
    WRITE_ASCII 0x248 ~~ #8 // Override (was GENSHT01)
    WRITE_ASCII 0x268 ~bpwzasgt~ #8 // Default (was )
  END
BUT_ONLY

COPY_EXISTING ~sumelfir.cre~ ~override~ //Lesser Fire Elemental
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x46 4 // ACNatul (was 2)
    WRITE_SHORT 0x48 4 // ACEffec (was 2)
    WRITE_BYTE 0x53 7 // NOAtt (was 1)
    WRITE_BYTE 0x238 18 // Str (was 19)
    WRITE_BYTE 0x239 51 // StrBon (was 0)
    WRITE_ASCII 0x268 ~bpwzasgt~ #8 // Default (was )
  END
BUT_ONLY


END

/////////////////////////////////////////////////////////////////////////////////////////
DEFINE_ACTION_FUNCTION githyanki BEGIN

INCLUDE ~bp/lib/bp_main.tph~

LAF githyanki_scripts END

COPY_EXISTING ~gith01.cre~ ~override~ //Warrior
              ~gith02.cre~ ~override~ //Knight
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_ASCII 0x268 ~wbasight~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~gith03.cre~ ~override~ //Anti-Paladin
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_SHORT 0x46 4 // ACNatul (was 10)
    WRITE_SHORT 0x48 4 // ACEffec (was 10)
    WRITE_BYTE 0x234 12 // HighestLevelPrimary (was 11)
    WRITE_ASCII 0x250 ~~ #8 // Class (was GPUSE)
    WRITE_ASCII 0x268 ~wbasight~ #8 // Default (was WTASIGHT)
    REPLACE_CRE_ITEM ~HELMNOAN~ #0 #0 #0 ~NONE~ ~HELMET~
    REPLACE_CRE_ITEM ~IMMCHS~ #0 #0 #0 ~NONE~ ~LRING~
    REPLACE_CRE_ITEM ~PLAT04~ #0 #0 #0 ~NONE~ ~ARMOR~
    ADD_CRE_ITEM ~POTN10~ #5 #0 #0 ~NONE~ ~QITEM1~
    ADD_CRE_ITEM ~POTN52~ #5 #0 #0 ~NONE~ ~QITEM2~
    LAUNCH_PATCH_FUNCTION DELETE_CRE_EFFECT
      INT_VAR opcode_to_delete = 263 //Backstab Modifier
    END
    LAUNCH_PATCH_FUNCTION ADD_CRE_EFFECT
      INT_VAR opcode = 263 //Backstab Modifier
      timing = 9 //Permanent after death
      target = 1 //Self
      parameter1 = 4 //Statistic modifier
      parameter2 = 2 //Percentage modifier
      resist_dispel = 2 //Not dispellable/bypass resistance
    END
  END
BUT_ONLY

COPY_EXISTING ~gith04.cre~ ~override~ //Gish
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x268 ~wbasight~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~gith05.cre~ ~override~ //Warlock
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 44 // CurrHP (was 32)
    WRITE_SHORT 0x26 44 // MaxHP (was 32)
    WRITE_ASCII 0x250 ~~ #8 // Class (was GPUSE)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~gith06.cre~ ~override~ //Captain
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 87 // CurrHP (was 70)
    WRITE_SHORT 0x26 87 // MaxHP (was 70)
    WRITE_ASCII 0x250 ~~ #8 // Class (was GPUSE)
    WRITE_ASCII 0x260 ~bpmag12e~ #8 // General (was )
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY


COPY_EXISTING ~udgith02.cre~ ~override~ //Githyanki
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x248 ~bp!plot~ #8 // Override (was GPDIE)
    WRITE_ASCII 0x250 ~~ #8 // Class (was GPSHOUT)
  END
BUT_ONLY

ACTION_IF NOT FILE_EXISTS_IN_GAME ~udgith03.cre~ BEGIN
  COPY ~bp/cre/udgith03.cre~ ~override~
END

ACTION_IF NOT FILE_EXISTS_IN_GAME ~udgith04.cre~ BEGIN
  COPY ~bp/cre/udgith04.cre~ ~override~
END

ACTION_IF NOT FILE_EXISTS_IN_GAME ~udgith05.cre~ BEGIN
  COPY ~bp/cre/udgith05.cre~ ~override~
END

COPY_EXISTING ~udtrap03.cre~ ~override~ //Riti
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x46 6 // ACNatul (was 10)
    WRITE_SHORT 0x48 6 // ACEffec (was 10)
    WRITE_BYTE 0x53 2 // NOAtt (was 1)
    // WRITE_BYTE 0x6e 3 // Unu0(Large swords prof) (was 0)
    WRITE_ASCII 0x258 ~githyank~ #8 // Race (was )
    WRITE_ASCII 0x268 ~wgarsgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~dagith1.cre~ ~override~ //Githyanki Captain
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    // WRITE_BYTE 0x6e 3 // Unu0(Large swords prof) (was 0)
    // WRITE_BYTE 0x6f 3 // Unu1(Small swords prof) (was 0)
    WRITE_BYTE 0x241 255 // Racial (was 0)
    WRITE_ASCII 0x248 ~bp!plot~ #8 // Override (was GPSHOUT)
    WRITE_ASCII 0x250 ~bpleader~ #8 // Class (was UDGO)
    WRITE_ASCII 0x258 ~gpshout~ #8 // Race (was NONE)
    WRITE_ASCII 0x260 ~bpmag16c~ #8 // General (was NONE)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    REMOVE_KNOWN_SPELL ~spwi302~
    REMOVE_KNOWN_SPELL ~spwi620~
    REMOVE_MEMORIZED_SPELL ~spwi302~
    REMOVE_MEMORIZED_SPELL ~spwi620~
    ADD_MEMORIZED_SPELL ~spwi303~ #2 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi621~ #5 ~wizard~
  END
BUT_ONLY

COPY_EXISTING ~dagith2.cre~ ~override~ //Githyanki
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x258 ~bpmag16c~ #8 // Race (was NONE)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    WRITE_BYTE 0x273 7 // IDSClass (was 2)
    REMOVE_KNOWN_SPELL ~spwi302~
    REMOVE_KNOWN_SPELL ~spwi620~
    REMOVE_MEMORIZED_SPELL ~spwi302~
    REMOVE_MEMORIZED_SPELL ~spwi620~
    ADD_MEMORIZED_SPELL ~spwi303~ #2 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi621~ #5 ~wizard~
  END
BUT_ONLY


END

/////////////////////////////////////////////////////////////////////////////////////////
DEFINE_ACTION_FUNCTION golems BEGIN

INCLUDE ~bp/lib/bp_main.tph~

LAF golem_scripts END


COPY ~bp/cre/const01.cre~ ~override~
  SAY NAME1 @177 //Mage Construct
  SAY NAME2 @177 //Mage Construct
  WRITE_ASCII 0x268 ~bpgolem~ #8 // Default (was WTASIGHT)

COPY ~bp/cre/crytgol.cre~ ~override~
  SAY NAME1 @178 //Red Crystal Golem
  SAY NAME2 @178 //Red Crystal Golem
  WRITE_ASCII 0x268 ~bpgolem~ #8 // Default (was WTASIGHT)
  
COPY_EXISTING ~tomegol1.cre~ ~override~ //Flesh Golem
    WRITE_ASCII 0x248 ~quietsht~ #8
    WRITE_ASCII 0x268 ~bpgolem~ #8


COPY_EXISTING ~gorgrd01.cre~ ~override~ //Guardian Golem
              ~gorgrd02.cre~ ~override~ //Guardian Golem 
			  ~gordeck2.cre~ ~override~
  WRITE_ASCII 0x250 ~quietsht~ #8
  WRITE_ASCII 0x258 ~bpgoliro~ #8
  WRITE_ASCII 0x260 ~~ #8
  WRITE_ASCII 0x268 ~bpgolem~ #8
			  
COPY_EXISTING ~goliro01.cre~ ~override~
			  ~golada01.cre~ ~override~
			  ~golkill2.cre~ ~override~
  WRITE_ASCII 0x248 ~quietsht~ #8
  WRITE_ASCII 0x250 ~bpgoliro~ #8
  WRITE_ASCII 0x258 ~~ #8
  WRITE_ASCII 0x260 ~~ #8
  WRITE_ASCII 0x268 ~bpgolem~ #8
  
COPY_EXISTING ~golcla01.cre~ ~override~
			  ~golem01.cre~  ~override~
              ~tomegol2.cre~ ~override~ //Flesh Golem
			  ~icbone01.cre~ ~override~ //Bone Golem
  WRITE_ASCII 0x248 ~quietsht~ #8
  WRITE_ASCII 0x250 ~bpgolcla~ #8
  WRITE_ASCII 0x258 ~~ #8
  WRITE_ASCII 0x260 ~~ #8
  WRITE_ASCII 0x268 ~bpgolem~ #8
  
COPY_EXISTING ~ppiron.cre~ ~override~
  WRITE_ASCII 0x248 ~ppiron~ #8
  WRITE_ASCII 0x250 ~quietsht~ #8
  WRITE_ASCII 0x258 ~bpgolcla~ #8
  WRITE_ASCII 0x260 ~~ #8
  WRITE_ASCII 0x268 ~bpgolem~ #8
  
COPY_EXISTING ~kpgol01.cre~  ~override~
  WRITE_ASCII 0x248 ~kpgol01~ #8
  WRITE_ASCII 0x250 ~quietsht~ #8
  WRITE_ASCII 0x258 ~bpgolsto~ #8
  WRITE_ASCII 0x260 ~~ #8
  WRITE_ASCII 0x268 ~bpgolem~ #8 

COPY_EXISTING ~kpgol02.cre~  ~override~
  WRITE_ASCII 0x248 ~kpgol02~ #8
  WRITE_ASCII 0x250 ~quietsht~ #8
  WRITE_ASCII 0x258 ~bpgolcla~ #8
  WRITE_ASCII 0x260 ~~ #8
  WRITE_ASCII 0x268 ~bpgolem~ #8 
 
COPY_EXISTING ~kpgol03.cre~  ~override~
  WRITE_ASCII 0x248 ~kpgol03~ #8
  WRITE_ASCII 0x250 ~quietsht~ #8
  WRITE_ASCII 0x258 ~bpgolsto~ #8
  WRITE_ASCII 0x260 ~~ #8
  WRITE_ASCII 0x268 ~bpgolem~ #8 
   
COPY_EXISTING ~kpgol04.cre~ ~override~
  WRITE_ASCII 0x248 ~kpgol04~ #8
  WRITE_ASCII 0x250 ~bpgoliro~ #8
  WRITE_ASCII 0x258 ~~ #8
  WRITE_ASCII 0x260 ~~ #8
  WRITE_ASCII 0x268 ~bpgolem~ #8

  COPY_EXISTING ~kpgol05.cre~  ~override~
  WRITE_ASCII 0x248 ~kpgol05~ #8
  WRITE_ASCII 0x250 ~quietsht~ #8
  WRITE_ASCII 0x258 ~bpgolsto~ #8
  WRITE_ASCII 0x260 ~~ #8
  WRITE_ASCII 0x268 ~bpgolem~ #8 

  COPY_EXISTING ~kpgol06.cre~  ~override~
  WRITE_ASCII 0x248 ~kpgol06~ #8
  WRITE_ASCII 0x250 ~quietsht~ #8
  WRITE_ASCII 0x258 ~~ #8
  WRITE_ASCII 0x260 ~~ #8
  WRITE_ASCII 0x268 ~bpgolem~ #8 

ACTION_IF NOT FILE_EXISTS_IN_GAME ~kpgol07.cre~ BEGIN
  COPY ~bp/cre/kpgol07.cre~ ~override~
    WRITE_ASCII 0x248 ~kpgol04~ #8
    WRITE_ASCII 0x250 ~quietsht~ #8
    WRITE_ASCII 0x258 ~bpgoliro~ #8
    WRITE_ASCII 0x260 ~~ #8
    WRITE_ASCII 0x268 ~bpgolem~ #8
  END ELSE BEGIN
  COPY_EXISTING ~kpgol07.cre~ ~override~
    WRITE_ASCII 0x248 ~kpgol04~ #8
    WRITE_ASCII 0x250 ~quietsht~ #8
    WRITE_ASCII 0x258 ~bpgoliro~ #8
    WRITE_ASCII 0x260 ~~ #8
    WRITE_ASCII 0x268 ~bpgolem~ #8
  END

  COPY_EXISTING ~golsto01.cre~ ~override~
                ~tomegol3.cre~ ~override~
  WRITE_ASCII 0x248 ~quietsht~ #8
  WRITE_ASCII 0x250 ~bpgolsto~ #8
  WRITE_ASCII 0x258 ~~ #8
  WRITE_ASCII 0x260 ~~ #8
  WRITE_ASCII 0x268 ~bpgolem~ #8

COPY_EXISTING ~golice01.cre~ ~override~
              ~gorgoli.cre~  ~override~
  SAY NAME1 @217 //Ice Golem
  SAY NAME2 @217 //Ice Golem
	WRITE_ASCII 0x248 ~quietsht~ #8
	WRITE_ASCII 0x250 ~bpgolice~ #8
    WRITE_ASCII 0x268 ~bpgolem~ #8 // Default (was WTASIGHT)

 
COPY_EXISTING ~tomegol4.cre~ ~override~ //Juggernaut Golem
              ~goljug01.cre~ ~override~
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    // SAY NAME1 #47204 // LongName (was 47203)
    WRITE_BYTE 0x60 50 // RstSlash (was 20)
    WRITE_BYTE 0x61 25 // RstCrush (was 20)
    WRITE_BYTE 0x62 75 // RstPierc (was 20)
    WRITE_BYTE 0x63 100 // RstMissl (was 20)
	WRITE_ASCII 0x248 ~quietsht~ #8
    WRITE_ASCII 0x268 ~bpgolem~ #8 // Default (was WTASIGHT)
    REMOVE_CRE_ITEM ~IMMUNE1~
    REPLACE_CRE_ITEM ~IMMUNE2~ #0 #0 #0 ~IDENTIFIED~ ~LRING~
  END
BUT_ONLY

COPY ~bp/cre/icegolem.cre~ ~override~
  SAY NAME1 @217 //Ice Golem
  SAY NAME2 @217 //Ice Golem
	WRITE_ASCII 0x248 ~quietsht~ #8
	WRITE_ASCII 0x250 ~golice01~ #8
    WRITE_ASCII 0x268 ~bpgolem~ #8 // Default (was WTASIGHT)



END


/////////////////////////////////////////////////////////////////////////////////////

DEFINE_ACTION_FUNCTION hellhound_madness BEGIN


ACTION_IF NOT FILE_EXISTS_IN_GAME ~hellho.pro~ BEGIN
  ADD_PROJECTILE ~bp/pro/hellho.pro~
END

ACTION_IF NOT FILE_EXISTS_IN_GAME ~hellho.bam~ BEGIN
  COPY ~bp/bam/core/hellho.bam~ ~override~
END

ACTION_IF NOT FILE_EXISTS_IN_GAME ~helhou01.bcs~ BEGIN
  COMPILE ~bp/baf/new_baf/hellhound/helhou01.baf~
END

//! HELLHO projectile /////////////////////////////////////
COPY ~bp/spl/spin484.spl~ ~override~
  READ_LONG  0x64   abil_offset
  READ_SHORT 0x68   abil_num
  SET pro = (1 + IDS_OF_SYMBOL(~PROJECTL~ ~HELLHO~))
  FOR(cnt=0; cnt<abil_num; cnt+=1) BEGIN
    WRITE_SHORT  (abil_offset + cnt*0x28 + 0x26) pro
  END

COPY_EXISTING ~hellhoun.itm~ ~override~
  PATCH_IF SOURCE_SIZE > 0x71 BEGIN
    WRITE_SHORT 0x1c 25 //Weapon type (axe, was hand-to-hand)
    WRITE_SHORT 0x22 0 //Animation (none, was helm)
    WRITE_BYTE 0x31 92 //Proficiency (axe, was none)
    READ_LONG 0x64 abil_off
    READ_SHORT 0x68 num_abil
    found_abil = 0
    3D_eff = 0
    dam1 = 0
    dam2 = 0
    FOR (w = 0; w < num_abil; w += 1) BEGIN //Cycle through headers
      READ_BYTE (0x38 * w + abil_off) pt //Attack type
      PATCH_IF pt = 1 BEGIN //If melee
        found_abil = w + 1
        WRITE_SHORT (0x38 * w + abil_off + 2) 1 //Location (weapon)
        WRITE_ASCII (0x38 * w + abil_off + 4) ~iax1h01~ #8 //Icon
        WRITE_BYTE  (0x38 * w + abil_off + 0xc) 1 //Target (creature)
        WRITE_SHORT (0x38 * w + abil_off + 0xe) 1 //Range
        WRITE_SHORT (0x38 * w + abil_off + 0x12) 1 //Speed
        WRITE_SHORT (0x38 * w + abil_off + 0x14) 4 //THAC0 bonus
        WRITE_LONG  (0x38 * w + abil_off + 0x16) 10 //Dice sides
        WRITE_SHORT (0x38 * w + abil_off + 0x18) 1 //Dice thrown
        WRITE_SHORT (0x38 * w + abil_off + 0x1c) 1 //Damage type (piercing)
        WRITE_BYTE  (0x38 * w + abil_off + 0x24) 0 //Depletion (don't vanish)
        WRITE_BYTE  (0x38 * w + abil_off + 0x26) 0b00000001 //Flags1
        WRITE_SHORT (0x38 * w + abil_off + 0x2a) 1 //Animation (none)
        WRITE_SHORT (0x38 * w + abil_off + 0x2c) 34 //Overhand
        WRITE_SHORT (0x38 * w + abil_off + 0x2e) 33 //Backhand
        WRITE_SHORT (0x38 * w + abil_off + 0x30) 33 //Thrust
        READ_SHORT (0x38 * w + abil_off + 0x1e) num_eff
        READ_SHORT (0x38 * w + abil_off + 0x20) eff_off
        FOR (x = 0; x < num_eff; x += 1) BEGIN
          READ_SHORT (eff_off + 0x30 * x) eff_type
          PATCH_IF eff_type = 215 BEGIN
            READ_ASCII (eff_off + 0x30 * x + 0x14) vvc
            PATCH_IF (~%vvc%~ STRING_EQUAL_CASE ~icfirsdi~ = 1) BEGIN
              3D_eff = 1
            END
          END ELSE BEGIN
            PATCH_IF eff_type = 12 BEGIN
              READ_LONG (eff_off + 0x30 * x + 8) dam_type
              READ_LONG (eff_off + 0x30 * x + 0x24) sav_throw
              PATCH_IF (dam_type = 524288) AND (sav_throw = 0) BEGIN
                WRITE_LONG (eff_off + 0x30 * x + 4) 3 //Damage
                WRITE_BYTE (eff_off + 0x30 * x + 0x12) 20 //Probability1
                WRITE_LONG (eff_off + 0x30 * x + 0x1c) 99 //Highest level affected
                WRITE_LONG (eff_off + 0x30 * x + 0x20) 0 //Lowest level affected
                dam1 = 1
              END ELSE BEGIN
                PATCH_IF (dam_type = 524288) AND (sav_throw = 2) BEGIN
                  WRITE_LONG (eff_off + 0x30 * x + 4) 3 //Damage
                  WRITE_BYTE (eff_off + 0x30 * x + 0x12) 20 //Probability1
                  WRITE_LONG (eff_off + 0x30 * x + 0x1c) 99 //Highest level affected
                  WRITE_LONG (eff_off + 0x30 * x + 0x20) 0 //Lowest level affected
                  dam2 = 1
                END
              END
            END
          END
        END
      END
    END
    PATCH_IF found_abil = 0 BEGIN
      LAUNCH_PATCH_FUNCTION t-add_spl_itm_header
        INT_VAR
        t-copy      = 0
        t-atk_type  = 1
        t-hdr_targ  = 1
        t-range     = 1
        t-speed     = 1
        t-hit_bonus = 4
        t-hdie_size = 10
        t-hdice     = 1
        t-dmg_type  = 1
        t-projectl  = 1
        t-melee1    = 34
        t-melee2    = 33
        t-melee3    = 33
        STR_VAR
        t-bam       = iax1h01
      END
      found_abil = num_abil + 1
    END
    PATCH_IF 3D_eff = 0 BEGIN
      LAUNCH_PATCH_FUNCTION ADD_ITEM_EFFECT
        INT_VAR
        type          = 1 //Melee
        opcode        = 215 //Play 3D Effect
        target        = 2 //Pre-target
        parameter2    = 1 //Play over target
        timing        = 1 //Instantaneous
        probability1  = 20
        resist_dispel = 1 //Dispel/not bypass
        STR_VAR
        resource      = icfirsdi
      END
      3D_eff = 1
    END
    PATCH_IF dam1 = 0 BEGIN
      LAUNCH_PATCH_FUNCTION ADD_ITEM_EFFECT
        INT_VAR
        type          = 1 //Melee
        opcode        = 12 //HP: Damage
        target        = 2 //Pre-target
        power         = 6
        parameter1    = 3 //Damage
        parameter2    = 524288 //Fire
        timing        = 1 //Instantaneous
        probability1  = 20
        dienumber     = 99 //Highest affected level
        resist_dispel = 1 //Dispel/not bypass
      END
      dam1 = 1
    END
    PATCH_IF dam2 = 0 BEGIN
      LAUNCH_PATCH_FUNCTION ADD_ITEM_EFFECT
        INT_VAR
        type          = 1 //Melee
        opcode        = 12 //HP: Damage
        target        = 2 //Pre-target
        power         = 6
        parameter1    = 3 //Damage
        parameter2    = 524288 //Fire
        timing        = 1 //Instantaneous
        probability1  = 20
        dienumber     = 99 //Highest affected level
        savingthrow   = 2 //Breath weapon
        resist_dispel = 1 //Dispel/not bypass
      END
      dam2 = 1
    END
  END
BUT_ONLY



COPY_EXISTING ~hellho01.cre~ ~override~ //Hell Hound
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 42 // CurrHP (was 56)
    WRITE_SHORT 0x26 42 // MaxHP (was 56)
    WRITE_SHORT 0x46 5 // ACNatul (was 4)
    WRITE_SHORT 0x48 5 // ACEffec (was 4)
    WRITE_BYTE 0x53 2 // NOAtt (was 1)
    WRITE_BYTE 0x54 11 // SaveVDth (was 10)
    WRITE_BYTE 0x55 13 // SaveVWnd (was 12)
    WRITE_BYTE 0x56 12 // SaveVPoly (was 11)
    WRITE_BYTE 0x57 13 // SaveVAtks (was 12)
    WRITE_BYTE 0x58 14 // SaveVspell (was 13)
    WRITE_BYTE 0x5e 125 // RstMFre (was 100)
    WRITE_BYTE 0x234 6 // HighestLevelPrimary (was 7)
    WRITE_BYTE 0x23a 5 // Int (was 9)
    WRITE_BYTE 0x23b 5 // Wis (was 9)
    WRITE_BYTE 0x23c 16 // Dex (was 9)
    WRITE_BYTE 0x23d 16 // Con (was 9)
    WRITE_ASCII 0x248 ~~ #8 // Override (was GENSHT01)
    WRITE_ASCII 0x258 ~helhou01~ #8 // Race (was NONE)
    WRITE_ASCII 0x260 ~~ #8 // General (was HELHOU01)
    WRITE_ASCII 0x268 ~~ #8 // Default (was WTASIGHT)
    ADD_MEMORIZED_SPELL ~spin484~ #0 ~innate~ (3)
    REMOVE_CRE_ITEM ~P1-10~ ~HELLHO~ ~HELLHOUN~
    REPLACE_CRE_ITEM ~HELLHOUN~ #0 #0 #0 ~NONE~ ~WEAPON1~ EQUIP
    LAUNCH_PATCH_FUNCTION ADD_CRE_EFFECT
      INT_VAR opcode = 233 //Color: Very Bright by RGB
      timing = 9 //Permanent after death
      target = 1 //Self
      parameter1 = 2 //Color designation (RGB 5,5,5)
      parameter2 = 92 //Bastard Sword
     END
  END
BUT_ONLY

COPY_EXISTING ~hellil01.cre~ ~override~ //Hell Hound
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 68 // CurrHP (was 56)
    WRITE_SHORT 0x26 68 // MaxHP (was 56)
    WRITE_BYTE 0x59 125 // RstFire (was 100)
    WRITE_BYTE 0x5a 0 // RstCold (was 100)
    WRITE_BYTE 0x5b 0 // RstElec (was 100)
    WRITE_BYTE 0x5c 0 // RstAcid (was 100)
    WRITE_BYTE 0x5d 0 // RstMagc (was 100)
    WRITE_BYTE 0x5e 125 // RstMFre (was 100)
    WRITE_BYTE 0x5f 0 // RstMCld (was 100)
    WRITE_BYTE 0x60 0 // RstSlash (was 100)
    WRITE_BYTE 0x61 0 // RstCrush (was 100)
    WRITE_BYTE 0x62 0 // RstPierc (was 100)
    WRITE_BYTE 0x63 0 // RstMissl (was 100)
    WRITE_ASCII 0x250 ~helhou01~ #8 // Class (was NONE)
    WRITE_ASCII 0x268 ~~ #8 // Default (was WTASIGHT)
    ADD_MEMORIZED_SPELL ~spin484~ #0 ~innate~ (3)
    REMOVE_CRE_ITEM ~P1-10~ ~HELLHO~ ~HELLHOUN~
    REPLACE_CRE_ITEM ~HELLHOUN~ #0 #0 #0 ~NONE~ ~WEAPON1~ EQUIP
    LAUNCH_PATCH_FUNCTION ADD_CRE_EFFECT
      INT_VAR opcode = 233 //Color: Very Bright by RGB
      timing = 9 //Permanent after death
      target = 1 //Self
      parameter1 = 2 //Color designation (RGB 5,5,5)
      parameter2 = 92 //Bastard Sword
     END
  END
BUT_ONLY

COPY_EXISTING ~obsfir05.cre~ ~override~ //Hell Hound
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_BYTE 0x5e 125 // RstMFre (was 100)
    WRITE_ASCII 0x268 ~~ #8 // Default (was WTASIGHT)
    ADD_MEMORIZED_SPELL ~spin484~ #0 ~innate~ (3)
    REMOVE_CRE_ITEM ~P1-10~ ~HELLHO~ ~HELLHOUN~
    REPLACE_CRE_ITEM ~HELLHOUN~ #0 #0 #0 ~NONE~ ~WEAPON1~ EQUIP
    LAUNCH_PATCH_FUNCTION ADD_CRE_EFFECT
      INT_VAR opcode = 233 //Color: Very Bright by RGB
      timing = 9 //Permanent after death
      target = 1 //Self
      parameter1 = 2 //Color designation (RGB 5,5,5)
      parameter2 = 92 //Bastard Sword
     END
  END
BUT_ONLY


END

/////////////////////////////////////////////////////////////////////////////////////////
DEFINE_ACTION_FUNCTION humanoids BEGIN

INCLUDE ~bp/lib/bp_main.tph~

LAF humanoid_scripts END


ACTION_IF FILE_EXISTS_IN_GAME ~bugarch.cre~ BEGIN
  COPY_EXISTING ~bugarch.cre~ ~override~ //Bugbear
    WRITE_BYTE 0x238 17 //Strength (was 15)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 //Default script (was wtasight)
  BUT_ONLY
END ELSE BEGIN
  COPY ~bp/cre/bugarch.cre~ ~override~
    SAY NAME1 @161 //Bugbear
    SAY NAME2 @161 //Bugbear
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 //Default script (was wtasight)
END

ACTION_IF FILE_EXISTS_IN_GAME ~bugbear.cre~ BEGIN
  COPY_EXISTING ~bugbear.cre~ ~override~ //Bugbear
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 //Default script (was wtasight)
  BUT_ONLY
END ELSE BEGIN
  COPY ~bp/cre/bugbear.cre~ ~override~
    SAY NAME1 @161 //Bugbear
    SAY NAME2 @161 //Bugbear
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 //Default script (was wtasight)
END


ACTION_FOR_EACH cyc IN ~cyc01~ ~cyccali1~ ~cyccali2~ ~cyccali3~ BEGIN
  ACTION_IF FILE_EXISTS_IN_GAME ~%cyc%.cre~ BEGIN
    COPY_EXISTING ~%cyc%.cre~ ~override~ //Cyclops
      WRITE_LONG 0x14 3275 //XP value (was 10000)
      WRITE_ASCII 0x268 ~bpwdasgt~ #8 //Default script (was wtasight)
      ADD_CRE_ITEM ~boulder~ #8 #0 #0 ~NONE~ ~WEAPON2~ EQUIP
    BUT_ONLY
  END ELSE BEGIN
    COPY ~bp/CRE/%cyc%.cre~ ~override~
      SAY NAME1 @179 //Cyclops
      SAY NAME2 @179 //Cyclops
  END
END

ACTION_IF FILE_EXISTS_IN_GAME ~frost01.cre~ BEGIN
  COPY_EXISTING ~frost01.cre~ ~override~ //Frost Giant
    WRITE_LONG 0x14 3600 //XP value (was 12000)
    WRITE_ASCII 0x268 ~wdasight~ #8 //Default script (was wtasight)
    ADD_CRE_ITEM ~boulder~ #8 #0 #0 ~NONE~ ~WEAPON2~ EQUIP
  BUT_ONLY
END ELSE BEGIN
  COPY ~bp/cre/frost01.cre~ ~override~
    SAY NAME1 @208 //Frost Giant
    SAY NAME2 @208 //Frost Giant
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 //Default script (was wtasight)
END


COPY_EXISTING ~aegnoll.cre~ ~override~ //Gnoll
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 28
    WRITE_SHORT 0x26 28
    WRITE_ASCII 0x258 ~~
    WRITE_ASCII 0x268 ~bpwdasgt~ #8
  END
BUT_ONLY

COPY_EXISTING ~aemerhob.cre~ ~override~ //Hobgoblin Archer
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 24
    WRITE_SHORT 0x26 24
    WRITE_ASCII 0x268 ~bpwdasgt~ #8
  END
BUT_ONLY

ACTION_IF FILE_EXISTS_IN_GAME ~dragbr1.cre~ BEGIN
  COPY_EXISTING ~dragbr1.cre~ ~override~ //Gnoll
    WRITE_ASCII 0x258 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    REMOVE_CRE_ITEM ~rndtre04~
  BUT_ONLY
END ELSE BEGIN
  COPY ~bp/cre/dragbr1.cre~ ~override~
    SAY NAME1 @186 //Gnoll
    SAY NAME2 @186 //Gnoll
END

ACTION_IF NOT FILE_EXISTS_IN_GAME ~hobarc03.cre~ BEGIN //Bone Hill
  COPY ~bp/cre/hobarc03.cre~ ~override~
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
END

ACTION_IF NOT FILE_EXISTS_IN_GAME ~hobgo2.cre~ BEGIN //Bone Hill
  COPY ~bp/cre/hobgo2.cre~ ~override~
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
END

ACTION_IF NOT FILE_EXISTS_IN_GAME ~hobgo3.cre~ BEGIN //Bone Hill
  COPY ~bp/cre/hobgo3.cre~ ~override~
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
END

ACTION_IF NOT FILE_EXISTS_IN_GAME ~hobgo4.cre~ BEGIN //Bone Hill
  COPY ~bp/cre/hobgo4.cre~ ~override~
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
END
ACTION_IF NOT FILE_EXISTS_IN_GAME ~hobgo6.cre~ BEGIN //Bone Hill
  COPY ~bp/cre/hobgo6.cre~ ~override~
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
END
ACTION_IF NOT FILE_EXISTS_IN_GAME ~hobgob03.cre~ BEGIN //Bone Hill
  COPY ~bp/cre/hobgob03.cre~ ~override~
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
END
ACTION_IF NOT FILE_EXISTS_IN_GAME ~hobgob04.cre~ BEGIN //Bone Hill
  COPY ~bp/cre/hobgob04.cre~ ~override~
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
END
ACTION_IF NOT FILE_EXISTS_IN_GAME ~hobgob05.cre~ BEGIN //Bone Hill
  COPY ~bp/cre/hobgob05.cre~ ~override~
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
END
ACTION_IF NOT FILE_EXISTS_IN_GAME ~hobgod.cre~ BEGIN //Bone Hill
  COPY ~bp/cre/hobgod.cre~ ~override~
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
END

ACTION_IF NOT FILE_EXISTS_IN_GAME ~hobwiz02.cre~ BEGIN //TDD
  COPY ~bp/cre/hobwiz02.cre~ ~override~
    WRITE_ASCII 0x260 ~bpmage6~ #8 // Default (was WTASIGHT)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
END

ACTION_IF NOT FILE_EXISTS_IN_GAME ~kobcap02.cre~ BEGIN //TDD
  COPY ~bp/cre/kobcap02.cre~ ~override~
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
END

ACTION_IF NOT FILE_EXISTS_IN_GAME ~kobcom02.cre~ BEGIN //TDD
  COPY ~bp/cre/kobcom02.cre~ ~override~
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
END

ACTION_IF NOT FILE_EXISTS_IN_GAME ~kobsha02.cre~ BEGIN //TDD
  COPY ~bp/cre/kobsha02.cre~ ~override~
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x260 ~bpkbsham~ #8 // Default (was WTASIGHT)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
END

ACTION_IF NOT FILE_EXISTS_IN_GAME ~kobwit02.cre~ BEGIN //TDD
  COPY ~bp/cre/kobwit02.cre~ ~override~
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
END

COPY_EXISTING ~kobald01.cre~ ~override~ //Kobold
              ~kobwar01.cre~ ~override~ //Kobold
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 10 // CurrHP (was 4)
    WRITE_SHORT 0x26 10 // MaxHP (was 4)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~kobarc01.cre~ ~override~ //Kobold
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_SHORT 0x24 10 // CurrHP (was 4)
    WRITE_SHORT 0x26 10 // MaxHP (was 4)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    REMOVE_CRE_ITEM ~BOW01~
    REPLACE_CRE_ITEM ~BOW05~ #0 #0 #0 ~NONE~ ~WEAPON1~ EQUIP TWOHANDED
    SET_BG2_PROFICIENCY ~PROFICIENCYSHORTBOW~ 1
    SET_BG2_PROFICIENCY ~PROFICIENCYSHORTSWORD~ 1
  END
BUT_ONLY

COPY_EXISTING ~kobcap01.cre~ ~override~ //Kobold Captain
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_SHORT 0x24 21 // CurrHP (was 15)
    WRITE_SHORT 0x26 21 // MaxHP (was 15)
    WRITE_ASCII 0x260 ~bpleader~ #8 // General (was KBLEAD01)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    REMOVE_CRE_ITEM ~BOW01~
    REPLACE_CRE_ITEM ~BOW05~ #0 #0 #0 ~NONE~ ~WEAPON2~
    SET_BG2_PROFICIENCY ~PROFICIENCYSHORTBOW~ 1
    SET_BG2_PROFICIENCY ~PROFICIENCYSHORTSWORD~ 1
  END
BUT_ONLY

COPY_EXISTING ~kobscr01.cre~ ~override~ //Kobold Scribe
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    // SAY NAME1 #63228 // LongName (was 63227)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~kobsha01.cre~ ~override~ //Kobold Shaman
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 18 // CurrHP (was 10)
    WRITE_SHORT 0x26 18 // MaxHP (was 10)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~kobswi01.cre~ ~override~ //Kobold Swift
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_BYTE 0x52 16 // THAC0 (was 20)
    // WRITE_BYTE 0x6f 2 // Unu1(Small swords prof) (was 1)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    REPLACE_CRE_ITEM ~SW1H07~ #0 #0 #0 ~NONE~ ~WEAPON1~ EQUIP
  END
BUT_ONLY

COPY_EXISTING ~kobwit01.cre~ ~override~ //Kobold Witch Doctor
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    REPLACE_CRE_ITEM ~BOW05~ #0 #0 #0 ~NONE~ ~WEAPON2~
    REPLACE_CRE_ITEM ~AROW08~ #16 #0 #0 ~NONE~ ~QUIVER1~
  END
BUT_ONLY

COPY ~bp/cre/orc07.cre~ ~override~
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x268 ~bpwtrsgt~ #8 // Default (was WTASIGHT)
  END

COPY ~bp/cre/orcsum.cre~ ~override~
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x268 ~bpwtrsgt~ #8 // Default (was WTASIGHT)
  END

COPY ~bp/cre/orcsum2.cre~ ~override~
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
  
COPY_EXISTING ~gnlcap01.cre~ ~override~ //Gnoll Captain

  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 44 // CurrHP (was 32)
    WRITE_SHORT 0x26 44 // MaxHP (was 32)
    WRITE_ASCII 0x260 ~bpleader~ #8 // General (was GNLEAD01)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~gnleli01.cre~ ~override~ //Gnoll Elite
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 28 // CurrHP (was 20)
    WRITE_SHORT 0x26 28 // MaxHP (was 20)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~gnlfli01.cre~ ~override~ //Flind
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 28 // CurrHP (was 19)
    WRITE_SHORT 0x26 28 // MaxHP (was 19)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~gnlsla01.cre~ ~override~ //Gnoll Slasher
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 18 // CurrHP (was 15)
    WRITE_SHORT 0x26 18 // MaxHP (was 15)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~gnlwar01.cre~ ~override~ //Gnoll
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 16 // CurrHP (was 15)
    WRITE_SHORT 0x26 16 // MaxHP (was 15)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~gnoll01.cre~ ~override~ //Gnoll
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 18 // CurrHP (was 15)
    WRITE_SHORT 0x26 18 // MaxHP (was 15)
    WRITE_ASCII 0x258 ~bpwdasgt~ #8 // Race (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~gnollhp1.cre~ ~override~ //Gnoll
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x258 ~bpwdasgt~ #8 // Race (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~gnollsu.cre~ ~override~ //Gnoll Elite
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_ASCII 0x248 ~gnollf~ #8 // Override (was GENSHT01)
    WRITE_ASCII 0x258 ~bpwdasgt~ #8 // Race (was NONE)
    WRITE_ASCII 0x260 ~~ #8 // General (was NONE  )
    WRITE_ASCII 0x268 ~~ #8 // Default (was WTASIGHT)
    REPLACE_CRE_ITEM ~HELMNOAN~ #0 #0 #0 ~NONE~ ~HELMET~
    REPLACE_CRE_ITEM ~HALB01~ #0 #0 #0 ~UNDROPPABLE~ ~WEAPON1~ EQUIP TWOHANDED
  END
BUT_ONLY

COPY_EXISTING ~hobarc01.cre~ ~override~ //Hobgoblin Archer
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 24 // CurrHP (was 8)
    WRITE_SHORT 0x26 24 // MaxHP (was 8)
    WRITE_BYTE 0x234 2 // HighestLevelPrimary (was 1)
    WRITE_ASCII 0x258 ~~ #8 // Race (was HGARCH01)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    WRITE_BYTE 0x27b 19 // Alignment (was 0)
  END
BUT_ONLY

COPY_EXISTING ~hobarc02.cre~ ~override~ //Hobgoblin Archer
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 24 // CurrHP (was 10)
    WRITE_SHORT 0x26 24 // MaxHP (was 10)
    WRITE_ASCII 0x258 ~~ #8 // Race (was HGARCH01)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    WRITE_BYTE 0x27b 19 // Alignment (was 0)
  END
BUT_ONLY

COPY_EXISTING ~hobcap01.cre~ ~override~ //Hobgoblin Captain
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_SHORT 0x24 49 // CurrHP (was 40)
    WRITE_SHORT 0x26 49 // MaxHP (was 40)
    WRITE_BYTE 0x52 15 // THAC0 (was 16)
    WRITE_BYTE 0x238 18 // Str (was 16)
    WRITE_BYTE 0x239 51 // StrBon (was 0)
    WRITE_BYTE 0x23d 20 // Con (was 12)
    WRITE_ASCII 0x258 ~bpleader~ #8 // Race (was HGLEAD01)
    WRITE_ASCII 0x268 ~wsasight~ #8 // Default (was WTASIGHT)
    WRITE_BYTE 0x273 8 // IDSClass (was 6)
    WRITE_BYTE 0x27b 19 // Alignment (was 0)
    REMOVE_CRE_ITEM ~CHAN04~
  END
BUT_ONLY

COPY_EXISTING ~hobeli01.cre~ ~override~ //Hobgoblin Elite
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 38 // CurrHP (was 30)
    WRITE_SHORT 0x26 38 // MaxHP (was 30)
    WRITE_BYTE 0x52 16 // THAC0 (was 14)
    WRITE_BYTE 0x23d 19 // Con (was 9)
    WRITE_ASCII 0x258 ~~ #8 // Race (was HGARCH01)
    WRITE_BYTE 0x272 111 // IDSRace (was 1)
    WRITE_BYTE 0x27b 19 // Alignment (was 0)
  END
BUT_ONLY

COPY_EXISTING ~hobgob01.cre~ ~override~ //Gerg
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 15 // CurrHP (was 8)
    WRITE_SHORT 0x26 15 // MaxHP (was 8)
    WRITE_ASCII 0x258 ~bpwdasgt~ #8 // Race (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~hobgobsu.cre~ ~override~ //Hobgoblin Elite
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 38 // CurrHP (was 30)
    WRITE_SHORT 0x26 38 // MaxHP (was 30)
    WRITE_BYTE 0x52 16 // THAC0 (was 17)
    WRITE_BYTE 0x53 7 // NOAtt (was 2)
    WRITE_BYTE 0x239 0 // StrBon (was 10)
    WRITE_ASCII 0x258 ~~ #8 // Race (was KOBOLSU)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTARSGT)
    WRITE_BYTE 0x272 111 // IDSRace (was 1)
    WRITE_BYTE 0x27b 19 // Alignment (was 35)
  END
BUT_ONLY

COPY_EXISTING ~hobsha01.cre~ ~override~ //Hobgoblin Shaman
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 47 // CurrHP (was 36)
    WRITE_SHORT 0x26 47 // MaxHP (was 36)
    WRITE_SHORT 0x46 4 // ACNatul (was 5)
    WRITE_SHORT 0x48 4 // ACEffec (was 5)
    WRITE_BYTE 0x52 16 // THAC0 (was 19)
    WRITE_BYTE 0x54 10 // SaveVDth (was 14)
    WRITE_BYTE 0x55 14 // SaveVWnd (was 16)
    WRITE_BYTE 0x56 13 // SaveVPoly (was 15)
    WRITE_BYTE 0x57 15 // SaveVAtks (was 17)
    WRITE_BYTE 0x58 12 // SaveVspell (was 17)
    WRITE_BYTE 0x234 5 // HighestLevelPrimary (was 3)
    WRITE_BYTE 0x23b 16 // Wis (was 12)
    WRITE_ASCII 0x258 ~bppri10a~ #8 // Race (was HGSHAM01)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    REMOVE_MEMORIZED_SPELL ~sppr103~
    REMOVE_MEMORIZED_SPELL ~sppr208~
    ADD_MEMORIZED_SPELL ~sppr103~ #0 ~priest~ (2)
    ADD_MEMORIZED_SPELL ~sppr108~ #0 ~priest~
    ADD_MEMORIZED_SPELL ~sppr208~ #0 ~priest~
    ADD_MEMORIZED_SPELL ~sppr208~ #1 ~priest~ (2)
    ADD_MEMORIZED_SPELL ~sppr211~ #1 ~priest~
    ADD_MEMORIZED_SPELL ~sppr303~ #1 ~priest~
    ADD_MEMORIZED_SPELL ~sppr401~ #2 ~priest~
    ADD_MEMORIZED_SPELL ~sppr411~ #2 ~priest~
    ADD_MEMORIZED_SPELL ~sppr401~ #3 ~priest~
    ADD_MEMORIZED_SPELL ~sppr411~ #3 ~priest~
  END
BUT_ONLY

COPY_EXISTING ~hobwar01.cre~ ~override~ //Hobgoblin Warrior
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 28 // CurrHP (was 10)
    WRITE_SHORT 0x26 28 // MaxHP (was 10)
    WRITE_BYTE 0x52 17 // THAC0 (was 19)
    WRITE_BYTE 0x53 7 // NOAtt (was 1)
    WRITE_BYTE 0x54 13 // SaveVDth (was 14)
    WRITE_BYTE 0x55 15 // SaveVWnd (was 16)
    WRITE_BYTE 0x56 14 // SaveVPoly (was 15)
    WRITE_BYTE 0x57 16 // SaveVAtks (was 17)
    WRITE_BYTE 0x58 16 // SaveVspell (was 17)
    WRITE_BYTE 0x234 3 // HighestLevelPrimary (was 1)
    WRITE_BYTE 0x238 17 // Str (was 10)
    WRITE_BYTE 0x23d 19 // Con (was 10)
    WRITE_ASCII 0x258 ~~ #8 // Race (was HGWARR01)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    WRITE_BYTE 0x27b 19 // Alignment (was 0)
  END
BUT_ONLY

COPY_EXISTING ~hobwiz01.cre~ ~override~ //Hobgoblin Wizard

  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 34 // CurrHP (was 20)
    WRITE_SHORT 0x26 34 // MaxHP (was 20)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    WRITE_BYTE 0x27b 19 // Alignment (was 0)
    REMOVE_MEMORIZED_SPELL ~spwi112~
    REMOVE_MEMORIZED_SPELL ~spwi217~
    ADD_MEMORIZED_SPELL ~spwi112~ #0 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi118~ #0 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi106~ #0 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi119~ #0 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi211~ #1 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi213~ #1 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi205~ #1 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi217~ #1 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi303~ #2 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi317~ #2 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi401~ #3 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi408~ #3 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi415~ #3 ~wizard~
  END
BUT_ONLY
COPY_EXISTING ~icgob01.cre~ ~override~ //Goblin
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_SHORT 0x24 15 // CurrHP (was 7)
    WRITE_SHORT 0x26 15 // MaxHP (was 7)
    WRITE_BYTE 0x52 19 // THAC0 (was 20)
    WRITE_BYTE 0x54 15 // SaveVDth (was 16)
    WRITE_BYTE 0x55 16 // SaveVWnd (was 18)
    WRITE_BYTE 0x56 14 // SaveVPoly (was 17)
    WRITE_BYTE 0x57 17 // SaveVAtks (was 20)
    WRITE_BYTE 0x58 17 // SaveVspell (was 19)
    // WRITE_BYTE 0x71 1 // Unu3(Spears prof) (was 0)
    // WRITE_BYTE 0x72 1 // Unu4(Blunt prof) (was 0)
    // WRITE_BYTE 0x73 1 // Unu5(Spiked prof) (was 0)
    // WRITE_BYTE 0x74 1 // Unu6(Axe prof) (was 0)
    // WRITE_BYTE 0x75 1 // Unu7(Missile prof) (was 0)
    WRITE_ASCII 0x260 ~~ #8 // General (was KBARCH01)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    REMOVE_CRE_ITEM ~BOW01~
    REPLACE_CRE_ITEM ~BOW05~ #0 #0 #0 ~NONE~ ~WEAPON1~ EQUIP TWOHANDED
    REPLACE_CRE_ITEM ~DAGG01~ #0 #0 #0 ~NONE~ ~WEAPON2~
    SET_BG2_PROFICIENCY ~PROFICIENCYSHORTBOW~ 1
    SET_BG2_PROFICIENCY ~PROFICIENCYDAGGER~ 1
  END
BUT_ONLY

COPY_EXISTING ~icgob02.cre~ ~override~ //Goblin
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    SAY NAME1 #2511 // LongName (~Goblin~)
    SAY NAME2 #2511 // ShortName (~Goblin~)
    WRITE_SHORT 0x24 15 // CurrHP (was 9)
    WRITE_SHORT 0x26 15 // MaxHP (was 9)
    WRITE_SHORT 0x28 58384 // AnimationID (was 58416)
    WRITE_BYTE 0x52 18 // THAC0 (was 19)
    WRITE_BYTE 0x54 13 // SaveVDth (was 16)
    WRITE_BYTE 0x55 16 // SaveVWnd (was 18)
    WRITE_BYTE 0x56 14 // SaveVPoly (was 17)
    WRITE_BYTE 0x57 18 // SaveVAtks (was 20)
    WRITE_BYTE 0x58 17 // SaveVspell (was 19)
    // WRITE_BYTE 0x71 1 // Unu3(Spears prof) (was 0)
    // WRITE_BYTE 0x72 1 // Unu4(Blunt prof) (was 0)
    // WRITE_BYTE 0x73 1 // Unu5(Spiked prof) (was 0)
    // WRITE_BYTE 0x74 1 // Unu6(Axe prof) (was 0)
    // WRITE_BYTE 0x75 1 // Unu7(Missile prof) (was 0)
    WRITE_BYTE 0x242 30 // MrlReco (was 60)
    WRITE_LONG 0x244 1073741824 // KitInfo (was 0)
    WRITE_ASCII 0x260 ~~ #8 // General (was KBARCH01)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    REMOVE_CRE_ITEM ~BOW01~
    REPLACE_CRE_ITEM ~BOW05~ #0 #0 #0 ~NONE~ ~WEAPON1~ EQUIP TWOHANDED
    REPLACE_CRE_ITEM ~DAGG01~ #0 #0 #0 ~NONE~ ~WEAPON2~
    SET_BG2_PROFICIENCY ~PROFICIENCYSHORTBOW~ 1
    SET_BG2_PROFICIENCY ~PROFICIENCYDAGGER~ 1
  END
BUT_ONLY

COPY_EXISTING ~icgob03.cre~ ~override~ //Goblin
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 13 // CurrHP (was 7)
    WRITE_SHORT 0x26 13 // MaxHP (was 7)
    WRITE_BYTE 0x52 18 // THAC0 (was 19)
    WRITE_BYTE 0x54 13 // SaveVDth (was 16)
    WRITE_BYTE 0x55 15 // SaveVWnd (was 18)
    WRITE_BYTE 0x56 14 // SaveVPoly (was 17)
    WRITE_BYTE 0x57 18 // SaveVAtks (was 20)
    WRITE_BYTE 0x58 17 // SaveVspell (was 19)
    // WRITE_BYTE 0x6e 1 // Unu0(Large swords prof) (was 0)
    // WRITE_BYTE 0x6f 1 // Unu1(Small swords prof) (was 0)
    // WRITE_BYTE 0x70 1 // Unu2(Bows prof) (was 0)
    // WRITE_BYTE 0x71 1 // Unu3(Spears prof) (was 0)
    // WRITE_BYTE 0x72 1 // Unu4(Blunt prof) (was 0)
    // WRITE_BYTE 0x73 1 // Unu5(Spiked prof) (was 0)
    // WRITE_BYTE 0x74 1 // Unu6(Axe prof) (was 0)
    // WRITE_BYTE 0x75 1 // Unu7(Missile prof) (was 0)
    WRITE_ASCII 0x248 ~gensht01~ #8 // Override (was NONE)
    WRITE_ASCII 0x258 ~~ #8 // Race (was KOBOLDF)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~icgob04.cre~ ~override~ //Goblin Captain
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    SAY NAME1 #2599 // LongName (~Goblin Captain~)
    SAY NAME2 #2599 // ShortName (~Goblin Captain~)
    WRITE_SHORT 0x24 26 // CurrHP (was 16)
    WRITE_SHORT 0x26 26 // MaxHP (was 16)
    WRITE_SHORT 0x28 58368 // AnimationID (was 58400)
    WRITE_BYTE 0x242 0 // MrlReco (was 60)
    WRITE_LONG 0x244 1073741824 // KitInfo (was 0)
    WRITE_ASCII 0x258 ~~ #8 // Race (was KOBOLDF)
    WRITE_ASCII 0x260 ~bpleader~ #8 // General (was NONE)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~icliz01.cre~ ~override~ //Lizard Man
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 64 // CurrHP (was 32)
    WRITE_SHORT 0x26 64 // MaxHP (was 32)
    WRITE_BYTE 0x52 14 // THAC0 (was 16)
    WRITE_BYTE 0x54 12 // SaveVDth (was 14)
    WRITE_BYTE 0x55 14 // SaveVWnd (was 16)
    WRITE_BYTE 0x56 13 // SaveVPoly (was 15)
    WRITE_BYTE 0x57 15 // SaveVAtks (was 17)
    WRITE_BYTE 0x58 15 // SaveVspell (was 17)
    WRITE_BYTE 0x234 4 // HighestLevelPrimary (was 2)
    WRITE_BYTE 0x235 4 // HighestLevelSecond (was 2)
    WRITE_BYTE 0x238 18 // Str (was 9)
    WRITE_BYTE 0x239 55 // StrBon (was 0)
    WRITE_BYTE 0x23c 12 // Dex (was 9)
    WRITE_BYTE 0x23d 19 // Con (was 9)
    WRITE_ASCII 0x258 ~bpwdasgt~ #8 // Race (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~ogre01.cre~ ~override~ //Ogre
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    SAY NAME1 #6313 // LongName (~Ogre~)
    SAY NAME2 #6313 // ShortName (~Ogre~)
    WRITE_SHORT 0x24 65 // CurrHP (was 30)
    WRITE_SHORT 0x26 65 // MaxHP (was 30)
    WRITE_BYTE 0x52 12 // THAC0 (was 17)
    WRITE_BYTE 0x53 2 // NOAtt (was 1)
    WRITE_BYTE 0x234 5 // HighestLevelPrimary (was 4)
    WRITE_BYTE 0x235 1 // HighestLevelSecond (was 30)
    WRITE_BYTE 0x23d 19 // Con (was 9)
    WRITE_BYTE 0x242 0 // MrlReco (was 30)
    WRITE_LONG 0x244 1073741824 // KitInfo (was 0)
    WRITE_ASCII 0x258 ~gensht01~ #8 // Race (was OGRE)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    WRITE_BYTE 0x27b 51 // Alignment (was 0)
    REMOVE_CRE_ITEM ~B1-2~
    REPLACE_CRE_ITEM ~BLUN06~ #0 #0 #0 ~NONE~ ~WEAPON1~ EQUIP
  END
BUT_ONLY

COPY_EXISTING ~ogregrsu.cre~ ~override~ //Ogre Berserker
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 47 // CurrHP (was 42)
    WRITE_SHORT 0x26 47 // MaxHP (was 42)
    WRITE_ASCII 0x268 ~bpwtsigt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~ogrema01.cre~ ~override~ //Ogre Mage
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_SHORT 0x24 86 // CurrHP (was 42)
    WRITE_SHORT 0x26 86 // MaxHP (was 42)
    WRITE_BYTE 0x54 8 // SaveVDth (was 11)
    WRITE_BYTE 0x55 11 // SaveVWnd (was 13)
    WRITE_BYTE 0x56 10 // SaveVPoly (was 12)
    WRITE_BYTE 0x57 11 // SaveVAtks (was 13)
    WRITE_BYTE 0x58 10 // SaveVspell (was 14)
    WRITE_BYTE 0x5a 100 // RstCold (was 0)
    WRITE_BYTE 0x5b 50 // RstElec (was 0)
    WRITE_BYTE 0x5f 50 // RstMCld (was 0)
    WRITE_BYTE 0x234 8 // HighestLevelPrimary (was 5)
    WRITE_BYTE 0x235 1 // HighestLevelSecond (was 30)
    WRITE_ASCII 0x248 ~gensht01~ #8 // Override (was NONE)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    REMOVE_MEMORIZED_SPELL ~spwi308~
    ADD_MEMORIZED_SPELL ~spwi104~ #0 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi105~ #0 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi118~ #0 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi206~ #1 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi212~ #1 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi308~ #2 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi311~ #2 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi305~ #2 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi404~ #3 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi405~ #3 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi408~ #3 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi503~ #4 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi508~ #4 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi607~ #5 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi609~ #5 ~wizard~
    REMOVE_CRE_ITEM ~RNDTRE05~
    ADD_CRE_ITEM ~RNDTRE03~ #0 #0 #0 ~NONE~ ~INV~
    ADD_CRE_ITEM ~RNDTRE04~ #0 #0 #0 ~NONE~ ~INV~
  END
BUT_ONLY

COPY_EXISTING ~ogremasu.cre~ ~override~ //Ogre Mage
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 68 // CurrHP (was 52)
    WRITE_SHORT 0x26 68 // MaxHP (was 52)
    WRITE_BYTE 0x234 8 // HighestLevelPrimary (was 6)
    WRITE_BYTE 0x235 1 // HighestLevelSecond (was 30)
    WRITE_ASCII 0x268 ~bpwtsigt~ #8 // Default (was WTASIGHT)
    REMOVE_MEMORIZED_SPELL ~spwi112~
    REMOVE_MEMORIZED_SPELL ~spwi213~
    REMOVE_MEMORIZED_SPELL ~spwi211~
    ADD_MEMORIZED_SPELL ~spwi112~ #0 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi104~ #0 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi105~ #0 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi118~ #0 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi213~ #1 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi211~ #1 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi206~ #1 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi212~ #1 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi311~ #2 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi405~ #3 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi404~ #3 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi408~ #3 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi503~ #4 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi508~ #4 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi607~ #5 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi609~ #5 ~wizard~
  END
BUT_ONLY

COPY_EXISTING ~ogresu.cre~ ~override~ //Ogre
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 63 // CurrHP (was 33)
    WRITE_SHORT 0x26 63 // MaxHP (was 33)
    WRITE_BYTE 0x52 13 // THAC0 (was 17)
    WRITE_BYTE 0x234 6 // HighestLevelPrimary (was 4)
    WRITE_BYTE 0x235 1 // HighestLevelSecond (was 30)
    WRITE_ASCII 0x268 ~bpwtsigt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~ogrhal01.cre~ ~override~ //Half Ogre
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 53 // CurrHP (was 20)
    WRITE_SHORT 0x26 53 // MaxHP (was 20)
    WRITE_BYTE 0x52 15 // THAC0 (was 17)
    WRITE_BYTE 0x53 7 // NOAtt (was 1)
    WRITE_BYTE 0x234 5 // HighestLevelPrimary (was 2)
    WRITE_BYTE 0x235 1 // HighestLevelSecond (was 30)
    WRITE_BYTE 0x23d 18 // Con (was 9)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~ogrill01.cre~ ~override~ //Ogrillon
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 32 // CurrHP (was 19)
    WRITE_SHORT 0x26 32 // MaxHP (was 19)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~ogrmag01.cre~ ~override~ //Ogre Mage
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_LONG 0x1c 43 // Goldcarried (was 0)
    WRITE_SHORT 0x24 84 // CurrHP (was 42)
    WRITE_SHORT 0x26 84 // MaxHP (was 42)
    WRITE_BYTE 0x52 13 // THAC0 (was 14)
    WRITE_BYTE 0x54 10 // SaveVDth (was 11)
    WRITE_BYTE 0x55 11 // SaveVWnd (was 13)
    WRITE_BYTE 0x58 10 // SaveVspell (was 14)
    WRITE_BYTE 0x5a 100 // RstCold (was 0)
    WRITE_BYTE 0x5b 50 // RstElec (was 0)
    WRITE_BYTE 0x5f 50 // RstMCld (was 0)
    WRITE_BYTE 0x234 8 // HighestLevelPrimary (was 5)
    WRITE_BYTE 0x235 1 // HighestLevelSecond (was 30)
    WRITE_BYTE 0x241 255 // Racial (was 0)
    WRITE_ASCII 0x248 ~gensht01~ #8 // Override (was NONE)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    REMOVE_MEMORIZED_SPELL ~spwi308~
    ADD_MEMORIZED_SPELL ~spwi104~ #0 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi118~ #0 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi105~ #0 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi206~ #1 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi212~ #1 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi308~ #2 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi311~ #2 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi305~ #2 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi405~ #3 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi404~ #3 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi408~ #3 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi503~ #4 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi508~ #4 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi607~ #5 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi609~ #5 ~wizard~
    REMOVE_CRE_ITEM ~RNDTRE05~ ~SW1H01~ ~MAGE01~
    REPLACE_CRE_ITEM ~HELM01~ #0 #0 #0 ~NONE~ ~HELMET~
    REPLACE_CRE_ITEM ~SW1H01~ #0 #0 #0 ~NONE~ ~WEAPON1~
    ADD_CRE_ITEM ~RNDTRE04~ #0 #0 #0 ~NONE~ ~INV~
    ADD_CRE_ITEM ~RNDTRE03~ #0 #0 #0 ~NONE~ ~INV~
  END
BUT_ONLY

COPY_EXISTING ~orc01.cre~ ~override~ //Orc
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    SAY NAME1 #34784 // LongName (~Orc~)
    SAY NAME2 #34784 // ShortName (~Orc~)
    WRITE_SHORT 0x24 55 // CurrHP (was 35)
    WRITE_SHORT 0x26 55 // MaxHP (was 35)
    WRITE_SHORT 0x46 6 // ACNatul (was 3)
    WRITE_SHORT 0x48 6 // ACEffec (was 3)
    WRITE_BYTE 0x52 13 // THAC0 (was 17)
    WRITE_BYTE 0x234 6 // HighestLevelPrimary (was 4)
    WRITE_BYTE 0x239 51 // StrBon (was 10)
    WRITE_BYTE 0x23d 19 // Con (was 9)
    WRITE_BYTE 0x242 30 // MrlReco (was 60)
    WRITE_LONG 0x244 1073741824 // KitInfo (was 0)
    WRITE_ASCII 0x258 ~~ #8 // Race (was ORCWAR)
    WRITE_ASCII 0x268 ~bpwtrsgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~orc02.cre~ ~override~ //Orc Archer
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    SAY NAME1 #2197 // LongName (~Orc Archer~)
    SAY NAME2 #2197 // ShortName (~Orc Archer~)
    WRITE_SHORT 0x24 43 // CurrHP (was 35)
    WRITE_SHORT 0x26 43 // MaxHP (was 35)
    WRITE_BYTE 0x52 13 // THAC0 (was 18)
    WRITE_BYTE 0x238 16 // Str (was 11)
    WRITE_BYTE 0x23c 17 // Dex (was 11)
    WRITE_BYTE 0x23d 19 // Con (was 10)
    WRITE_BYTE 0x242 30 // MrlReco (was 60)
    WRITE_LONG 0x244 1073741824 // KitInfo (was 0)
    WRITE_ASCII 0x258 ~~ #8 // Race (was OARCH02)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~orc03.cre~ ~override~ //Orc Priest
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    // SAY NAME2 #2331 // ShortName (was 2332)
    WRITE_BYTE 0x234 10 // HighestLevelPrimary (was 12)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    WRITE_ASCII 0x280 ~orcpriest~ #32 // DeathVariable (was ORC03)
    REMOVE_MEMORIZED_SPELL ~sppr103~
    REMOVE_MEMORIZED_SPELL ~sppr109~
    ADD_MEMORIZED_SPELL ~sppr103~ #0 ~priest~ (2)
    ADD_MEMORIZED_SPELL ~sppr109~ #0 ~priest~ (2)
    ADD_MEMORIZED_SPELL ~sppr101~ #0 ~priest~
    ADD_MEMORIZED_SPELL ~sppr214~ #1 ~priest~
    ADD_MEMORIZED_SPELL ~sppr211~ #1 ~priest~
    ADD_MEMORIZED_SPELL ~sppr301~ #2 ~priest~
    ADD_MEMORIZED_SPELL ~sppr314~ #2 ~priest~
    ADD_MEMORIZED_SPELL ~sppr315~ #2 ~priest~
    ADD_MEMORIZED_SPELL ~sppr411~ #3 ~priest~
    ADD_MEMORIZED_SPELL ~sppr401~ #3 ~priest~
    ADD_MEMORIZED_SPELL ~sppr503~ #4 ~priest~
    ADD_MEMORIZED_SPELL ~sppr511~ #4 ~priest~
  END
BUT_ONLY

COPY_EXISTING ~orc04.cre~ ~override~ //Orc Mage
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 56 // CurrHP (was 30)
    WRITE_SHORT 0x26 56 // MaxHP (was 30)
    WRITE_BYTE 0x234 10 // HighestLevelPrimary (was 12)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    WRITE_ASCII 0x280 ~orcmage~ #32 // DeathVariable (was ORC04)
    ADD_MEMORIZED_SPELL ~spwi114~ #0 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi201~ #1 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi401~ #3 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi418~ #3 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi407~ #3 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi506~ #4 ~wizard~
    REPLACE_CRE_ITEM ~SLNG01~ #0 #0 #0 ~NONE~ ~WEAPON2~
    REPLACE_CRE_ITEM ~BULL01~ #40 #0 #0 ~NONE~ ~QUIVER1~
  END
BUT_ONLY

COPY_EXISTING ~orc05.cre~ ~override~ //Orog
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 48 // CurrHP (was 40)
    WRITE_SHORT 0x26 48 // MaxHP (was 40)
    WRITE_BYTE 0x234 7 // HighestLevelPrimary (was 5)
    WRITE_ASCII 0x258 ~~ #8 // Race (was ORCWAR)
    WRITE_ASCII 0x268 ~bpwtrsgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~orc06.cre~ ~override~ //Orog
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    SAY NAME1 #2327 // LongName (~Orog~)
    SAY NAME2 #2327 // ShortName (~Orog~)
    WRITE_SHORT 0x24 48 // CurrHP (was 40)
    WRITE_SHORT 0x26 48 // MaxHP (was 40)
    WRITE_SHORT 0x28 59136 // AnimationID (was 59152)
    WRITE_BYTE 0x242 30 // MrlReco (was 60)
    WRITE_ASCII 0x258 ~~ #8 // Race (was OARCH02)
    WRITE_ASCII 0x268 ~bpwtrsgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~plshfg01.cre~ ~override~ //Ettin
              ~plshfg02.cre~ ~override~ //Ettin
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x248 ~gensht01~ #8 // Override (was NONE)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    REPLACE_CRE_ITEM ~BOULDER~ #8 #0 #0 ~NONE~ ~WEAPON2~
  END
BUT_ONLY

COPY_EXISTING ~plshhg01.cre~ ~override~ //Hobgoblin Slayer
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_LONG 0x1c 34 // Goldcarried (was 0)
    WRITE_SHORT 0x24 49 // CurrHP (was 10)
    WRITE_SHORT 0x26 49 // MaxHP (was 10)
    WRITE_SHORT 0x46 2 // ACNatul (was 5)
    WRITE_SHORT 0x48 2 // ACEffec (was 5)
    WRITE_BYTE 0x52 14 // THAC0 (was 18)
    WRITE_BYTE 0x54 8 // SaveVDth (was 14)
    WRITE_BYTE 0x55 11 // SaveVWnd (was 16)
    WRITE_BYTE 0x56 10 // SaveVPoly (was 15)
    WRITE_BYTE 0x57 13 // SaveVAtks (was 17)
    WRITE_BYTE 0x58 12 // SaveVspell (was 17)
    WRITE_BYTE 0x234 5 // HighestLevelPrimary (was 2)
    WRITE_BYTE 0x238 18 // Str (was 11)
    WRITE_BYTE 0x239 76 // StrBon (was 0)
    WRITE_BYTE 0x23c 17 // Dex (was 11)
    WRITE_BYTE 0x23d 21 // Con (was 10)
    WRITE_BYTE 0x241 2 // Racial (was 0)
    WRITE_ASCII 0x258 ~~ #8 // Race (was HGARCH01)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    WRITE_BYTE 0x274 1 // IDSSpecifc (was 0)
    WRITE_BYTE 0x27b 19 // Alignment (was 0)
  END
BUT_ONLY

COPY_EXISTING ~plshhg02.cre~ ~override~ //Hobgoblin Wizard

  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 36 // CurrHP (was 20)
    WRITE_SHORT 0x26 36 // MaxHP (was 20)
    WRITE_BYTE 0x234 6 // HighestLevelPrimary (was 10)
    WRITE_BYTE 0x23a 17 // Int (was 9)
    WRITE_BYTE 0x23c 15 // Dex (was 9)
    WRITE_ASCII 0x250 ~bpmage6~ #8 // Class (was NONE)
    WRITE_ASCII 0x260 ~~ #8 // General (was HGWIZ01)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    WRITE_BYTE 0x274 1 // IDSSpecifc (was 0)
    WRITE_BYTE 0x27b 19 // Alignment (was 0)
    REMOVE_MEMORIZED_SPELL ~spwi112~
    REMOVE_MEMORIZED_SPELL ~spwi217~
    ADD_MEMORIZED_SPELL ~spwi112~ #0 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi118~ #0 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi103~ #0 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi106~ #0 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi217~ #1 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi205~ #1 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi213~ #1 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi211~ #1 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi317~ #2 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi303~ #2 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi401~ #3 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi408~ #3 ~wizard~ (2)
  END
BUT_ONLY

COPY_EXISTING ~plshom01.cre~ ~override~ //Ogre Mage
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 82 // CurrHP (was 52)
    WRITE_SHORT 0x26 82 // MaxHP (was 52)
    WRITE_BYTE 0x52 13 // THAC0 (was 10)
    WRITE_BYTE 0x57 13 // SaveVAtks (was 12)
    WRITE_BYTE 0x58 11 // SaveVspell (was 13)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~plyflind.cre~ ~override~ //Flind
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    // SAY NAME1 #19713 // LongName (was 19712)
    // WRITE_LONG 0x10 83886081 // CreatureFlags (was 0)
    // WRITE_BYTE 0x33 0 // Effversion (was 1)
    WRITE_SHORT 0x46 5 // ACNatul (was 1)
    WRITE_SHORT 0x48 5 // ACEffec (was 1)
    WRITE_ASCII 0x258 ~bpwdasgt~ #8 // Race (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~plyogre.cre~ ~override~ //Ogre
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 64 // CurrHP (was 30)
    WRITE_SHORT 0x26 64 // MaxHP (was 30)
    WRITE_BYTE 0x52 15 // THAC0 (was 17)
    WRITE_BYTE 0x53 7 // NOAtt (was 1)
    // WRITE_BYTE 0x6e 2 // Unu0(Large swords prof) (was 0)
    // WRITE_BYTE 0x6f 2 // Unu1(Small swords prof) (was 0)
    // WRITE_BYTE 0x70 2 // Unu2(Bows prof) (was 0)
    // WRITE_BYTE 0x71 2 // Unu3(Spears prof) (was 0)
    // WRITE_BYTE 0x72 2 // Unu4(Blunt prof) (was 0)
    // WRITE_BYTE 0x74 2 // Unu6(Axe prof) (was 0)
    // WRITE_BYTE 0x75 2 // Unu7(Missile prof) (was 0)
    WRITE_BYTE 0x234 6 // HighestLevelPrimary (was 4)
    WRITE_BYTE 0x235 1 // HighestLevelSecond (was 30)
    WRITE_ASCII 0x258 ~gensht01~ #8 // Race (was OGRE)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    WRITE_BYTE 0x27b 51 // Alignment (was 0)
  END
BUT_ONLY

COPY_EXISTING ~uhogre01.cre~ ~override~ //Madulf
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    // WRITE_BYTE 0x72 3 // Unu4(Blunt prof) (was 0)
    WRITE_ASCII 0x260 ~bpmage3~ #8 // General (was GPSHOUT)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    WRITE_BYTE 0x274 1 // IDSSpecifc (was 6)
  END
BUT_ONLY

COPY_EXISTING ~uhogre02.cre~ ~override~ //Ogre
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 67 // CurrHP (was 35)
    WRITE_SHORT 0x26 67 // MaxHP (was 35)
    WRITE_BYTE 0x52 15 // THAC0 (was 17)
    WRITE_BYTE 0x53 7 // NOAtt (was 1)
    // WRITE_BYTE 0x6e 2 // Unu0(Large swords prof) (was 0)
    // WRITE_BYTE 0x6f 2 // Unu1(Small swords prof) (was 0)
    // WRITE_BYTE 0x70 2 // Unu2(Bows prof) (was 0)
    // WRITE_BYTE 0x71 2 // Unu3(Spears prof) (was 0)
    // WRITE_BYTE 0x72 2 // Unu4(Blunt prof) (was 0)
    // WRITE_BYTE 0x74 2 // Unu6(Axe prof) (was 0)
    // WRITE_BYTE 0x75 2 // Unu7(Missile prof) (was 0)
    WRITE_BYTE 0x234 6 // HighestLevelPrimary (was 4)
    WRITE_BYTE 0x23d 19 // Con (was 9)
    WRITE_ASCII 0x258 ~~ #8 // Race (was OGRE)
    WRITE_ASCII 0x260 ~~ #8 // General (was GPSHOUT)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    WRITE_BYTE 0x274 1 // IDSSpecifc (was 6)
  END
BUT_ONLY

COPY_EXISTING ~uhogre03.cre~ ~override~ //Minotaur
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 68 // CurrHP (was 45)
    WRITE_SHORT 0x26 68 // MaxHP (was 45)
    // WRITE_BYTE 0x74 5 // Unu6(Axe prof) (was 0)
    WRITE_BYTE 0x239 95 // StrBon (was 0)
    WRITE_BYTE 0x23a 14 // Int (was 10)
    WRITE_ASCII 0x268 ~wgarsgt~ #8 // Default (was WTASIGHT)
    WRITE_BYTE 0x274 1 // IDSSpecifc (was 6)
  END
BUT_ONLY

COPY_EXISTING ~uhogre04.cre~ ~override~ //Gnoll
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 48 // CurrHP (was 32)
    WRITE_SHORT 0x26 48 // MaxHP (was 32)
    WRITE_ASCII 0x260 ~~ #8 // General (was GPSHOUT)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    WRITE_BYTE 0x274 1 // IDSSpecifc (was 6)
  END
BUT_ONLY

COPY_EXISTING ~uhogre05.cre~ ~override~ //Orc
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 53 // CurrHP (was 40)
    WRITE_SHORT 0x26 53 // MaxHP (was 40)
    WRITE_BYTE 0x52 14 // THAC0 (was 16)
    // WRITE_BYTE 0x6e 2 // Unu0(Large swords prof) (was 0)
    // WRITE_BYTE 0x6f 2 // Unu1(Small swords prof) (was 0)
    // WRITE_BYTE 0x72 2 // Unu4(Blunt prof) (was 0)
    // WRITE_BYTE 0x73 2 // Unu5(Spiked prof) (was 0)
    // WRITE_BYTE 0x74 2 // Unu6(Axe prof) (was 0)
    // WRITE_BYTE 0x75 2 // Unu7(Missile prof) (was 0)
    WRITE_BYTE 0x23d 19 // Con (was 9)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    WRITE_BYTE 0x274 1 // IDSSpecifc (was 6)
  END
BUT_ONLY

COPY_EXISTING ~udogre.cre~ ~override~ //Ogre
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 278 // CurrHP (was 240)
    WRITE_SHORT 0x26 278 // MaxHP (was 240)
    WRITE_BYTE 0x54 8 // SaveVDth (was 0)
    WRITE_BYTE 0x55 11 // SaveVWnd (was 0)
    WRITE_BYTE 0x56 10 // SaveVPoly (was 0)
    WRITE_BYTE 0x57 12 // SaveVAtks (was 0)
    WRITE_BYTE 0x58 10 // SaveVspell (was 0)
    // WRITE_BYTE 0x6e 3 // Unu0(Large swords prof) (was 0)
    // WRITE_BYTE 0x6f 3 // Unu1(Small swords prof) (was 0)
    // WRITE_BYTE 0x70 3 // Unu2(Bows prof) (was 0)
    // WRITE_BYTE 0x71 3 // Unu3(Spears prof) (was 0)
    // WRITE_BYTE 0x72 3 // Unu4(Blunt prof) (was 0)
    // WRITE_BYTE 0x74 3 // Unu6(Axe prof) (was 0)
    // WRITE_BYTE 0x75 3 // Unu7(Missile prof) (was 0)
    WRITE_ASCII 0x258 ~bpwdasgt~ #8 // Race (was OGRE)
    REMOVE_CRE_ITEM ~B1-2~
    REPLACE_CRE_ITEM ~OGRE~ #0 #0 #0 ~NONE~ ~WEAPON1~ EQUIP
  END
BUT_ONLY

COPY_EXISTING ~ttkob.cre~ ~override~ //Kobold
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 7 // CurrHP (was 4)
    WRITE_SHORT 0x26 7 // MaxHP (was 4)
    WRITE_ASCII 0x248 ~~ #8 // Override (was TTKOB)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~swsfoll1.cre~ ~override~ //Kobold Commando
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 15 // CurrHP (was 7)
    WRITE_SHORT 0x26 15 // MaxHP (was 7)
    WRITE_ASCII 0x248 ~bpshout~ #8 // Override (was GENSHT01)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~swsfoll2.cre~ ~override~ //Kobold
              ~swsfoll3.cre~ ~override~ //Kobold
              ~swsfoll4.cre~ ~override~ //Kobold
              ~swsfoll5.cre~ ~override~ //Kobold
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 15 // CurrHP (was 4)
    WRITE_SHORT 0x26 15 // MaxHP (was 4)
    WRITE_ASCII 0x248 ~bpshout~ #8 // Override (was GENSHT01)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~swsfoll6.cre~ ~override~ //Kobold Commando
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 18 // CurrHP (was 7)
    WRITE_SHORT 0x26 18 // MaxHP (was 7)
    WRITE_ASCII 0x248 ~bpshout~ #8 // Override (was GENSHT01)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~swshaman.cre~ ~override~ //Kobold Shaman
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 28 // CurrHP (was 38)
    WRITE_SHORT 0x26 28 // MaxHP (was 38)
    WRITE_BYTE 0x23b 14 // Wis (was 9)
    WRITE_ASCII 0x248 ~bpshout~ #8 // Override (was GENSHT01)
    WRITE_ASCII 0x258 ~swkobold~ #8 // Race (was NONE)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    REMOVE_MEMORIZED_SPELL ~sppr208~
    ADD_MEMORIZED_SPELL ~sppr101~ #0 ~priest~
    ADD_MEMORIZED_SPELL ~sppr208~ #1 ~priest~ (4)
    ADD_MEMORIZED_SPELL ~sppr214~ #1 ~priest~ (2)
  END
BUT_ONLY

COPY_EXISTING ~rorca01.cre~ ~override~ //Orc Archer
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 47 // CurrHP (was 30)
    WRITE_SHORT 0x26 47 // MaxHP (was 30)
    WRITE_SHORT 0x48 4 // ACEffec (was 10)
    WRITE_BYTE 0x52 15 // THAC0 (was 17)
    WRITE_BYTE 0x53 2 // NOAtt (was 1)
    // WRITE_BYTE 0x6e 1 // Unu0(Large swords prof) (was 0)
    // WRITE_BYTE 0x70 3 // Unu2(Bows prof) (was 1)
    // WRITE_BYTE 0x71 1 // Unu3(Spears prof) (was 0)
    // WRITE_BYTE 0x72 1 // Unu4(Blunt prof) (was 0)
    // WRITE_BYTE 0x73 1 // Unu5(Spiked prof) (was 0)
    // WRITE_BYTE 0x74 1 // Unu6(Axe prof) (was 0)
    // WRITE_BYTE 0x75 1 // Unu7(Missile prof) (was 0)
    WRITE_BYTE 0x234 5 // HighestLevelPrimary (was 3)
    WRITE_BYTE 0x23c 17 // Dex (was 9)
    WRITE_BYTE 0x23d 19 // Con (was 9)
    WRITE_ASCII 0x258 ~gensht01~ #8 // Race (was OARCH02)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~bogre1.cre~ ~override~ //Ogre
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_SHORT 0x24 65 // CurrHP (was 50)
    WRITE_SHORT 0x26 65 // MaxHP (was 50)
    WRITE_BYTE 0x52 13 // THAC0 (was 14)
    WRITE_BYTE 0x53 7 // NOAtt (was 1)
    // WRITE_BYTE 0x6e 3 // Unu0(Large swords prof) (was 0)
    // WRITE_BYTE 0x6f 3 // Unu1(Small swords prof) (was 0)
    // WRITE_BYTE 0x70 3 // Unu2(Bows prof) (was 0)
    // WRITE_BYTE 0x71 3 // Unu3(Spears prof) (was 0)
    // WRITE_BYTE 0x74 3 // Unu6(Axe prof) (was 0)
    // WRITE_BYTE 0x75 3 // Unu7(Missile prof) (was 0)
    WRITE_BYTE 0x234 6 // HighestLevelPrimary (was 4)
    WRITE_BYTE 0x238 18 // Str (was 19)
    WRITE_ASCII 0x258 ~~ #8 // Race (was OGRE)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    WRITE_BYTE 0x27b 51 // Alignment (was 50)
    REMOVE_CRE_ITEM ~B1-2~
    REPLACE_CRE_ITEM ~OGRE1~ #0 #0 #0 ~UNSTEALABLE&UNDROPPABLE~ ~WEAPON1~ EQUIP
  END
BUT_ONLY

COPY_EXISTING ~xvart01.cre~ ~override~ //Xvart
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 11 // CurrHP (was 7)
    WRITE_SHORT 0x26 11 // MaxHP (was 7)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY ~bp/cre/gibbmout.cre~ ~override~
  SAY NAME1 @216 //Gibberling Mother
  SAY NAME2 @216 //Gibberling Mother
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END


END

/////////////////////////////////////////////////////////////////////////////////////////
DEFINE_ACTION_FUNCTION mind_flayers BEGIN

INCLUDE ~bp/lib/bp_main.tph~

LAF mind_flayer_scripts END


COPY_EXISTING ~mindal01.cre~ ~override~ //Alhoon
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 68 // CurrHP (was 74)
    WRITE_SHORT 0x26 68 // MaxHP (was 74)
    WRITE_SHORT 0x46 5 // ACNatul (was 2)
    WRITE_SHORT 0x48 5 // ACEffec (was 2)
    WRITE_BYTE 0x234 8 // HighestLevelPrimary (was 16)
    WRITE_BYTE 0x238 10 // Str (was 17)
    WRITE_BYTE 0x23c 10 // Dex (was 11)
    WRITE_ASCII 0x260 ~bpmindal~ #8 // General (was MINDAL01)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    WRITE_BYTE 0x271 1 // IDSGeneral (was 4)
    // WRITE_BYTE 0x272 1 // IDSRace (was 124)
    WRITE_BYTE 0x273 7 // IDSClass (was 162)
  END
BUT_ONLY

COPY_EXISTING ~damind1.cre~ ~override~ //Mind Flayer
              ~damind2.cre~ ~override~ //Mind Flayer
              ~elmind01.cre~ ~override~ //Mind Flayer
              ~eleill01.cre~ ~override~ //Mind Flayer
              ~mindfl01.cre~ ~override~ //Mind Flayer
              ~mindul01.cre~ ~override~ //Ulitharid
              ~udill01.cre~ ~override~ //Mind Flayer
              ~udmind01.cre~ ~override~ //Mind Flayer
              ~udmind02.cre~ ~override~ //Mind Flayer
              ~udmind03.cre~ ~override~ //Mind Flayer
              ~udmind04.cre~ ~override~ //Mind Flayer
              ~udmind10.cre~ ~override~ //Mind Flayer
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_ASCII 0x260 ~bpflayr1~ #8
    WRITE_ASCII 0x268 ~bpwdasgt~ #8
  END
BUT_ONLY


END

/////////////////////////////////////////////////////////////////////////////////////////

DEFINE_ACTION_FUNCTION mists BEGIN

INCLUDE ~bp/lib/bp_main.tph~

LAF mist_scripts END



ACTION_IF FILE_EXISTS_IN_GAME ~darkmist.cre~ BEGIN
  COPY_EXISTING ~darkmist.cre~ ~override~ //Dark Mist
    WRITE_LONG 0x10 0 //Flags (was 0x800 exportable)
    WRITE_SHORT 0x24 85 //Current HP
    WRITE_SHORT 0x26 85 //Maximum HP
    WRITE_LONG 0x244 0 //Kit (was 0x4015 Lathander)
    WRITE_ASCII 0x268 ~bpally~ #8 //Default script (was wtasight)
    WRITE_BYTE 0x27b 0x22 //Alignment (neutral, was LG)
    REMOVE_CRE_ITEM ~unknown~
  BUT_ONLY
END ELSE BEGIN
  COPY ~bp/cre/darkmist.cre~ ~override~
    SAY NAME1 @180 //Dark Mist
    SAY NAME2 @180 //Dark Mist
END

COPY_EXISTING ~hgmis01.cre~ ~override~ //Vampiric Wraith
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    // SAY NAME1 #71090 // LongName (was 71089)
    WRITE_SHORT 0x24 95 // CurrHP (was 65)
    WRITE_SHORT 0x26 95 // MaxHP (was 65)
    WRITE_BYTE 0x234 10 // HighestLevelPrimary (was 15)
    WRITE_ASCII 0x250 ~bpmag14m~ #8 // Class (was NONE)
    WRITE_ASCII 0x268 ~bpwtsigt~ #8 
    REMOVE_MEMORIZED_SPELL ~spwi112~
    REMOVE_MEMORIZED_SPELL ~spwi212~
    REMOVE_MEMORIZED_SPELL ~spwi304~
    REMOVE_MEMORIZED_SPELL ~spwi308~
    REMOVE_MEMORIZED_SPELL ~spwi402~
    REMOVE_MEMORIZED_SPELL ~spwi415~
    REMOVE_MEMORIZED_SPELL ~spwi502~
    REMOVE_MEMORIZED_SPELL ~spwi504~
    REMOVE_MEMORIZED_SPELL ~spwi602~
    REMOVE_MEMORIZED_SPELL ~spwi604~
    ADD_MEMORIZED_SPELL ~spwi106~ #0 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi105~ #0 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi125~ #0 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi212~ #1 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi201~ #1 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi205~ #1 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi305~ #2 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi317~ #2 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi314~ #2 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi405~ #3 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi409~ #3 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi412~ #3 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi419~ #3 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi512~ #4 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi513~ #4 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi607~ #5 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi618~ #5 ~wizard~
    ADD_MEMORIZED_SPELL ~sumshad~ #0 ~innate~ (3)
  END
BUT_ONLY

COPY_EXISTING ~hgmis02.cre~ ~override~ //Swamp Horror
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x258 ~bpmag14m~ #8 // Race (was NONE)
    WRITE_ASCII 0x268 ~bpwtsigt~ #8 
    REMOVE_KNOWN_SPELL ~spwi112~
    REMOVE_KNOWN_SPELL ~spwi304~
    REMOVE_KNOWN_SPELL ~spwi502~
    REMOVE_KNOWN_SPELL ~spwi402~
    REMOVE_KNOWN_SPELL ~spwi602~
    REMOVE_KNOWN_SPELL ~spwi415~
    REMOVE_KNOWN_SPELL ~spwi308~
    REMOVE_KNOWN_SPELL ~spwi604~
    REMOVE_KNOWN_SPELL ~spwi504~
    REMOVE_MEMORIZED_SPELL ~spwi112~
    REMOVE_MEMORIZED_SPELL ~spwi212~
    REMOVE_MEMORIZED_SPELL ~spwi304~
    REMOVE_MEMORIZED_SPELL ~spwi308~
    REMOVE_MEMORIZED_SPELL ~spwi402~
    REMOVE_MEMORIZED_SPELL ~spwi415~
    REMOVE_MEMORIZED_SPELL ~spwi502~
    REMOVE_MEMORIZED_SPELL ~spwi504~
    REMOVE_MEMORIZED_SPELL ~spwi602~
    REMOVE_MEMORIZED_SPELL ~spwi604~
    ADD_MEMORIZED_SPELL ~spwi106~ #0 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi105~ #0 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi125~ #0 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi212~ #1 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi205~ #1 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi201~ #1 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi305~ #2 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi317~ #2 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi314~ #2 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi405~ #3 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi409~ #3 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi412~ #3 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi419~ #3 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi512~ #4 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi513~ #4 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi607~ #5 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi618~ #5 ~wizard~
    ADD_MEMORIZED_SPELL ~sumshad~ #0 ~innate~ (3)
  END
BUT_ONLY

COPY_EXISTING ~hgwra02.cre~ ~override~ //Devil Shade
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x258 ~bpmag14m~ #8 // Race (was NONE)
    WRITE_ASCII 0x268 ~bpwtsigt~ #8 
    REMOVE_KNOWN_SPELL ~spwi112~
    REMOVE_KNOWN_SPELL ~spwi304~
    REMOVE_KNOWN_SPELL ~spwi502~
    REMOVE_KNOWN_SPELL ~spwi402~
    REMOVE_KNOWN_SPELL ~spwi602~
    REMOVE_KNOWN_SPELL ~spwi415~
    REMOVE_KNOWN_SPELL ~spwi308~
    REMOVE_KNOWN_SPELL ~spwi604~
    REMOVE_KNOWN_SPELL ~spwi504~
    REMOVE_MEMORIZED_SPELL ~spwi112~
    REMOVE_MEMORIZED_SPELL ~spwi212~
    REMOVE_MEMORIZED_SPELL ~spwi304~
    REMOVE_MEMORIZED_SPELL ~spwi308~
    REMOVE_MEMORIZED_SPELL ~spwi402~
    REMOVE_MEMORIZED_SPELL ~spwi415~
    REMOVE_MEMORIZED_SPELL ~spwi502~
    REMOVE_MEMORIZED_SPELL ~spwi504~
    REMOVE_MEMORIZED_SPELL ~spwi602~
    REMOVE_MEMORIZED_SPELL ~spwi604~
    ADD_MEMORIZED_SPELL ~spwi106~ #0 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi105~ #0 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi125~ #0 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi205~ #1 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi201~ #1 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi212~ #1 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi305~ #2 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi317~ #2 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi314~ #2 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi419~ #3 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi405~ #3 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi409~ #3 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi412~ #3 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi512~ #4 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi513~ #4 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi607~ #5 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi618~ #5 ~wizard~
    ADD_MEMORIZED_SPELL ~sumshad~ #0 ~innate~ (3)
  END
BUT_ONLY

COPY_EXISTING ~hgwra03.cre~ ~override~ //Devil Shade
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    // SAY NAME1 #70867 // LongName (was 70866)
    WRITE_ASCII 0x248 ~bpmag14m~ #8 // Override (was NONE)
    WRITE_ASCII 0x268 ~bpwtsigt~ #8 
    REMOVE_KNOWN_SPELL ~spwi112~
    REMOVE_KNOWN_SPELL ~spwi304~
    REMOVE_KNOWN_SPELL ~spwi502~
    REMOVE_KNOWN_SPELL ~spwi402~
    REMOVE_KNOWN_SPELL ~spwi602~
    REMOVE_KNOWN_SPELL ~spwi415~
    REMOVE_KNOWN_SPELL ~spwi308~
    REMOVE_KNOWN_SPELL ~spwi604~
    REMOVE_KNOWN_SPELL ~spwi504~
    REMOVE_MEMORIZED_SPELL ~spwi112~
    REMOVE_MEMORIZED_SPELL ~spwi212~
    REMOVE_MEMORIZED_SPELL ~spwi304~
    REMOVE_MEMORIZED_SPELL ~spwi308~
    REMOVE_MEMORIZED_SPELL ~spwi402~
    REMOVE_MEMORIZED_SPELL ~spwi415~
    REMOVE_MEMORIZED_SPELL ~spwi502~
    REMOVE_MEMORIZED_SPELL ~spwi504~
    REMOVE_MEMORIZED_SPELL ~spwi602~
    REMOVE_MEMORIZED_SPELL ~spwi604~
    ADD_MEMORIZED_SPELL ~spwi106~ #0 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi105~ #0 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi125~ #0 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi205~ #1 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi201~ #1 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi212~ #1 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi305~ #2 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi317~ #2 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi314~ #2 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi419~ #3 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi405~ #3 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi409~ #3 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi412~ #3 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi512~ #4 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi513~ #4 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi607~ #5 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi618~ #5 ~wizard~
    ADD_MEMORIZED_SPELL ~sumshad~ #0 ~innate~ (3)
  END
BUT_ONLY

COPY_EXISTING ~mistcd01.cre~ ~override~ //Crimson Death
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 64 // CurrHP (was 104)
    WRITE_SHORT 0x26 64 // MaxHP (was 104)
    WRITE_BYTE 0x52 10 // THAC0 (was 7)
    WRITE_BYTE 0x234 8 // HighestLevelPrimary (was 12)
    WRITE_ASCII 0x268 ~bpshadow~ #8 // Default (was WTASIGHT)
    REMOVE_KNOWN_SPELL ~spwi112~
    REMOVE_KNOWN_SPELL ~spwi304~
    REMOVE_KNOWN_SPELL ~spwi505~
    REMOVE_KNOWN_SPELL ~spwi502~
    REMOVE_KNOWN_SPELL ~spwi402~
    REMOVE_KNOWN_SPELL ~spwi601~
    REMOVE_KNOWN_SPELL ~spwi602~
    REMOVE_KNOWN_SPELL ~spwi501~
    REMOVE_KNOWN_SPELL ~spwi415~
    REMOVE_KNOWN_SPELL ~spwi308~
    REMOVE_KNOWN_SPELL ~spwi604~
    REMOVE_KNOWN_SPELL ~spwi504~
    REMOVE_KNOWN_SPELL ~spwi508~
    REMOVE_MEMORIZED_SPELL ~spwi112~
    REMOVE_MEMORIZED_SPELL ~spwi212~
    REMOVE_MEMORIZED_SPELL ~spwi304~
    REMOVE_MEMORIZED_SPELL ~spwi308~
    REMOVE_MEMORIZED_SPELL ~spwi402~
    REMOVE_MEMORIZED_SPELL ~spwi415~
    REMOVE_MEMORIZED_SPELL ~spwi501~
    REMOVE_MEMORIZED_SPELL ~spwi502~
    REMOVE_MEMORIZED_SPELL ~spwi505~
    REMOVE_MEMORIZED_SPELL ~spwi504~
    REMOVE_MEMORIZED_SPELL ~spwi508~
    REMOVE_MEMORIZED_SPELL ~spwi601~
    REMOVE_MEMORIZED_SPELL ~spwi602~
    REMOVE_MEMORIZED_SPELL ~spwi604~
    ADD_MEMORIZED_SPELL ~spwi105~ #0 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi106~ #0 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi205~ #1 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi213~ #1 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi314~ #2 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi412~ #3 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi511~ #4 ~wizard~
  END
BUT_ONLY

COPY_EXISTING ~mistho01.cre~ ~override~ //Mist Horror
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 48 // CurrHP (was 50)
    WRITE_SHORT 0x26 48 // MaxHP (was 50)
    WRITE_BYTE 0x52 13 // THAC0 (was 10)
    WRITE_BYTE 0x234 6 // HighestLevelPrimary (was 12)
    WRITE_ASCII 0x268 ~bpshadow~ #8 // Default (was WTASIGHT)
    REMOVE_KNOWN_SPELL ~spwi112~
    REMOVE_KNOWN_SPELL ~spwi304~
    REMOVE_KNOWN_SPELL ~spwi505~
    REMOVE_KNOWN_SPELL ~spwi502~
    REMOVE_KNOWN_SPELL ~spwi402~
    REMOVE_KNOWN_SPELL ~spwi601~
    REMOVE_KNOWN_SPELL ~spwi602~
    REMOVE_KNOWN_SPELL ~spwi501~
    REMOVE_KNOWN_SPELL ~spwi415~
    REMOVE_KNOWN_SPELL ~spwi308~
    REMOVE_KNOWN_SPELL ~spwi604~
    REMOVE_KNOWN_SPELL ~spwi504~
    REMOVE_MEMORIZED_SPELL ~spwi112~
    REMOVE_MEMORIZED_SPELL ~spwi212~
    REMOVE_MEMORIZED_SPELL ~spwi304~
    REMOVE_MEMORIZED_SPELL ~spwi308~
    REMOVE_MEMORIZED_SPELL ~spwi402~
    REMOVE_MEMORIZED_SPELL ~spwi415~
    REMOVE_MEMORIZED_SPELL ~spwi501~
    REMOVE_MEMORIZED_SPELL ~spwi502~
    REMOVE_MEMORIZED_SPELL ~spwi505~
    REMOVE_MEMORIZED_SPELL ~spwi504~
    REMOVE_MEMORIZED_SPELL ~spwi601~
    REMOVE_MEMORIZED_SPELL ~spwi602~
    REMOVE_MEMORIZED_SPELL ~spwi604~
    ADD_MEMORIZED_SPELL ~spwi106~ #0 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi125~ #0 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi201~ #1 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi205~ #1 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi212~ #1 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi312~ #2 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi314~ #2 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi412~ #3 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi411~ #3 ~wizard~
  END
BUT_ONLY

COPY_EXISTING ~mistpo01.cre~ ~override~ //Poison Mist
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_BYTE 0x52 13 // THAC0 (was 10)
    WRITE_ASCII 0x268 ~bpshadow~ #8 // Default (was WTASIGHT)
    REMOVE_KNOWN_SPELL ~spwi112~
    REMOVE_KNOWN_SPELL ~spwi304~
    REMOVE_KNOWN_SPELL ~spwi505~
    REMOVE_KNOWN_SPELL ~spwi306~
    REMOVE_KNOWN_SPELL ~spwi402~
    REMOVE_KNOWN_SPELL ~spwi601~
    REMOVE_KNOWN_SPELL ~spwi602~
    REMOVE_KNOWN_SPELL ~spwi501~
    REMOVE_KNOWN_SPELL ~spwi415~
    REMOVE_KNOWN_SPELL ~spwi308~
    REMOVE_KNOWN_SPELL ~spwi604~
    REMOVE_KNOWN_SPELL ~spwi504~
    REMOVE_KNOWN_SPELL ~spwi508~
    REMOVE_MEMORIZED_SPELL ~spwi112~
    REMOVE_MEMORIZED_SPELL ~spwi212~
    REMOVE_MEMORIZED_SPELL ~spwi304~
    REMOVE_MEMORIZED_SPELL ~spwi306~
    REMOVE_MEMORIZED_SPELL ~spwi308~
    REMOVE_MEMORIZED_SPELL ~spwi402~
    REMOVE_MEMORIZED_SPELL ~spwi415~
    REMOVE_MEMORIZED_SPELL ~spwi501~
    REMOVE_MEMORIZED_SPELL ~spwi505~
    REMOVE_MEMORIZED_SPELL ~spwi504~
    REMOVE_MEMORIZED_SPELL ~spwi508~
    REMOVE_MEMORIZED_SPELL ~spwi601~
    REMOVE_MEMORIZED_SPELL ~spwi602~
    REMOVE_MEMORIZED_SPELL ~spwi604~
    ADD_MEMORIZED_SPELL ~spwi119~ #0 ~wizard~ (3)
    ADD_MEMORIZED_SPELL ~spwi212~ #1 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi201~ #1 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi211~ #1 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi409~ #3 ~wizard~
  END
BUT_ONLY

COPY_EXISTING ~mistva01.cre~ ~override~ //Vampiric Mist
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_BYTE 0x52 13 // THAC0 (was 0)
    WRITE_ASCII 0x268 ~bpshadow~ #8 // Default (was WTASIGHT)
    REMOVE_KNOWN_SPELL ~spwi112~
    REMOVE_KNOWN_SPELL ~spwi304~
    REMOVE_KNOWN_SPELL ~spwi505~
    REMOVE_KNOWN_SPELL ~spwi502~
    REMOVE_KNOWN_SPELL ~spwi402~
    REMOVE_KNOWN_SPELL ~spwi601~
    REMOVE_KNOWN_SPELL ~spwi602~
    REMOVE_KNOWN_SPELL ~spwi501~
    REMOVE_KNOWN_SPELL ~spwi415~
    REMOVE_KNOWN_SPELL ~spwi308~
    REMOVE_KNOWN_SPELL ~spwi604~
    REMOVE_KNOWN_SPELL ~spwi504~
    REMOVE_KNOWN_SPELL ~spwi508~
    REMOVE_MEMORIZED_SPELL ~spwi112~
    REMOVE_MEMORIZED_SPELL ~spwi212~
    REMOVE_MEMORIZED_SPELL ~spwi304~
    REMOVE_MEMORIZED_SPELL ~spwi308~
    REMOVE_MEMORIZED_SPELL ~spwi402~
    REMOVE_MEMORIZED_SPELL ~spwi415~
    REMOVE_MEMORIZED_SPELL ~spwi501~
    REMOVE_MEMORIZED_SPELL ~spwi502~
    REMOVE_MEMORIZED_SPELL ~spwi505~
    REMOVE_MEMORIZED_SPELL ~spwi504~
    REMOVE_MEMORIZED_SPELL ~spwi508~
    REMOVE_MEMORIZED_SPELL ~spwi601~
    REMOVE_MEMORIZED_SPELL ~spwi602~
    REMOVE_MEMORIZED_SPELL ~spwi604~
    ADD_MEMORIZED_SPELL ~spwi125~ #0 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi119~ #0 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi205~ #1 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi212~ #1 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi218~ #1 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi314~ #2 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi409~ #3 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi412~ #3 ~wizard~
  END
BUT_ONLY

COPY_EXISTING ~mistwa01.cre~ ~override~ //Wandering Horror
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_BYTE 0x52 11 // THAC0 (was 7)
    WRITE_BYTE 0x234 10 // HighestLevelPrimary (was 12)
    WRITE_ASCII 0x268 ~bpshadow~ #8 // Default (was WTASIGHT)
    REMOVE_KNOWN_SPELL ~spwi112~
    REMOVE_KNOWN_SPELL ~spwi304~
    REMOVE_KNOWN_SPELL ~spwi505~
    REMOVE_KNOWN_SPELL ~spwi502~
    REMOVE_KNOWN_SPELL ~spwi402~
    REMOVE_KNOWN_SPELL ~spwi601~
    REMOVE_KNOWN_SPELL ~spwi602~
    REMOVE_KNOWN_SPELL ~spwi501~
    REMOVE_KNOWN_SPELL ~spwi415~
    REMOVE_KNOWN_SPELL ~spwi308~
    REMOVE_KNOWN_SPELL ~spwi604~
    REMOVE_KNOWN_SPELL ~spwi504~
    REMOVE_MEMORIZED_SPELL ~spwi112~
    REMOVE_MEMORIZED_SPELL ~spwi212~
    REMOVE_MEMORIZED_SPELL ~spwi304~
    REMOVE_MEMORIZED_SPELL ~spwi308~
    REMOVE_MEMORIZED_SPELL ~spwi402~
    REMOVE_MEMORIZED_SPELL ~spwi415~
    REMOVE_MEMORIZED_SPELL ~spwi501~
    REMOVE_MEMORIZED_SPELL ~spwi502~
    REMOVE_MEMORIZED_SPELL ~spwi505~
    REMOVE_MEMORIZED_SPELL ~spwi504~
    REMOVE_MEMORIZED_SPELL ~spwi601~
    REMOVE_MEMORIZED_SPELL ~spwi602~
    REMOVE_MEMORIZED_SPELL ~spwi604~
    ADD_MEMORIZED_SPELL ~spwi105~ #0 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi125~ #0 ~wizard~ (3)
    ADD_MEMORIZED_SPELL ~spwi201~ #1 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi205~ #1 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi212~ #1 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi317~ #2 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi312~ #2 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi405~ #3 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi411~ #3 ~wizard~
  END
BUT_ONLY


END

/////////////////////////////////////////////////////////////////////////////////////////
DEFINE_ACTION_FUNCTION sea_devils BEGIN
INCLUDE ~bp/lib/bp_main.tph~

LAF sea_devil_scripts END

ACTION_IF NOT FILE_EXISTS_IN_GAME ~sahspy01.cre~ BEGIN
  COPY ~bp/cre/sahspy01.cre~ ~override~
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 
  END
END

ACTION_IF NOT FILE_EXISTS_IN_GAME ~sahspy02.cre~ BEGIN
  COPY ~bp/cre/sahspy02.cre~ ~override~
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 
  END
END

ACTION_IF NOT FILE_EXISTS_IN_GAME ~sahspy03.cre~ BEGIN
  COPY ~bp/cre/sahspy03.cre~ ~override~
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 
  END
END

ACTION_IF NOT FILE_EXISTS_IN_GAME ~sahspy04.cre~ BEGIN
  COPY ~bp/cre/sahspy04.cre~ ~override~
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 
  END
END

COPY_EXISTING ~udkuo01.cre~ ~override~ //Kuo-Toa Leader
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_SHORT 0x24 118 // CurrHP (was 80)
    WRITE_SHORT 0x26 116 // MaxHP (was 80)
    WRITE_SHORT 0x46 ~-2~ // ACNatul (was 4)
    WRITE_SHORT 0x48 ~-2~ // ACEffec (was 4)
    WRITE_BYTE 0x52 8 // THAC0 (was 13)
    WRITE_BYTE 0x53 8 // NOAtt (was 2)
    WRITE_BYTE 0x234 14 // HighestLevelPrimary (was 8)
    WRITE_ASCII 0x250 ~humansht~ #8 // Class (was KUOTOA)
    WRITE_ASCII 0x258 ~kuotoa~ #8 // Race (was NONE)
    WRITE_ASCII 0x260 ~bpleader~ #8 // General (was NONE)
    WRITE_ASCII 0x268 ~bpwtrsgt~ #8 // Default (was WTASIGHT)
    REPLACE_CRE_ITEM ~KUOBOLT~ #10 #0 #0 ~NONE~ ~QUIVER1~
    SET_BG2_PROFICIENCY ~PROFICIENCYSPEAR~ 4
    SET_BG2_PROFICIENCY ~PROFICIENCYCROSSBOW~ 4
  END
BUT_ONLY

COPY_EXISTING ~udkuo02.cre~ ~override~ //Master Whip
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 124 // CurrHP (was 64)
    WRITE_SHORT 0x26 124 // MaxHP (was 64)
    WRITE_SHORT 0x46 ~-4~ // ACNatul (was 4)
    WRITE_SHORT 0x48 ~-4~ // ACEffec (was 4)
    WRITE_BYTE 0x52 10 // THAC0 (was 14)
    WRITE_BYTE 0x54 5 // SaveVDth (was 6)
    WRITE_BYTE 0x55 9 // SaveVWnd (was 10)
    WRITE_BYTE 0x56 8 // SaveVPoly (was 9)
    WRITE_BYTE 0x57 11 // SaveVAtks (was 12)
    WRITE_BYTE 0x58 10 // SaveVspell (was 11)
    WRITE_BYTE 0x64 80 // DtectIll (was 0)
    WRITE_BYTE 0x68 90 // Stealth (was 0)
    WRITE_ASCII 0x248 ~humansht~ #8 // Override (was GENSHT01)
    WRITE_ASCII 0x268 ~bpthief~ #8 // Default (was WTASIGHT)
    ADD_MEMORIZED_SPELL ~spcl423~ #0 ~innate~ (4)
    ADD_MEMORIZED_SPELL ~spcl914~ #0 ~innate~
    ADD_MEMORIZED_SPELL ~spcl917~ #0 ~innate~
    ADD_MEMORIZED_SPELL ~spin483~ #0 ~innate~ (4)
    ADD_MEMORIZED_SPELL ~spin487~ #0 ~innate~ (4)
    REPLACE_CRE_ITEM ~KUOHARP~ #0 #0 #0 ~NONE~ ~WEAPON2~
    SET_BG2_PROFICIENCY ~PROFICIENCYSPEAR~ 4
  END
BUT_ONLY

COPY_EXISTING ~kuoarc20.cre~ ~override~ //Kuo-Toa Archer
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_SHORT 0x46 ~-2~ // ACNatul (was 0)
    WRITE_SHORT 0x48 ~-2~ // ACEffec (was 0)
    WRITE_ASCII 0x248 ~humansht~ #8 // Override (was NONE)
    WRITE_ASCII 0x250 ~~ #8 // Class (was GRPSHT01)
    WRITE_ASCII 0x268 ~bpgparch~ #8 // Default (was KUOARC20)
    SET_BG2_PROFICIENCY ~PROFICIENCYCROSSBOW~ 5
  END
BUT_ONLY

COPY_EXISTING ~kuocap01.cre~ ~override~ //Kuo-Toa Captain
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_SHORT 0x24 108 // CurrHP (was 100)
    WRITE_SHORT 0x26 108 // MaxHP (was 100)
    WRITE_SHORT 0x46 ~-4~ // ACNatul (was 1)
    WRITE_SHORT 0x48 ~-4~ // ACEffec (was 1)
    WRITE_BYTE 0x52 7 // THAC0 (was 11)
    WRITE_BYTE 0x53 8 // NOAtt (was 1)
    WRITE_BYTE 0x54 4 // SaveVDth (was 8)
    WRITE_BYTE 0x55 6 // SaveVWnd (was 10)
    WRITE_BYTE 0x56 5 // SaveVPoly (was 9)
    WRITE_BYTE 0x57 4 // SaveVAtks (was 9)
    WRITE_BYTE 0x58 7 // SaveVspell (was 11)
    WRITE_BYTE 0x234 15 // HighestLevelPrimary (was 10)
    WRITE_ASCII 0x248 ~humansht~ #8 // Override (was )
    WRITE_ASCII 0x260 ~bpleader~ #8 // General (was NONE)
    WRITE_ASCII 0x268 ~bpwtrsgt~ #8 // Default (was WTASIGHT)
    REMOVE_CRE_ITEM ~SPER01~
    REPLACE_CRE_ITEM ~KUOBOLT~ #10 #0 #0 ~NONE~ ~QUIVER1~
    SET_BG2_PROFICIENCY ~PROFICIENCYSPEAR~ 4
    SET_BG2_PROFICIENCY ~PROFICIENCYCROSSBOW~ 4
  END
BUT_ONLY

COPY_EXISTING ~kuocle20.cre~ ~override~ //Kuo-Toa Captain
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_SHORT 0x24 125 // CurrHP (was 105)
    WRITE_SHORT 0x26 125 // MaxHP (was 105)
    WRITE_SHORT 0x46 ~-3~ // ACNatul (was 10)
    WRITE_SHORT 0x48 ~-3~ // ACEffec (was 10)
    WRITE_BYTE 0x52 6 // THAC0 (was 8)
    WRITE_BYTE 0x53 2 // NOAtt (was 1)
    WRITE_BYTE 0x23b 20 // Wis (was 14)
    WRITE_ASCII 0x248 ~humansht~ #8 // Override (was NONE)
    WRITE_ASCII 0x250 ~kuotoa~ #8 // Class (was GRPSHT01)
    WRITE_ASCII 0x268 ~bpccle2b~ #8 // Default (was WTASIGHT)
    REMOVE_CRE_ITEM ~BLUN33~
    REPLACE_CRE_ITEM ~CHAN17~ #0 #0 #0 ~NONE~ ~ARMOR~
    REPLACE_CRE_ITEM ~KUOSPER~ #0 #0 #0 ~NONE~ ~WEAPON1~ EQUIP
    SET_BG2_PROFICIENCY ~PROFICIENCYSPEAR~ 3
  END
BUT_ONLY

COPY_EXISTING ~kuolie01.cre~ ~override~ //Kuo-Toa Lieutenant
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_SHORT 0x24 98 // CurrHP (was 80)
    WRITE_SHORT 0x26 98 // MaxHP (was 80)
    WRITE_SHORT 0x46 ~-2~ // ACNatul (was 4)
    WRITE_SHORT 0x48 ~-2~ // ACEffec (was 4)
    WRITE_BYTE 0x52 8 // THAC0 (was 13)
    WRITE_BYTE 0x53 8 // NOAtt (was 2)
    WRITE_BYTE 0x54 5 // SaveVDth (was 10)
    WRITE_BYTE 0x55 7 // SaveVWnd (was 12)
    WRITE_BYTE 0x56 6 // SaveVPoly (was 11)
    WRITE_BYTE 0x57 5 // SaveVAtks (was 12)
    WRITE_BYTE 0x58 8 // SaveVspell (was 13)
    WRITE_BYTE 0x234 13 // HighestLevelPrimary (was 8)
    WRITE_ASCII 0x248 ~humansht~ #8 // Override (was GENSHT01)
    WRITE_ASCII 0x260 ~bpleader~ #8 // General (was NONE)
    WRITE_ASCII 0x268 ~bpwtrsgt~ #8 // Default (was WTASIGHT)
    REMOVE_CRE_ITEM ~SPER01~
    REPLACE_CRE_ITEM ~KUOBOLT~ #10 #0 #0 ~NONE~ ~QUIVER1~
    SET_BG2_PROFICIENCY ~PROFICIENCYSPEAR~ 3
    SET_BG2_PROFICIENCY ~PROFICIENCYCROSSBOW~ 3
  END
BUT_ONLY

COPY_EXISTING ~kuomag01.cre~ ~override~ //Kuo-Toa Wizard
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_SHORT 0x24 56 // CurrHP (was 40)
    WRITE_SHORT 0x26 56 // MaxHP (was 40)
    WRITE_SHORT 0x46 0 // ACNatul (was 4)
    WRITE_SHORT 0x48 0 // ACEffec (was 4)
    WRITE_BYTE 0x52 15 // THAC0 (was 17)
    WRITE_BYTE 0x58 10 // SaveVspell (was 9)
    WRITE_BYTE 0x23d 16 // Con (was 9)
    WRITE_ASCII 0x248 ~humansht~ #8 // Override (was GENSHT01)
    WRITE_ASCII 0x258 ~~ #8 // Race (was KUOMAG01)
    WRITE_ASCII 0x260 ~bpmag12e~ #8 // General (was NONE)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    REPLACE_CRE_ITEM ~XBOW04~ #0 #0 #0 ~NONE~ ~WEAPON2~
    REPLACE_CRE_ITEM ~KUOBOLT~ #20 #0 #0 ~NONE~ ~QUIVER1~
    SET_BG2_PROFICIENCY ~PROFICIENCYSPEAR~ 3
    SET_BG2_PROFICIENCY ~PROFICIENCYCROSSBOW~ 3
  END
BUT_ONLY

COPY_EXISTING ~kuomon01.cre~ ~override~ //Kuo-Toa Monitor
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 86 // CurrHP (was 56)
    WRITE_SHORT 0x26 86 // MaxHP (was 56)
    WRITE_SHORT 0x46 ~-1~ // ACNatul (was 1)
    WRITE_SHORT 0x48 ~-1~ // ACEffec (was 1)
    WRITE_BYTE 0x52 10 // THAC0 (was 14)
    WRITE_BYTE 0x54 7 // SaveVDth (was 10)
    WRITE_BYTE 0x55 9 // SaveVWnd (was 12)
    WRITE_BYTE 0x56 8 // SaveVPoly (was 11)
    WRITE_BYTE 0x57 8 // SaveVAtks (was 12)
    WRITE_BYTE 0x58 10 // SaveVspell (was 13)
    WRITE_BYTE 0x234 12 // HighestLevelPrimary (was 7)
    WRITE_ASCII 0x248 ~humansht~ #8 // Override (was GENSHT01)
    WRITE_ASCII 0x268 ~bpcmnk2b~ #8 // Default (was WTASIGHT)
    WRITE_BYTE 0x273 20 // IDSClass (was 173)
    ADD_MEMORIZED_SPELL ~spcl811~ #0 ~innate~ (3)
    REMOVE_CRE_ITEM ~S1-8~
    REPLACE_CRE_ITEM ~MFIST4~ #0 #0 #0 ~NONE~ ~WEAPON1~ EQUIP
  END
BUT_ONLY

COPY_EXISTING ~kuopri01.cre~ ~override~ //Kuo-Toa Priest
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 68 // CurrHP (was 64)
    WRITE_SHORT 0x26 68 // MaxHP (was 64)
    WRITE_BYTE 0x52 13 // THAC0 (was 14)
    WRITE_BYTE 0x64 65 // DtectIll (was 0)
    WRITE_BYTE 0x68 70 // Stealth (was 0)
    WRITE_ASCII 0x248 ~humansht~ #8 // Override (was GENSHT01)
    WRITE_ASCII 0x268 ~bpthief~ #8 // Default (was WTARSGT)
    ADD_MEMORIZED_SPELL ~spin486~ #0 ~innate~ (3)
    SET_BG2_PROFICIENCY ~PROFICIENCYSPEAR~ 3
    SET_BG2_PROFICIENCY ~PROFICIENCYCROSSBOW~ 3
  END
BUT_ONLY

COPY_EXISTING ~kuotoa01.cre~ ~override~ //Kuo-Toa Warrior
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_SHORT 0x24 48 // CurrHP (was 19)
    WRITE_SHORT 0x26 48 // MaxHP (was 19)
    WRITE_SHORT 0x46 3 // ACNatul (was 5)
    WRITE_SHORT 0x48 3 // ACEffec (was 5)
    WRITE_BYTE 0x52 15 // THAC0 (was 19)
    WRITE_BYTE 0x53 7 // NOAtt (was 1)
    WRITE_BYTE 0x54 11 // SaveVDth (was 14)
    WRITE_BYTE 0x55 13 // SaveVWnd (was 16)
    WRITE_BYTE 0x56 12 // SaveVPoly (was 15)
    WRITE_BYTE 0x57 13 // SaveVAtks (was 17)
    WRITE_BYTE 0x58 14 // SaveVspell (was 17)
    WRITE_BYTE 0x234 6 // HighestLevelPrimary (was 2)
    WRITE_ASCII 0x248 ~humansht~ #8 // Override (was GENSHT01)
    REMOVE_CRE_ITEM ~RNDTRE04~ ~KUOSPER~ ~SPER01~ ~KUOBOLT~ ~KUOBOW~
    REPLACE_CRE_ITEM ~KUOHARP~ #0 #0 #0 ~NONE~ ~WEAPON1~ EQUIP TWOHANDED
    SET_BG2_PROFICIENCY ~PROFICIENCYSPEAR~ 3
  END
BUT_ONLY

COPY_EXISTING ~kuowar01.cre~ ~override~ //Kuo-Toa Warrior
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_SHORT 0x24 56 // CurrHP (was 30)
    WRITE_SHORT 0x26 56 // MaxHP (was 30)
    WRITE_SHORT 0x46 2 // ACNatul (was 4)
    WRITE_BYTE 0x52 13 // THAC0 (was 15)
    WRITE_BYTE 0x54 10 // SaveVDth (was 11)
    WRITE_BYTE 0x55 12 // SaveVWnd (was 13)
    WRITE_BYTE 0x56 11 // SaveVPoly (was 12)
    WRITE_BYTE 0x57 12 // SaveVAtks (was 13)
    WRITE_BYTE 0x58 13 // SaveVspell (was 14)
    WRITE_BYTE 0x234 8 // HighestLevelPrimary (was 6)
    WRITE_ASCII 0x248 ~humansht~ #8 // Override (was GENSHT01)
    WRITE_ASCII 0x250 ~~ #8 // Class (was GPARCHER)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    REMOVE_CRE_ITEM ~RNDTRE04~ ~SPER01~ ~XBOW04~ ~KUOSPER~ ~KUOBOLT~
    REPLACE_CRE_ITEM ~KUOHARP~ #0 #0 #0 ~NONE~ ~WEAPON1~ EQUIP TWOHANDED
    SET_BG2_PROFICIENCY ~PROFICIENCYSPEAR~ 3
  END
BUT_ONLY

COPY_EXISTING ~kuowar20.cre~ ~override~ //Kuo-Toa Warrior
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 185 // CurrHP (was 130)
    WRITE_SHORT 0x26 185 // MaxHP (was 130)
    WRITE_SHORT 0x46 ~-3~ // ACNatul (was 0)
    WRITE_SHORT 0x48 ~-3~ // ACEffec (was 0)
    WRITE_BYTE 0x52 3 // THAC0 (was 1)
    WRITE_BYTE 0x53 3 // NOAtt (was 1)
    WRITE_ASCII 0x248 ~humansht~ #8 // Override (was NONE)
    WRITE_ASCII 0x250 ~~ #8 // Class (was GRPSHT01)
    WRITE_ASCII 0x268 ~bpcber2b~ #8 // Default (was KUOWAR20)
    ADD_MEMORIZED_SPELL ~spcl321~ #0 ~innate~ (2)
    REPLACE_CRE_ITEM ~KUOSPER~ #0 #0 #0 ~NONE~ ~WEAPON1~ EQUIP
    LAUNCH_PATCH_FUNCTION DELETE_CRE_EFFECT
      INT_VAR opcode_to_delete = 233 //Proficiency
    END
    SET_BG2_PROFICIENCY ~PROFICIENCYSPEAR~ 5
    SET_BG2_PROFICIENCY ~PROFICIENCY2HANDED~ 2
  END
BUT_ONLY

COPY_EXISTING ~kuowhi01.cre~ ~override~ //Kuo-Toa Whip
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_SHORT 0x24 78 // CurrHP (was 55)
    WRITE_SHORT 0x26 78 // MaxHP (was 55)
    WRITE_SHORT 0x46 0 // ACNatul (was 4)
    WRITE_SHORT 0x48 0 // ACEffec (was 4)
    WRITE_BYTE 0x52 13 // THAC0 (was 16)
    WRITE_BYTE 0x54 10 // SaveVDth (was 11)
    WRITE_BYTE 0x55 12 // SaveVWnd (was 13)
    WRITE_BYTE 0x56 11 // SaveVPoly (was 12)
    WRITE_BYTE 0x57 12 // SaveVAtks (was 13)
    WRITE_BYTE 0x58 13 // SaveVspell (was 14)
    WRITE_BYTE 0x68 40 // Stealth (was 0)
    WRITE_BYTE 0x234 8 // HighestLevelPrimary (was 5)
    WRITE_BYTE 0x235 8 // HighestLevelSecond (was 5)
    WRITE_ASCII 0x248 ~humansht~ #8 // Override (was GENSHT01)
    WRITE_ASCII 0x268 ~bpthief~ #8 // Default (was WTARSGT)
    ADD_MEMORIZED_SPELL ~spin483~ #0 ~innate~ (2)
    REMOVE_CRE_ITEM ~XBOW01~ ~BOLT01~ ~KUOBOLT~
    REPLACE_CRE_ITEM ~KUOHARP~ #0 #0 #0 ~NONE~ ~WEAPON2~
    SET_BG2_PROFICIENCY ~PROFICIENCYSPEAR~ 3
  END
BUT_ONLY

COPY_EXISTING ~udprince.cre~ ~override~ //Kuo-Toa Prince
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_BYTE 0x53 3 // NOAtt (was 2)
    WRITE_BYTE 0x64 80 // DtectIll (was 0)
    WRITE_BYTE 0x68 90 // Stealth (was 0)
    WRITE_ASCII 0x258 ~bppri14t~ #8 // Race (was NONE)
    WRITE_ASCII 0x268 ~bpthief~ #8 // Default (was WTARSGT)
    ADD_MEMORIZED_SPELL ~sppr208~ #1 ~priest~ (2)
    ADD_MEMORIZED_SPELL ~sppr211~ #1 ~priest~ (2)
    ADD_MEMORIZED_SPELL ~sppr310~ #2 ~priest~ (2)
    ADD_MEMORIZED_SPELL ~sppr315~ #2 ~priest~ (2)
    ADD_MEMORIZED_SPELL ~sppr405~ #3 ~priest~
    ADD_MEMORIZED_SPELL ~sppr416~ #3 ~priest~
    ADD_MEMORIZED_SPELL ~sppr401~ #3 ~priest~ (2)
    ADD_MEMORIZED_SPELL ~sppr503~ #4 ~priest~
    ADD_MEMORIZED_SPELL ~sppr514~ #4 ~priest~
    ADD_MEMORIZED_SPELL ~sppr599~ #4 ~priest~
    ADD_MEMORIZED_SPELL ~sppr607~ #5 ~priest~
    ADD_MEMORIZED_SPELL ~sppr699~ #5 ~priest~
    ADD_MEMORIZED_SPELL ~sppr698~ #5 ~priest~
    ADD_MEMORIZED_SPELL ~sppr737~ #6 ~priest~
    ADD_MEMORIZED_SPELL ~spcl423~ #0 ~innate~ (4)
    ADD_MEMORIZED_SPELL ~spcl913~ #0 ~innate~
    ADD_MEMORIZED_SPELL ~spcl916~ #0 ~innate~ (2)
    ADD_MEMORIZED_SPELL ~spin483~ #0 ~innate~ (4)
    REMOVE_CRE_ITEM ~RNDTRE04~
    REPLACE_CRE_ITEM ~KUOBOLT~ #10 #0 #0 ~NONE~ ~QUIVER1~
    REPLACE_CRE_ITEM ~KUOBOLT~ #10 #0 #0 ~NONE~ ~QUIVER3~
  END
BUT_ONLY




COPY_EXISTING ~udsaha.cre~ ~override~ //Sahuagin Prince
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_BYTE 0x241 255 // Racial (was 0)
    WRITE_ASCII 0x260 ~bpleader~ #8 // General (was NONE)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~sahamb01.cre~ ~override~ //Rebel
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_SHORT 0x46 2 // ACNatul (was 5)
    WRITE_SHORT 0x48 2 // ACEffec (was 5)
    WRITE_BYTE 0x53 7 // NOAtt (was 1)
    WRITE_BYTE 0x234 10 // HighestLevelPrimary (was 2)
    WRITE_ASCII 0x248 ~gpshout~ #8 // Override (was SAHAMB01)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    REMOVE_CRE_ITEM ~BOLT01~
    REMOVE_CRE_ITEM ~SAHSTAFF~
    REPLACE_CRE_ITEM ~SAHSPEAR~ #0 #0 #0 ~NONE~ ~WEAPON2~
    REPLACE_CRE_ITEM ~SAHBOLT~ #20 #0 #0 ~NONE~ ~QUIVER1~
    SET_BG2_PROFICIENCY ~PROFICIENCYCROSSBOW~ 3
    SET_BG2_PROFICIENCY ~PROFICIENCYSPEAR~ 3
  END
BUT_ONLY

COPY_EXISTING ~sahamb02.cre~ ~override~ //Rebel
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_SHORT 0x46 2 // ACNatul (was 5)
    WRITE_SHORT 0x48 2 // ACEffec (was 5)
    WRITE_BYTE 0x53 7 // NOAtt (was 1)
    WRITE_BYTE 0x234 10 // HighestLevelPrimary (was 2)
    WRITE_ASCII 0x248 ~gpshout~ #8 // Override (was SAHAMB02)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    REMOVE_CRE_ITEM ~SAHSTAFF~
    REPLACE_CRE_ITEM ~SAHSPEAR~ #0 #0 #0 ~NONE~ ~WEAPON1~ EQUIP TWOHANDED
    SET_BG2_PROFICIENCY ~PROFICIENCYSPEAR~ 3
  END
BUT_ONLY

COPY_EXISTING ~sahamb03.cre~ ~override~ //Rebel
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_SHORT 0x24 68 // CurrHP (was 32)
    WRITE_SHORT 0x26 68 // MaxHP (was 32)
    WRITE_SHORT 0x46 2 // ACNatul (was 10)
    WRITE_SHORT 0x48 2 // ACEffec (was 10)
    WRITE_BYTE 0x52 13 // THAC0 (was 18)
    WRITE_ASCII 0x250 ~bpmage6~ #8 // Class (was NONE)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    // WRITE_BYTE 0x273 202 // IDSClass (was 169)
    REMOVE_CRE_ITEM ~SPER01~
    REPLACE_CRE_ITEM ~STAF01~ #0 #0 #0 ~NONE~ ~WEAPON1~ EQUIP TWOHANDED
    SET_BG2_PROFICIENCY ~PROFICIENCYQUARTERSTAFF~ 3
  END
BUT_ONLY

COPY_EXISTING ~sahamb04.cre~ ~override~ //Sahuagin
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_SHORT 0x46 2 // ACNatul (was 5)
    WRITE_SHORT 0x48 2 // ACEffec (was 5)
    WRITE_BYTE 0x234 10 // HighestLevelPrimary (was 2)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    REMOVE_CRE_ITEM ~BOLT01~
    REPLACE_CRE_ITEM ~SAHBOLT~ #20 #0 #0 ~NONE~ ~QUIVER1~
    SET_BG2_PROFICIENCY ~PROFICIENCYCROSSBOW~ 3
    SET_BG2_PROFICIENCY ~PROFICIENCYSPEAR~ 3
  END
BUT_ONLY

COPY_EXISTING ~sahamb05.cre~ ~override~ //Sahuagin
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_SHORT 0x46 2 // ACNatul (was 5)
    WRITE_BYTE 0x234 10 // HighestLevelPrimary (was 2)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    SET_BG2_PROFICIENCY ~PROFICIENCYSPEAR~ 3
  END
BUT_ONLY

COPY_EXISTING ~sahamb06.cre~ ~override~ //Sahuagin
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 68 // CurrHP (was 32)
    WRITE_SHORT 0x26 68 // MaxHP (was 32)
    WRITE_SHORT 0x46 2 // ACNatul (was 10)
    WRITE_SHORT 0x48 2 // ACEffec (was 10)
    WRITE_BYTE 0x52 13 // THAC0 (was 18)
    WRITE_ASCII 0x250 ~bpmage6~ #8 // Class (was NONE)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    SET_BG2_PROFICIENCY ~PROFICIENCYSPEAR~ 3
  END
BUT_ONLY

COPY_EXISTING ~sahbar01.cre~ ~override~ //Sahuagin Baronial Guard
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_SHORT 0x24 81 // CurrHP (was 27)
    WRITE_SHORT 0x26 81 // MaxHP (was 27)
    WRITE_SHORT 0x46 0 // ACNatul (was 5)
    WRITE_SHORT 0x48 0 // ACEffec (was 5)
    WRITE_BYTE 0x52 10 // THAC0 (was 17)
    WRITE_BYTE 0x234 10 // HighestLevelPrimary (was 2)
    WRITE_BYTE 0x238 21 // Str (was 16)
    WRITE_ASCII 0x268 ~bpwtrsgt~ #8 // Default (was WTASIGHT)
    SET_BG2_PROFICIENCY ~PROFICIENCYSPEAR~ 4
    SET_BG2_PROFICIENCY ~PROFICIENCYCROSSBOW~ 4
  END
BUT_ONLY

COPY_EXISTING ~sahbar02.cre~ ~override~ //Sahuagin Baron
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_SHORT 0x24 96 // CurrHP (was 46)
    WRITE_SHORT 0x26 96 // MaxHP (was 46)
    WRITE_SHORT 0x46 ~-2~ // ACNatul (was 5)
    WRITE_SHORT 0x48 ~-2~ // ACEffec (was 5)
    WRITE_BYTE 0x52 8 // THAC0 (was 13)
    WRITE_BYTE 0x234 12 // HighestLevelPrimary (was 2)
    WRITE_BYTE 0x238 22 // Str (was 19)
    WRITE_BYTE 0x23a 16 // Int (was 13)
    WRITE_BYTE 0x23c 16 // Dex (was 9)
    WRITE_BYTE 0x23d 14 // Con (was 9)
    WRITE_ASCII 0x268 ~bpwtrsgt~ #8 // Default (was WTASIGHT)
    REMOVE_CRE_ITEM ~SPER01~ ~BOLT01~ ~BOLT04~
    REPLACE_CRE_ITEM ~SAHSPEAR~ #0 #0 #0 ~NONE~ ~WEAPON1~ EQUIP TWOHANDED
    REPLACE_CRE_ITEM ~SAHBOLT~ #20 #0 #0 ~NONE~ ~QUIVER1~
    SET_BG2_PROFICIENCY ~PROFICIENCYCROSSBOW~ 4
    SET_BG2_PROFICIENCY ~PROFICIENCYSPEAR~ 4
  END
BUT_ONLY

COPY_EXISTING ~sahbar03.cre~ ~override~ //Baron Thelokassyil
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_SHORT 0x24 96 // CurrHP (was 46)
    WRITE_SHORT 0x46 ~-2~ // ACNatul (was 5)
    WRITE_SHORT 0x48 ~-2~ // ACEffec (was 5)
    WRITE_BYTE 0x52 8 // THAC0 (was 13)
    WRITE_BYTE 0x234 12 // HighestLevelPrimary (was 2)
    WRITE_BYTE 0x238 21 // Str (was 19)
    WRITE_BYTE 0x23a 16 // Int (was 13)
    WRITE_BYTE 0x23c 16 // Dex (was 9)
    WRITE_BYTE 0x23d 12 // Con (was 9)
    WRITE_ASCII 0x268 ~bpwtrsgt~ #8 // Default (was WTASIGHT)
    REMOVE_CRE_ITEM ~SPER01~ ~BOLT01~ ~BOLT04~
    REPLACE_CRE_ITEM ~SAHBOLT~ #40 #0 #0 ~NONE~ ~QUIVER1~
    ADD_CRE_ITEM ~STAF01~ #0 #0 #0 ~UNSTEALABLE~ ~INV~
    SET_BG2_PROFICIENCY ~PROFICIENCYQUARTERSTAFF~ 4
    SET_BG2_PROFICIENCY ~PROFICIENCYCROSSBOW~ 4
  END
BUT_ONLY

COPY_EXISTING ~sahcapt0.cre~ ~override~ //Captain Alyittyl
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_SHORT 0x24 181 // CurrHP (was 81)
    WRITE_SHORT 0x26 181 // MaxHP (was 81)
    WRITE_SHORT 0x46 0 // ACNatul (was 5)
    WRITE_SHORT 0x48 0 // ACEffec (was 5)
    WRITE_BYTE 0x52 6 // THAC0 (was 11)
    WRITE_BYTE 0x53 8 // NOAtt (was 1)
    WRITE_BYTE 0x54 4 // SaveVDth (was 8)
    WRITE_BYTE 0x55 6 // SaveVWnd (was 10)
    WRITE_BYTE 0x56 5 // SaveVPoly (was 9)
    WRITE_BYTE 0x57 4 // SaveVAtks (was 9)
    WRITE_BYTE 0x58 7 // SaveVspell (was 11)
    // WRITE_BYTE 0x71 3 // Unu3(Spears prof) (was 0)
    WRITE_BYTE 0x234 16 // HighestLevelPrimary (was 2)
    WRITE_BYTE 0x23c 16 // Dex (was 9)
    WRITE_BYTE 0x23d 16 // Con (was 9)
    WRITE_BYTE 0x241 255 // Racial (was 0)
    WRITE_ASCII 0x260 ~bpleader~ #8 // General (was NONE)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    REMOVE_CRE_ITEM ~S1-10~
    REPLACE_CRE_ITEM ~SAHSPEAR~ #0 #0 #0 ~NONE~ ~WEAPON1~ EQUIP TWOHANDED
    SET_BG2_PROFICIENCY ~PROFICIENCYSPEAR~ 5
  END
BUT_ONLY

COPY_EXISTING ~sahcapt1.cre~ ~override~ //Captain Alyittyl
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_SHORT 0x24 181 // CurrHP (was 81)
    WRITE_SHORT 0x26 181 // MaxHP (was 81)
    WRITE_SHORT 0x46 ~-2~ // ACNatul (was 5)
    WRITE_SHORT 0x48 ~-2~ // ACEffec (was 5)
    WRITE_BYTE 0x52 5 // THAC0 (was 11)
    WRITE_BYTE 0x53 8 // NOAtt (was 1)
    WRITE_BYTE 0x234 16 // HighestLevelPrimary (was 2)
    WRITE_BYTE 0x23c 16 // Dex (was 9)
    WRITE_BYTE 0x23d 16 // Con (was 9)
    WRITE_BYTE 0x241 255 // Racial (was 0)
    WRITE_ASCII 0x260 ~bpleader~ #8 // General (was NONE)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    SET_BG2_PROFICIENCY ~PROFICIENCYSPEAR~ 5
  END
BUT_ONLY

COPY_EXISTING ~sahchf01.cre~ ~override~ //Sahuagin Chieftain
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_SHORT 0x46 ~-3~ // ACNatul (was 5)
    WRITE_SHORT 0x48 ~-5~ // ACEffec (was 5)
    WRITE_BYTE 0x52 5 // THAC0 (was 13)
    WRITE_BYTE 0x53 8 // NOAtt (was 2)
    WRITE_BYTE 0x23c 16 // Dex (was 9)
    WRITE_ASCII 0x260 ~bpleader~ #8 // General (was NONE)
    WRITE_ASCII 0x268 ~bpwtrsgt~ #8 // Default (was WTASIGHT)
    SET_BG2_PROFICIENCY ~PROFICIENCYQUARTERSTAFF~ 5
    SET_BG2_PROFICIENCY ~PROFICIENCYCROSSBOW~ 5
  END
BUT_ONLY

COPY_EXISTING ~sahcpt01.cre~ ~override~ //Captain Alyittyl
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_SHORT 0x24 181 // CurrHP (was 81)
    WRITE_SHORT 0x26 181 // MaxHP (was 81)
    WRITE_SHORT 0x46 ~-3~ // ACNatul (was 5)
    WRITE_SHORT 0x48 ~-3~ // ACEffec (was 5)
    WRITE_BYTE 0x52 5 // THAC0 (was 11)
    WRITE_BYTE 0x53 8 // NOAtt (was 2)
    WRITE_BYTE 0x54 3 // SaveVDth (was 8)
    WRITE_BYTE 0x55 5 // SaveVWnd (was 10)
    WRITE_BYTE 0x56 4 // SaveVPoly (was 9)
    WRITE_BYTE 0x57 4 // SaveVAtks (was 9)
    WRITE_BYTE 0x58 6 // SaveVspell (was 11)
    WRITE_BYTE 0x234 16 // HighestLevelPrimary (was 18)
    WRITE_BYTE 0x238 22 // Str (was 21)
    WRITE_BYTE 0x23a 15 // Int (was 13)
    WRITE_BYTE 0x23c 16 // Dex (was 9)
    WRITE_BYTE 0x23d 16 // Con (was 9)
    WRITE_ASCII 0x268 ~bpwtrsgt~ #8 // Default (was WTASIGHT)
    REMOVE_CRE_ITEM ~BOLT01~ ~BOLT04~
    REPLACE_CRE_ITEM ~SAHBOLT~ #20 #0 #0 ~NONE~ ~QUIVER1~
    SET_BG2_PROFICIENCY ~PROFICIENCYSPEAR~ 5
    SET_BG2_PROFICIENCY ~PROFICIENCYCROSSBOW~ 5
  END
BUT_ONLY

COPY_EXISTING ~sahcpt02.cre~ ~override~ //Captain Feerlattiys
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_SHORT 0x24 190 // CurrHP (was 27)
    WRITE_SHORT 0x26 190 // MaxHP (was 27)
    WRITE_SHORT 0x46 ~-3~ // ACNatul (was 5)
    WRITE_SHORT 0x48 ~-3~ // ACEffec (was 5)
    WRITE_BYTE 0x52 4 // THAC0 (was 17)
    WRITE_BYTE 0x53 3 // NOAtt (was 2)
    WRITE_BYTE 0x54 3 // SaveVDth (was 13)
    WRITE_BYTE 0x55 5 // SaveVWnd (was 15)
    WRITE_BYTE 0x56 4 // SaveVPoly (was 14)
    WRITE_BYTE 0x57 4 // SaveVAtks (was 16)
    WRITE_BYTE 0x58 6 // SaveVspell (was 16)
    WRITE_BYTE 0x238 22 // Str (was 16)
    WRITE_BYTE 0x23a 15 // Int (was 13)
    WRITE_BYTE 0x23c 16 // Dex (was 9)
    WRITE_BYTE 0x23d 16 // Con (was 9)
    WRITE_ASCII 0x268 ~bpwtrsgt~ #8 // Default (was WTASIGHT)
    REMOVE_CRE_ITEM ~BOLT01~ ~BOLT04~
    REPLACE_CRE_ITEM ~SAHBOLT~ #20 #0 #0 ~NONE~ ~QUIVER1~
    SET_BG2_PROFICIENCY ~PROFICIENCYSPEAR~ 5
    SET_BG2_PROFICIENCY ~PROFICIENCYCROSSBOW~ 5
  END
BUT_ONLY

COPY_EXISTING ~sahextra.cre~ ~override~ //Sahuagin Royal Guard
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_SHORT 0x24 121 // CurrHP (was 81)
    WRITE_SHORT 0x26 121 // MaxHP (was 81)
    WRITE_SHORT 0x46 ~-2~ // ACNatul (was 5)
    WRITE_SHORT 0x48 ~-2~ // ACEffec (was 5)
    WRITE_BYTE 0x52 6 // THAC0 (was 4)
    WRITE_BYTE 0x54 4 // SaveVDth (was 8)
    WRITE_BYTE 0x55 6 // SaveVWnd (was 10)
    WRITE_BYTE 0x56 5 // SaveVPoly (was 9)
    WRITE_BYTE 0x57 4 // SaveVAtks (was 9)
    WRITE_BYTE 0x58 7 // SaveVspell (was 11)
    // WRITE_BYTE 0x70 2 // Unu2(Bows prof) (was 0)
    // WRITE_BYTE 0x71 2 // Unu3(Spears prof) (was 0)
    WRITE_BYTE 0x234 14 // HighestLevelPrimary (was 5)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    REMOVE_CRE_ITEM ~XBOW01~ ~BOLT01~
    REPLACE_CRE_ITEM ~XBOW04~ #0 #0 #0 ~NONE~ ~WEAPON2~ EQUIP TWOHANDED
    REPLACE_CRE_ITEM ~SAHBOLT~ #40 #0 #0 ~NONE~ ~QUIVER1~
    SET_BG2_PROFICIENCY ~PROFICIENCYSPEAR~ 4
    SET_BG2_PROFICIENCY ~PROFICIENCYCROSSBOW~ 4
  END
BUT_ONLY

COPY_EXISTING ~sahgrd01.cre~ ~override~ //Sahuagin Royal Guard
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_SHORT 0x24 135 // CurrHP (was 81)
    WRITE_SHORT 0x26 135 // MaxHP (was 81)
    WRITE_SHORT 0x46 ~-2~ // ACNatul (was 5)
    WRITE_SHORT 0x48 ~-2~ // ACEffec (was 5)
    WRITE_BYTE 0x52 5 // THAC0 (was 4)
    WRITE_BYTE 0x53 8 // NOAtt (was 2)
    WRITE_BYTE 0x54 4 // SaveVDth (was 8)
    WRITE_BYTE 0x55 6 // SaveVWnd (was 10)
    WRITE_BYTE 0x56 5 // SaveVPoly (was 9)
    WRITE_BYTE 0x57 4 // SaveVAtks (was 9)
    WRITE_BYTE 0x58 7 // SaveVspell (was 11)
    WRITE_BYTE 0x234 15 // HighestLevelPrimary (was 2)
    WRITE_ASCII 0x268 ~bpwtrsgt~ #8 // Default (was WTASIGHT)
    REMOVE_CRE_ITEM ~XBOW01~ ~BOLT01~
    REPLACE_CRE_ITEM ~XBOW04~ #0 #0 #0 ~NONE~ ~WEAPON2~
    REPLACE_CRE_ITEM ~SAHBOLT~ #40 #0 #0 ~NONE~ ~QUIVER1~
    SET_BG2_PROFICIENCY ~PROFICIENCYSPEAR~ 4
    SET_BG2_PROFICIENCY ~PROFICIENCYCROSSBOW~ 4
  END
BUT_ONLY

COPY_EXISTING ~sahgrd02.cre~ ~override~ //Sahuagin Royal Guard
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_SHORT 0x24 148 // CurrHP (was 81)
    WRITE_SHORT 0x26 148 // MaxHP (was 81)
    WRITE_SHORT 0x46 ~-4~ // ACNatul (was 5)
    WRITE_SHORT 0x48 ~-4~ // ACEffec (was 5)
    WRITE_BYTE 0x52 4 // THAC0 (was 2)
    WRITE_BYTE 0x53 3 // NOAtt (was 2)
    WRITE_BYTE 0x54 4 // SaveVDth (was 8)
    WRITE_BYTE 0x55 6 // SaveVWnd (was 10)
    WRITE_BYTE 0x56 5 // SaveVPoly (was 9)
    WRITE_BYTE 0x57 4 // SaveVAtks (was 9)
    WRITE_BYTE 0x58 7 // SaveVspell (was 11)
    WRITE_BYTE 0x234 16 // HighestLevelPrimary (was 2)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    SET_BG2_PROFICIENCY ~PROFICIENCYSPEAR~ 4
  END
BUT_ONLY

COPY_EXISTING ~sahgrd03.cre~ ~override~ //Sahuagin Royal Guard
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_SHORT 0x24 138 // CurrHP (was 81)
    WRITE_SHORT 0x26 138 // MaxHP (was 81)
    WRITE_SHORT 0x46 ~-1~ // ACNatul (was 5)
    WRITE_SHORT 0x48 ~-1~ // ACEffec (was 5)
    WRITE_BYTE 0x53 8 // NOAtt (was 2)
    WRITE_BYTE 0x54 5 // SaveVDth (was 8)
    WRITE_BYTE 0x55 7 // SaveVWnd (was 10)
    WRITE_BYTE 0x56 6 // SaveVPoly (was 9)
    WRITE_BYTE 0x57 5 // SaveVAtks (was 9)
    WRITE_BYTE 0x58 8 // SaveVspell (was 11)
    WRITE_BYTE 0x234 14 // HighestLevelPrimary (was 2)
    WRITE_ASCII 0x268 ~bpwtrsgt~ #8 // Default (was WTASIGHT)
    REMOVE_CRE_ITEM ~XBOW01~ ~BOLT01~ ~SAHBOLT~
    REPLACE_CRE_ITEM ~XBOW04~ #0 #0 #0 ~NONE~ ~WEAPON2~
    REPLACE_CRE_ITEM ~SAHBOLT~ #20 #0 #0 ~NONE~ ~QUIVER1~
    SET_BG2_PROFICIENCY ~PROFICIENCYSPEAR~ 4
    SET_BG2_PROFICIENCY ~PROFICIENCYCROSSBOW~ 4
  END
BUT_ONLY

COPY_EXISTING ~sahkin01.cre~ ~override~ //Sahuagin King
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_SHORT 0x24 244 // CurrHP (was 90)
    WRITE_SHORT 0x26 244 // MaxHP (was 90)
    WRITE_SHORT 0x46 ~-5~ // ACNatul (was 5)
    WRITE_SHORT 0x48 ~-5~ // ACEffec (was 5)
    WRITE_BYTE 0x53 3 // NOAtt (was 5)
    WRITE_BYTE 0x54 3 // SaveVDth (was 4)
    WRITE_BYTE 0x55 5 // SaveVWnd (was 7)
    WRITE_BYTE 0x56 4 // SaveVPoly (was 6)
    WRITE_BYTE 0x57 4 // SaveVAtks (was 7)
    WRITE_BYTE 0x58 6 // SaveVspell (was 4)
    WRITE_BYTE 0x234 20 // HighestLevelPrimary (was 13)
    WRITE_BYTE 0x235 1 // HighestLevelSecond (was 13)
    WRITE_BYTE 0x23d 18 // Con (was 9)
    WRITE_BYTE 0x241 255 // Racial (was 0)
    WRITE_ASCII 0x258 ~bp!plot~ #8 // Race (was NONE)
    WRITE_ASCII 0x260 ~bpleader~ #8 // General (was NONE)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    REMOVE_CRE_ITEM ~S1-4~
    REPLACE_CRE_ITEM ~SAHSPEAR~ #0 #0 #0 ~NONE~ ~WEAPON1~ EQUIP TWOHANDED
    SET_BG2_PROFICIENCY ~PROFICIENCYSPEAR~ 5
  END
BUT_ONLY

COPY_EXISTING ~sahkng01.cre~ ~override~ //King Ixilthetocal
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_SHORT 0x24 244 // CurrHP (was 90)
    WRITE_SHORT 0x26 244 // MaxHP (was 90)
    WRITE_SHORT 0x46 ~-5~ // ACNatul (was 5)
    WRITE_SHORT 0x48 ~-5~ // ACEffec (was 5)
    WRITE_BYTE 0x52 3 // THAC0 (was 1)
    WRITE_BYTE 0x53 3 // NOAtt (was 5)
    WRITE_BYTE 0x54 3 // SaveVDth (was 8)
    WRITE_BYTE 0x55 5 // SaveVWnd (was 10)
    WRITE_BYTE 0x56 4 // SaveVPoly (was 9)
    WRITE_BYTE 0x57 4 // SaveVAtks (was 9)
    WRITE_BYTE 0x58 6 // SaveVspell (was 11)
    WRITE_BYTE 0x23c 18 // Dex (was 9)
    WRITE_BYTE 0x23d 18 // Con (was 9)
    WRITE_ASCII 0x260 ~bp!plot~ #8 // General (was NONE)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    REMOVE_CRE_ITEM ~S1-12~
    REPLACE_CRE_ITEM ~SAHSPEAR~ #0 #0 #0 ~NONE~ ~WEAPON1~ EQUIP TWOHANDED
    SET_BG2_PROFICIENCY ~PROFICIENCYSPEAR~ 5
  END
BUT_ONLY

COPY_EXISTING ~sahkng02.cre~ ~override~ //King Ixilthetocal
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_SHORT 0x24 244 // CurrHP (was 90)
    WRITE_SHORT 0x26 244 // MaxHP (was 90)
    WRITE_SHORT 0x46 ~-5~ // ACNatul (was 5)
    WRITE_SHORT 0x48 ~-5~ // ACEffec (was 5)
    WRITE_BYTE 0x52 3 // THAC0 (was 1)
    WRITE_BYTE 0x53 3 // NOAtt (was 2)
    WRITE_BYTE 0x54 3 // SaveVDth (was 8)
    WRITE_BYTE 0x55 5 // SaveVWnd (was 10)
    WRITE_BYTE 0x56 4 // SaveVPoly (was 9)
    WRITE_BYTE 0x57 4 // SaveVAtks (was 9)
    WRITE_BYTE 0x58 6 // SaveVspell (was 11)
    WRITE_BYTE 0x234 20 // HighestLevelPrimary (was 2)
    WRITE_BYTE 0x23c 18 // Dex (was 9)
    WRITE_BYTE 0x23d 18 // Con (was 9)
    WRITE_ASCII 0x250 ~bp!plot~ #8 // Class (was NONE)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    SET_BG2_PROFICIENCY ~PROFICIENCYSPEAR~ 5
  END
BUT_ONLY

COPY_EXISTING ~sahpr1.cre~ ~override~ //Royal High Priestess Senityili
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_SHORT 0x24 162 // CurrHP (was 81)
    WRITE_SHORT 0x26 162 // MaxHP (was 81)
    WRITE_SHORT 0x46 ~-4~ // ACNatul (was 5)
    WRITE_SHORT 0x48 ~-4~ // ACEffec (was 5)
    WRITE_BYTE 0x52 6 // THAC0 (was 11)
    WRITE_BYTE 0x53 8 // NOAtt (was 2)
    WRITE_BYTE 0x54 2 // SaveVDth (was 8)
    WRITE_BYTE 0x55 6 // SaveVWnd (was 10)
    WRITE_BYTE 0x56 5 // SaveVPoly (was 9)
    WRITE_BYTE 0x57 8 // SaveVAtks (was 9)
    WRITE_BYTE 0x58 7 // SaveVspell (was 11)
    WRITE_BYTE 0x23b 21 // Wis (was 9)
    WRITE_BYTE 0x23c 13 // Dex (was 9)
    WRITE_BYTE 0x23d 16 // Con (was 9)
    WRITE_ASCII 0x260 ~bppri12a~ #8 // General (was NONE)
    WRITE_ASCII 0x268 ~bpwtrsgt~ #8 // Default (was WTASIGHT)
    SET_BG2_PROFICIENCY ~PROFICIENCYSPEAR~ 4
  END
BUT_ONLY

COPY_EXISTING ~sahpr3.cre~ ~override~ //High Priestess Tlyysixxous
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_SHORT 0x24 181 // CurrHP (was 81)
    WRITE_SHORT 0x26 181 // MaxHP (was 81)
    WRITE_SHORT 0x46 ~-4~ // ACNatul (was 5)
    WRITE_SHORT 0x48 ~-4~ // ACEffec (was 5)
    WRITE_BYTE 0x52 8 // THAC0 (was 11)
    WRITE_BYTE 0x53 8 // NOAtt (was 2)
    WRITE_BYTE 0x54 2 // SaveVDth (was 8)
    WRITE_BYTE 0x55 6 // SaveVWnd (was 10)
    WRITE_BYTE 0x56 5 // SaveVPoly (was 9)
    WRITE_BYTE 0x57 8 // SaveVAtks (was 9)
    WRITE_BYTE 0x58 7 // SaveVspell (was 11)
    WRITE_BYTE 0x23b 19 // Wis (was 9)
    WRITE_BYTE 0x23d 16 // Con (was 9)
    WRITE_BYTE 0x241 255 // Racial (was 0)
    WRITE_ASCII 0x250 ~bppri10a~ #8 // Class (was NONE)
    WRITE_ASCII 0x260 ~bpleader~ #8 // General (was NONE)
    WRITE_ASCII 0x268 ~bpwtrsgt~ #8 // Default (was WTASIGHT)
    REMOVE_MEMORIZED_SPELL ~sppr214~
    REMOVE_MEMORIZED_SPELL ~sppr211~
    REMOVE_MEMORIZED_SPELL ~sppr315~
    REMOVE_MEMORIZED_SPELL ~sppr310~
    ADD_MEMORIZED_SPELL ~sppr109~ #0 ~priest~ (2)
    ADD_MEMORIZED_SPELL ~sppr111~ #0 ~priest~ (2)
    ADD_MEMORIZED_SPELL ~sppr211~ #1 ~priest~ (2)
    ADD_MEMORIZED_SPELL ~sppr208~ #1 ~priest~ (3)
    ADD_MEMORIZED_SPELL ~sppr214~ #1 ~priest~ (2)
    ADD_MEMORIZED_SPELL ~sppr310~ #2 ~priest~ (2)
    ADD_MEMORIZED_SPELL ~sppr315~ #2 ~priest~ (2)
    ADD_MEMORIZED_SPELL ~sppr303~ #2 ~priest~ (2)
    ADD_MEMORIZED_SPELL ~sppr403~ #3 ~priest~
    ADD_MEMORIZED_SPELL ~sppr416~ #3 ~priest~
    ADD_MEMORIZED_SPELL ~sppr517~ #4 ~priest~
    ADD_MEMORIZED_SPELL ~sppr506~ #4 ~priest~
    ADD_MEMORIZED_SPELL ~sppr699~ #5 ~priest~
    REPLACE_CRE_ITEM ~SAHSTAFF~ #0 #0 #0 ~NONE~ ~WEAPON1~ EQUIP TWOHANDED
    SET_BG2_PROFICIENCY ~PROFICIENCYQUARTERSTAFF~ 4
  END
BUT_ONLY

COPY_EXISTING ~sahpr4.cre~ ~override~ //Senior Priestess Sallinithyl
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_SHORT 0x24 160 // CurrHP (was 8100)
    WRITE_SHORT 0x26 160 // MaxHP (was 8100)
    WRITE_SHORT 0x46 ~-8~ // ACNatul (was -20)
    WRITE_SHORT 0x48 ~-8~ // ACEffec (was -20)
    WRITE_BYTE 0x52 5 // THAC0 (was 11)
    WRITE_BYTE 0x53 8 // NOAtt (was 1)
    WRITE_BYTE 0x54 3 // SaveVDth (was 1)
    WRITE_BYTE 0x55 5 // SaveVWnd (was 1)
    WRITE_BYTE 0x56 4 // SaveVPoly (was 1)
    WRITE_BYTE 0x57 4 // SaveVAtks (was 1)
    WRITE_BYTE 0x58 6 // SaveVspell (was 1)
    WRITE_BYTE 0x59 231 // RstFire (was 125)
    WRITE_BYTE 0x5a 50 // RstCold (was 100)
    WRITE_BYTE 0x5b 50 // RstElec (was 100)
    WRITE_BYTE 0x5c 0 // RstAcid (was 100)
    WRITE_BYTE 0x5d 50 // RstMagc (was 100)
    WRITE_BYTE 0x5e 231 // RstMFre (was 127)
    WRITE_BYTE 0x5f 50 // RstMCld (was 100)
    WRITE_BYTE 0x60 25 // RstSlash (was 100)
    WRITE_BYTE 0x61 25 // RstCrush (was 100)
    WRITE_BYTE 0x62 50 // RstPierc (was 100)
    WRITE_BYTE 0x63 50 // RstMissl (was 100)
    WRITE_BYTE 0x234 21 // HighestLevelPrimary (was 20)
    WRITE_ASCII 0x250 ~bppri18c~ #8 // Class (was )
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    ADD_MEMORIZED_SPELL ~sppr208~ #1 ~priest~ (4)
    ADD_MEMORIZED_SPELL ~sppr211~ #1 ~priest~ (3)
    ADD_MEMORIZED_SPELL ~sppr301~ #2 ~priest~ (3)
    ADD_MEMORIZED_SPELL ~sppr306~ #2 ~priest~
    ADD_MEMORIZED_SPELL ~sppr310~ #2 ~priest~ (2)
    ADD_MEMORIZED_SPELL ~sppr409~ #3 ~priest~
    ADD_MEMORIZED_SPELL ~sppr414~ #3 ~priest~ (3)
    ADD_MEMORIZED_SPELL ~sppr402~ #3 ~priest~ (2)
    ADD_MEMORIZED_SPELL ~sppr511~ #4 ~priest~ (2)
    ADD_MEMORIZED_SPELL ~sppr503~ #4 ~priest~ (2)
    ADD_MEMORIZED_SPELL ~sppr505~ #4 ~priest~ (2)
    ADD_MEMORIZED_SPELL ~sppr607~ #5 ~priest~ (2)
    ADD_MEMORIZED_SPELL ~sppr612~ #5 ~priest~
    ADD_MEMORIZED_SPELL ~sppr699~ #5 ~priest~
    ADD_MEMORIZED_SPELL ~sppr602~ #5 ~priest~
    ADD_MEMORIZED_SPELL ~sppr718~ #6 ~priest~
    ADD_MEMORIZED_SPELL ~sppr720~ #6 ~priest~
    REMOVE_CRE_ITEM ~S1-8~
    REPLACE_CRE_ITEM ~SAHSTAFF~ #0 #0 #0 ~NONE~ ~WEAPON1~ EQUIP TWOHANDED
    ADD_CRE_ITEM ~STAF01~ #0 #0 #0 ~UNSTEALABLE~ ~INV~
    SET_BG2_PROFICIENCY ~PROFICIENCYQUARTERSTAFF~ 4
  END
BUT_ONLY

COPY_EXISTING ~sahpr5.cre~ ~override~ //Priestess of Sekolah
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_SHORT 0x24 84 // CurrHP (was 51)
    WRITE_SHORT 0x26 84 // MaxHP (was 51)
    WRITE_SHORT 0x46 ~-3~ // ACNatul (was 5)
    WRITE_SHORT 0x48 ~-3~ // ACEffec (was 5)
    WRITE_BYTE 0x54 6 // SaveVDth (was 8)
    WRITE_BYTE 0x57 12 // SaveVAtks (was 9)
    WRITE_BYTE 0x234 11 // HighestLevelPrimary (was 9)
    WRITE_BYTE 0x23b 20 // Wis (was 9)
    WRITE_BYTE 0x23d 16 // Con (was 9)
    WRITE_ASCII 0x250 ~bp!plot~ #8 // Class (was )
    WRITE_ASCII 0x258 ~bppri12a~ #8 // Race (was SAHPRI12)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    REMOVE_KNOWN_SPELL ~sppr511~
    REMOVE_KNOWN_SPELL ~sppr511~
    REMOVE_MEMORIZED_SPELL ~sppr103~
    REMOVE_MEMORIZED_SPELL ~sppr211~
    REMOVE_MEMORIZED_SPELL ~sppr315~
    REMOVE_MEMORIZED_SPELL ~sppr511~
    ADD_MEMORIZED_SPELL ~sppr103~ #0 ~priest~ (5)
    ADD_MEMORIZED_SPELL ~sppr211~ #1 ~priest~ (2)
    ADD_MEMORIZED_SPELL ~sppr208~ #1 ~priest~ (2)
    ADD_MEMORIZED_SPELL ~sppr315~ #2 ~priest~ (3)
    ADD_MEMORIZED_SPELL ~sppr599~ #4 ~priest~
    REMOVE_CRE_ITEM ~SPER01~ ~SAHSPEAR~
    REPLACE_CRE_ITEM ~SAHSTAFF~ #0 #0 #0 ~NONE~ ~WEAPON1~ EQUIP TWOHANDED
    ADD_CRE_ITEM ~STAF01~ #0 #0 #0 ~UNSTEALABLE~ ~INV~
    SET_BG2_PROFICIENCY ~PROFICIENCYQUARTERSTAFF~ 4
  END
BUT_ONLY

COPY_EXISTING ~sahpri01.cre~ ~override~ //Sahuagin Prince
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_SHORT 0x24 222 // CurrHP (was 72)
    WRITE_SHORT 0x26 222 // MaxHP (was 72)
    WRITE_SHORT 0x46 ~-7~ // ACNatul (was 5)
    WRITE_SHORT 0x48 ~-7~ // ACEffec (was 5)
    WRITE_BYTE 0x52 3 // THAC0 (was 2)
    WRITE_BYTE 0x53 9 // NOAtt (was 5)
    WRITE_BYTE 0x54 3 // SaveVDth (was 10)
    WRITE_BYTE 0x55 5 // SaveVWnd (was 12)
    WRITE_BYTE 0x56 4 // SaveVPoly (was 11)
    WRITE_BYTE 0x57 4 // SaveVAtks (was 12)
    WRITE_BYTE 0x58 6 // SaveVspell (was 13)
    // WRITE_BYTE 0x71 3 // Unu3(Spears prof) (was 0)
    WRITE_BYTE 0x234 20 // HighestLevelPrimary (was 2)
    WRITE_BYTE 0x238 22 // Str (was 20)
    WRITE_BYTE 0x23a 18 // Int (was 13)
    WRITE_BYTE 0x23c 18 // Dex (was 9)
    WRITE_BYTE 0x23d 18 // Con (was 9)
    WRITE_BYTE 0x241 255 // Racial (was 0)
    WRITE_ASCII 0x258 ~bp!plot~ #8 // Race (was NONE)
    WRITE_ASCII 0x260 ~bpleader~ #8 // General (was NONE)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    REMOVE_CRE_ITEM ~S1-4~
    REPLACE_CRE_ITEM ~SAHSPEAR~ #0 #0 #0 ~NONE~ ~WEAPON1~ EQUIP TWOHANDED
    SET_BG2_PROFICIENCY ~PROFICIENCYSPEAR~ 5
  END
BUT_ONLY

COPY_EXISTING ~sahpri02.cre~ ~override~ //Royal High Priestess
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_SHORT 0x24 121 // CurrHP (was 81)
    WRITE_SHORT 0x26 121 // MaxHP (was 81)
    WRITE_SHORT 0x46 ~-3~ // ACNatul (was 5)
    WRITE_SHORT 0x48 ~-3~ // ACEffec (was 5)
    WRITE_BYTE 0x52 8 // THAC0 (was 11)
    WRITE_BYTE 0x53 2 // NOAtt (was 1)
    WRITE_BYTE 0x54 5 // SaveVDth (was 8)
    WRITE_BYTE 0x55 9 // SaveVWnd (was 10)
    WRITE_BYTE 0x56 8 // SaveVPoly (was 9)
    WRITE_BYTE 0x57 11 // SaveVAtks (was 9)
    WRITE_BYTE 0x58 10 // SaveVspell (was 11)
    WRITE_BYTE 0x234 13 // HighestLevelPrimary (was 2)
    WRITE_BYTE 0x23b 20 // Wis (was 9)
    WRITE_BYTE 0x23d 18 // Con (was 9)
    WRITE_ASCII 0x258 ~bppri10a~ #8 // Race (was NONE)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    REMOVE_MEMORIZED_SPELL ~sppr211~
    REMOVE_MEMORIZED_SPELL ~sppr315~
    ADD_MEMORIZED_SPELL ~sppr111~ #0 ~priest~ (2)
    ADD_MEMORIZED_SPELL ~sppr109~ #0 ~priest~ (2)
    ADD_MEMORIZED_SPELL ~sppr103~ #0 ~priest~ (3)
    ADD_MEMORIZED_SPELL ~sppr211~ #1 ~priest~ (2)
    ADD_MEMORIZED_SPELL ~sppr208~ #1 ~priest~ (2)
    ADD_MEMORIZED_SPELL ~sppr214~ #1 ~priest~
    ADD_MEMORIZED_SPELL ~sppr203~ #1 ~priest~
    ADD_MEMORIZED_SPELL ~sppr315~ #2 ~priest~ (2)
    ADD_MEMORIZED_SPELL ~sppr303~ #2 ~priest~
    ADD_MEMORIZED_SPELL ~sppr314~ #2 ~priest~
    ADD_MEMORIZED_SPELL ~sppr411~ #3 ~priest~
    ADD_MEMORIZED_SPELL ~sppr517~ #4 ~priest~
    ADD_MEMORIZED_SPELL ~sppr613~ #5 ~priest~
    REMOVE_CRE_ITEM ~SPER01~ ~BOLT04~ ~BOLT01~ ~SAHSPEAR~ ~SAHBOLT~
    REPLACE_CRE_ITEM ~SAHSTAFF~ #0 #0 #0 ~NONE~ ~WEAPON1~ EQUIP TWOHANDED
    REPLACE_CRE_ITEM ~SAHBOLT~ #20 #0 #0 ~NONE~ ~QUIVER1~
    ADD_CRE_ITEM ~STAF01~ #0 #0 #0 ~UNSTEALABLE~ ~INV~
    SET_BG2_PROFICIENCY ~PROFICIENCYQUARTERSTAFF~ 4
    SET_BG2_PROFICIENCY ~PROFICIENCYCROSSBOW~ 4
  END
BUT_ONLY

COPY_EXISTING ~sahramb1.cre~ ~override~ //Rebel
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_SHORT 0x24 72 // CurrHP (was 57)
    WRITE_SHORT 0x26 72 // MaxHP (was 57)
    WRITE_SHORT 0x46 0 // ACNatul (was 2)
    WRITE_SHORT 0x48 0 // ACEffec (was 2)
    WRITE_BYTE 0x54 8 // SaveVDth (was 13)
    WRITE_BYTE 0x55 10 // SaveVWnd (was 15)
    WRITE_BYTE 0x56 9 // SaveVPoly (was 14)
    WRITE_BYTE 0x57 9 // SaveVAtks (was 16)
    WRITE_BYTE 0x58 11 // SaveVspell (was 16)
    WRITE_BYTE 0x234 9 // HighestLevelPrimary (was 8)
    WRITE_BYTE 0x238 20 // Str (was 17)
    WRITE_BYTE 0x23c 16 // Dex (was 13)
    WRITE_BYTE 0x23d 16 // Con (was 9)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    REMOVE_CRE_ITEM ~BOLT01~ ~BOLT04~
    REPLACE_CRE_ITEM ~SAHSPEAR~ #0 #0 #0 ~NONE~ ~WEAPON1~ EQUIP TWOHANDED
    REPLACE_CRE_ITEM ~SAHBOLT~ #20 #0 #0 ~NONE~ ~QUIVER1~
    SET_BG2_PROFICIENCY ~PROFICIENCYQUARTERSTAFF~ 3
    SET_BG2_PROFICIENCY ~PROFICIENCYCROSSBOW~ 3
  END
BUT_ONLY

COPY_EXISTING ~sahramb2.cre~ ~override~ //Rebel
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_SHORT 0x24 78 // CurrHP (was 57)
    WRITE_SHORT 0x26 78 // MaxHP (was 57)
    WRITE_SHORT 0x46 0 // ACNatul (was 2)
    WRITE_SHORT 0x48 0 // ACEffec (was 2)
    WRITE_BYTE 0x54 8 // SaveVDth (was 13)
    WRITE_BYTE 0x55 10 // SaveVWnd (was 15)
    WRITE_BYTE 0x56 9 // SaveVPoly (was 14)
    WRITE_BYTE 0x57 9 // SaveVAtks (was 16)
    WRITE_BYTE 0x58 11 // SaveVspell (was 16)
    WRITE_BYTE 0x234 10 // HighestLevelPrimary (was 8)
    WRITE_BYTE 0x238 20 // Str (was 17)
    WRITE_BYTE 0x23c 16 // Dex (was 13)
    WRITE_BYTE 0x23d 16 // Con (was 9)
    WRITE_ASCII 0x248 ~~ #8 // Override (was GPSHOUT)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    REMOVE_CRE_ITEM ~BOLT01~ ~BOLT04~ ~SAHSTAFF~ ~SAHBOLT~
    REPLACE_CRE_ITEM ~SAHSPEAR~ #0 #0 #0 ~NONE~ ~WEAPON1~ EQUIP TWOHANDED
    REPLACE_CRE_ITEM ~SAHBOLT~ #20 #0 #0 ~NONE~ ~QUIVER1~
    SET_BG2_PROFICIENCY ~PROFICIENCYSPEAR~ 3
    SET_BG2_PROFICIENCY ~PROFICIENCYCROSSBOW~ 3
  END
BUT_ONLY

COPY_EXISTING ~sahramb3.cre~ ~override~ //Priestess
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_SHORT 0x24 186 // CurrHP (was 81)
    WRITE_SHORT 0x26 186 // MaxHP (was 81)
    WRITE_SHORT 0x46 ~-8~ // ACNatul (was 5)
    WRITE_SHORT 0x48 ~-8~ // ACEffec (was 5)
    WRITE_BYTE 0x52 3 // THAC0 (was 11)
    WRITE_BYTE 0x53 3 // NOAtt (was 2)
    WRITE_BYTE 0x54 4 // SaveVDth (was 8)
    WRITE_BYTE 0x55 8 // SaveVWnd (was 10)
    WRITE_BYTE 0x56 7 // SaveVPoly (was 9)
    WRITE_BYTE 0x57 10 // SaveVAtks (was 9)
    WRITE_BYTE 0x58 9 // SaveVspell (was 11)
    WRITE_BYTE 0x234 16 // HighestLevelPrimary (was 14)
    WRITE_BYTE 0x23b 20 // Wis (was 9)
    WRITE_BYTE 0x23c 18 // Dex (was 9)
    WRITE_BYTE 0x23d 18 // Con (was 9)
    WRITE_ASCII 0x248 ~~ #8 // Override (was GPSHOUT)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    WRITE_BYTE 0x270 255 // EnemyAlly (was 128)
    REMOVE_MEMORIZED_SPELL ~sppr208~
    REMOVE_MEMORIZED_SPELL ~sppr401~
    REMOVE_MEMORIZED_SPELL ~sppr503~
    REMOVE_MEMORIZED_SPELL ~sppr607~
    ADD_MEMORIZED_SPELL ~sppr208~ #1 ~priest~ (5)
    ADD_MEMORIZED_SPELL ~sppr211~ #1 ~priest~ (3)
    ADD_MEMORIZED_SPELL ~sppr310~ #2 ~priest~ (3)
    ADD_MEMORIZED_SPELL ~sppr315~ #2 ~priest~ (4)
    ADD_MEMORIZED_SPELL ~sppr401~ #3 ~priest~ (2)
    ADD_MEMORIZED_SPELL ~sppr409~ #3 ~priest~
    ADD_MEMORIZED_SPELL ~sppr405~ #3 ~priest~ (2)
    ADD_MEMORIZED_SPELL ~sppr503~ #4 ~priest~ (2)
    ADD_MEMORIZED_SPELL ~sppr513~ #4 ~priest~
    ADD_MEMORIZED_SPELL ~sppr599~ #4 ~priest~
    ADD_MEMORIZED_SPELL ~sppr607~ #5 ~priest~ (2)
    ADD_MEMORIZED_SPELL ~sppr699~ #5 ~priest~
    ADD_MEMORIZED_SPELL ~sppr698~ #5 ~priest~
    ADD_MEMORIZED_SPELL ~sppr737~ #6 ~priest~ (2)
    REMOVE_CRE_ITEM ~SPER01~
    ADD_CRE_ITEM ~STAF01~ #0 #0 #0 ~NONE~ ~INV1~
    SET_BG2_PROFICIENCY ~PROFICIENCYQUARTERSTAFF~ 3
  END
BUT_ONLY

COPY_EXISTING ~sahramb4.cre~ ~override~ //Rebel
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_SHORT 0x24 120 // CurrHP (was 81)
    WRITE_SHORT 0x26 120 // MaxHP (was 81)
    WRITE_SHORT 0x46 ~-3~ // ACNatul (was 5)
    WRITE_SHORT 0x48 ~-3~ // ACEffec (was 5)
    WRITE_BYTE 0x52 6 // THAC0 (was 11)
    WRITE_BYTE 0x53 3 // NOAtt (was 2)
    WRITE_BYTE 0x54 5 // SaveVDth (was 8)
    WRITE_BYTE 0x55 7 // SaveVWnd (was 10)
    WRITE_BYTE 0x56 6 // SaveVPoly (was 9)
    WRITE_BYTE 0x57 5 // SaveVAtks (was 9)
    WRITE_BYTE 0x58 8 // SaveVspell (was 11)
    WRITE_BYTE 0x234 14 // HighestLevelPrimary (was 2)
    WRITE_BYTE 0x238 21 // Str (was 16)
    WRITE_BYTE 0x23d 18 // Con (was 9)
    WRITE_ASCII 0x248 ~~ #8 // Override (was GPSHOUT)
    WRITE_ASCII 0x250 ~~ #8 // Class (was GPARCHER)
    WRITE_ASCII 0x268 ~bpgparch~ #8 // Default (was WTARSGT)
    REMOVE_CRE_ITEM ~XBOW01~ ~BOLT01~ ~SPER01~ ~RNDTRE02~
    REPLACE_CRE_ITEM ~XBOW04~ #0 #0 #0 ~NONE~ ~WEAPON1~ EQUIP TWOHANDED
    REPLACE_CRE_ITEM ~SAHBOLT~ #40 #0 #0 ~NONE~ ~QUIVER1~
    SET_BG2_PROFICIENCY ~PROFICIENCYCROSSBOW~ 4
  END
BUT_ONLY

COPY_EXISTING ~sahramb5.cre~ ~override~ //Rebel
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_SHORT 0x24 108 // CurrHP (was 81)
    WRITE_SHORT 0x26 108 // MaxHP (was 81)
    WRITE_SHORT 0x46 ~-5~ // ACNatul (was 5)
    WRITE_SHORT 0x48 ~-5~ // ACEffec (was 5)
    WRITE_BYTE 0x52 7 // THAC0 (was 11)
    WRITE_BYTE 0x53 8 // NOAtt (was 2)
    WRITE_BYTE 0x54 7 // SaveVDth (was 8)
    WRITE_BYTE 0x55 9 // SaveVWnd (was 10)
    WRITE_BYTE 0x56 8 // SaveVPoly (was 9)
    WRITE_BYTE 0x57 8 // SaveVAtks (was 9)
    WRITE_BYTE 0x58 10 // SaveVspell (was 11)
    WRITE_BYTE 0x234 12 // HighestLevelPrimary (was 2)
    WRITE_ASCII 0x248 ~~ #8 // Override (was GPSHOUT)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    REMOVE_CRE_ITEM ~RNDTRE04~ ~BOLT01~ ~SPER01~ ~SAHSTAFF~
    REPLACE_CRE_ITEM ~SAHSPEAR~ #0 #0 #0 ~NONE~ ~WEAPON2~
    REPLACE_CRE_ITEM ~SAHBOLT~ #20 #0 #0 ~NONE~ ~QUIVER1~
    SET_BG2_PROFICIENCY ~PROFICIENCYSPEAR~ 3
    SET_BG2_PROFICIENCY ~PROFICIENCYCROSSBOW~ 3
  END
BUT_ONLY

COPY_EXISTING ~sahreb02.cre~ ~override~ //Prince Villynaty
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_SHORT 0x24 226 // CurrHP (was 76)
    WRITE_SHORT 0x26 226 // MaxHP (was 76)
    WRITE_SHORT 0x46 ~-7~ // ACNatul (was 5)
    WRITE_SHORT 0x48 ~-7~ // ACEffec (was 5)
    WRITE_BYTE 0x53 4 // NOAtt (was 5)
    WRITE_BYTE 0x54 3 // SaveVDth (was 10)
    WRITE_BYTE 0x55 5 // SaveVWnd (was 12)
    WRITE_BYTE 0x56 4 // SaveVPoly (was 11)
    WRITE_BYTE 0x57 4 // SaveVAtks (was 12)
    WRITE_BYTE 0x58 6 // SaveVspell (was 13)
    WRITE_BYTE 0x238 22 // Str (was 20)
    WRITE_BYTE 0x23c 19 // Dex (was 9)
    WRITE_BYTE 0x23d 19 // Con (was 9)
    WRITE_ASCII 0x258 ~bp!plot~ #8 // Race (was NONE)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    REMOVE_CRE_ITEM ~S1-8~
    REPLACE_CRE_ITEM ~SAHSPEAR~ #0 #0 #0 ~NONE~ ~WEAPON1~ EQUIP TWOHANDED
    SET_BG2_PROFICIENCY ~PROFICIENCYSPEAR~ 5
  END
BUT_ONLY

COPY_EXISTING ~sahrnt01.cre~ ~override~ //Rebel
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_SHORT 0x24 108 // CurrHP (was 81)
    WRITE_SHORT 0x26 108 // MaxHP (was 81)
    WRITE_SHORT 0x46 ~-5~ // ACNatul (was 5)
    WRITE_SHORT 0x48 ~-5~ // ACEffec (was 5)
    WRITE_BYTE 0x52 8 // THAC0 (was 11)
    WRITE_BYTE 0x53 8 // NOAtt (was 2)
    WRITE_BYTE 0x54 7 // SaveVDth (was 8)
    WRITE_BYTE 0x55 9 // SaveVWnd (was 10)
    WRITE_BYTE 0x56 8 // SaveVPoly (was 9)
    WRITE_BYTE 0x57 8 // SaveVAtks (was 9)
    WRITE_BYTE 0x58 10 // SaveVspell (was 11)
    WRITE_BYTE 0x234 12 // HighestLevelPrimary (was 2)
    WRITE_BYTE 0x23c 16 // Dex (was 9)
    WRITE_BYTE 0x23d 6 // Con (was 9)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    REMOVE_CRE_ITEM ~XBOW01~ ~BOLT01~ ~BOLT04~
    REPLACE_CRE_ITEM ~XBOW04~ #0 #0 #0 ~NONE~ ~WEAPON1~ EQUIP TWOHANDED
    REPLACE_CRE_ITEM ~SAHSPEAR~ #0 #0 #0 ~NONE~ ~WEAPON2~
    REPLACE_CRE_ITEM ~SAHBOLT~ #20 #0 #0 ~NONE~ ~QUIVER1~
    SET_BG2_PROFICIENCY ~PROFICIENCYSPEAR~ 3
    SET_BG2_PROFICIENCY ~PROFICIENCYCROSSBOW~ 3
  END
BUT_ONLY

COPY_EXISTING ~sahryl01.cre~ ~override~ //Sahuagin Royal Guard
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_SHORT 0x24 132 // CurrHP (was 81)
    WRITE_SHORT 0x26 132 // MaxHP (was 81)
    WRITE_SHORT 0x46 ~-5~ // ACNatul (was 5)
    WRITE_SHORT 0x48 ~-5~ // ACEffec (was 5)
    WRITE_BYTE 0x52 6 // THAC0 (was 4)
    WRITE_BYTE 0x53 8 // NOAtt (was 2)
    WRITE_BYTE 0x54 4 // SaveVDth (was 8)
    WRITE_BYTE 0x55 6 // SaveVWnd (was 10)
    WRITE_BYTE 0x56 5 // SaveVPoly (was 9)
    WRITE_BYTE 0x57 4 // SaveVAtks (was 9)
    WRITE_BYTE 0x58 7 // SaveVspell (was 11)
    WRITE_BYTE 0x234 16 // HighestLevelPrimary (was 2)
    WRITE_BYTE 0x23c 19 // Dex (was 9)
    WRITE_BYTE 0x23d 19 // Con (was 9)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    REMOVE_CRE_ITEM ~BOLT01~ ~BOLT04~ ~SAHBOLT~
    REPLACE_CRE_ITEM ~SAHBOLT~ #20 #0 #0 ~NONE~ ~QUIVER1~
    SET_BG2_PROFICIENCY ~PROFICIENCYSPEAR~ 3
    SET_BG2_PROFICIENCY ~PROFICIENCYCROSSBOW~ 3
  END
BUT_ONLY

COPY_EXISTING ~sahsss01.cre~ ~override~ //Rebel
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_SHORT 0x24 65 // CurrHP (was 19)
    WRITE_SHORT 0x26 65 // MaxHP (was 19)
    WRITE_SHORT 0x46 0 // ACNatul (was 5)
    WRITE_SHORT 0x48 0 // ACEffec (was 5)
    WRITE_BYTE 0x52 13 // THAC0 (was 19)
    WRITE_BYTE 0x54 10 // SaveVDth (was 14)
    WRITE_BYTE 0x55 12 // SaveVWnd (was 16)
    WRITE_BYTE 0x56 11 // SaveVPoly (was 15)
    WRITE_BYTE 0x57 12 // SaveVAtks (was 17)
    WRITE_BYTE 0x58 13 // SaveVspell (was 17)
    WRITE_BYTE 0x234 8 // HighestLevelPrimary (was 2)
    WRITE_BYTE 0x238 19 // Str (was 9)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    REMOVE_CRE_ITEM ~XBOW01~ ~BOLT01~ ~SPER01~
    REPLACE_CRE_ITEM ~XBOW04~ #0 #0 #0 ~NONE~ ~WEAPON1~ EQUIP TWOHANDED
    REPLACE_CRE_ITEM ~SAHBOLT~ #20 #0 #0 ~NONE~ ~QUIVER1~
    ADD_CRE_ITEM ~STAF01~ #0 #0 #0 ~UNSTEALABLE~ ~INV~
    SET_BG2_PROFICIENCY ~PROFICIENCYQUARTERSTAFF~ 3
    SET_BG2_PROFICIENCY ~PROFICIENCYCROSSBOW~ 3
  END
BUT_ONLY

COPY_EXISTING ~sahsss02.cre~ ~override~ //Rebel
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_SHORT 0x24 88 // CurrHP (was 19)
    WRITE_SHORT 0x26 88 // MaxHP (was 19)
    WRITE_SHORT 0x46 ~-1~ // ACNatul (was 5)
    WRITE_SHORT 0x48 ~-1~ // ACEffec (was 5)
    WRITE_BYTE 0x52 10 // THAC0 (was 19)
    WRITE_BYTE 0x54 8 // SaveVDth (was 14)
    WRITE_BYTE 0x55 10 // SaveVWnd (was 16)
    WRITE_BYTE 0x56 9 // SaveVPoly (was 15)
    WRITE_BYTE 0x57 9 // SaveVAtks (was 17)
    WRITE_BYTE 0x58 11 // SaveVspell (was 17)
    WRITE_BYTE 0x234 10 // HighestLevelPrimary (was 2)
    WRITE_BYTE 0x238 20 // Str (was 9)
    WRITE_BYTE 0x23c 15 // Dex (was 9)
    WRITE_BYTE 0x23d 15 // Con (was 9)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    REMOVE_CRE_ITEM ~SPER01~ ~BOLT01~ ~BOLT04~
    ADD_CRE_ITEM ~STAF01~ #0 #0 #0 ~UNSTEALABLE~ ~INV~
    SET_BG2_PROFICIENCY ~PROFICIENCYQUARTERSTAFF~ 3
    SET_BG2_PROFICIENCY ~PROFICIENCYCROSSBOW~ 3
  END
BUT_ONLY

COPY_EXISTING ~sahsss03.cre~ ~override~ //Rebel
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_SHORT 0x24 96 // CurrHP (was 19)
    WRITE_SHORT 0x26 96 // MaxHP (was 19)
    WRITE_SHORT 0x46 ~-3~ // ACNatul (was 5)
    WRITE_SHORT 0x48 ~-3~ // ACEffec (was 5)
    WRITE_BYTE 0x52 9 // THAC0 (was 19)
    WRITE_BYTE 0x53 8 // NOAtt (was 2)
    WRITE_BYTE 0x54 7 // SaveVDth (was 14)
    WRITE_BYTE 0x55 9 // SaveVWnd (was 16)
    WRITE_BYTE 0x56 8 // SaveVPoly (was 15)
    WRITE_BYTE 0x57 8 // SaveVAtks (was 17)
    WRITE_BYTE 0x58 10 // SaveVspell (was 17)
    WRITE_BYTE 0x234 12 // HighestLevelPrimary (was 2)
    WRITE_BYTE 0x238 20 // Str (was 9)
    WRITE_BYTE 0x23c 16 // Dex (was 9)
    WRITE_BYTE 0x23d 16 // Con (was 9)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    REMOVE_CRE_ITEM ~XBOW01~ ~BOLT01~ ~SAHSTAFF~
    REPLACE_CRE_ITEM ~XBOW04~ #0 #0 #0 ~NONE~ ~WEAPON1~ EQUIP TWOHANDED
    REPLACE_CRE_ITEM ~SAHSPEAR~ #0 #0 #0 ~NONE~ ~WEAPON2~
    REPLACE_CRE_ITEM ~SAHBOLT~ #20 #0 #0 ~NONE~ ~QUIVER1~
    SET_BG2_PROFICIENCY ~PROFICIENCYSPEAR~ 3
    SET_BG2_PROFICIENCY ~PROFICIENCYCROSSBOW~ 3
  END
BUT_ONLY

COPY_EXISTING ~sahbeh02.cre~ ~override~ //Sziltar's Apparition
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    REMOVE_CRE_ITEM ~SPER01~
    REPLACE_CRE_ITEM ~KUOSPER~ #0 #0 #0 ~NONE~ ~WEAPON1~ EQUIP
  END
BUT_ONLY

COPY_EXISTING ~sahbeh04.cre~ ~override~ //Sziltar's Apparition
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x250 ~bpmag16m~ #8 // Class (was NONE)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~sahoty01.cre~ ~override~ //Ettin
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    REPLACE_CRE_ITEM ~BOULDER~ #8 #0 #0 ~NONE~ ~WEAPON2~
  END
BUT_ONLY

COPY_EXISTING ~elesah01.cre~ ~override~ //Sahuagin Baron
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_BYTE 0x241 255 // Racial (was 0)
    WRITE_ASCII 0x248 ~bp!plot~ #8 // Override (was GENSHT01)
    WRITE_ASCII 0x250 ~bpleader~ #8 // Class (was NONE)
    WRITE_ASCII 0x258 ~gensht01~ #8 // Race (was NONE)
    WRITE_ASCII 0x268 ~bpwtrsgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~elekuo02.cre~ ~override~ //Kuo-Toa Whip
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_ASCII 0x268 ~bpthief~ #8 // Default (was WTARSGT)
    ADD_MEMORIZED_SPELL ~spin487~ #0 ~innate~ (3)
    ADD_MEMORIZED_SPELL ~spcl423~ #0 ~innate~ (3)
    ADD_MEMORIZED_SPELL ~spin483~ #0 ~innate~ (3)
  END
BUT_ONLY

COPY_EXISTING ~gorkuo02.cre~ ~override~ //Kuo-Toa Archer
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    // SAY NAME1 #71154 // LongName (was 71153)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~gorkuo03.cre~ ~override~ //Kuo-Toa Priest
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_BYTE 0x64 70 // DtectIll (was 0)
    WRITE_BYTE 0x68 80 // Stealth (was 0)
    WRITE_ASCII 0x268 ~bpthief~ #8 // Default (was WTARSGT)
    ADD_MEMORIZED_SPELL ~spin483~ #0 ~innate~ (3)
  END
BUT_ONLY

COPY_EXISTING ~gorkuo04.cre~ ~override~ //Kuo-Toa Captain
              ~obssah01.cre~ ~override~ //Sahuagin Baron
              ~ppsahale.cre~ ~override~ //Sahuagin Baron
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_ASCII 0x260 ~bpleader~ #8 // General (was NONE)
  END
BUT_ONLY

COPY_EXISTING ~gorkuo05.cre~ ~override~ //Kuo-Toa Whip
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_BYTE 0x64 50 // DtectIll (was 0)
    WRITE_BYTE 0x68 75 // Stealth (was 0)
    WRITE_ASCII 0x268 ~bpthief~ #8 // Default (was CTHIE20B)
    ADD_MEMORIZED_SPELL ~spcl423~ #0 ~innate~ (3)
    ADD_MEMORIZED_SPELL ~spin483~ #0 ~innate~ (3)
    ADD_MEMORIZED_SPELL ~spin487~ #0 ~innate~ (3)
    REMOVE_CRE_ITEM ~XBOW01~ ~KUOBOLT~
    REPLACE_CRE_ITEM ~XBOW03~ #0 #0 #0 ~NONE~ ~WEAPON2~
  END
BUT_ONLY


END

////////////////////////////////////////////////////////////////////////
DEFINE_ACTION_FUNCTION shadows BEGIN

INCLUDE ~bp/lib/bp_main.tph~

LAF shadow_scripts END


COPY_EXISTING ~kshadow.cre~ ~override~ //Shadow
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_BYTE 0x234 5 // HighestLevelPrimary (was 4)
    WRITE_ASCII 0x268 ~bpshadow~ #8 // Default (was WTASIGHT)
    REMOVE_MEMORIZED_SPELL ~spwi112~
    REMOVE_MEMORIZED_SPELL ~spwi212~
    REMOVE_MEMORIZED_SPELL ~spwi304~
    REMOVE_MEMORIZED_SPELL ~spwi308~
    REMOVE_MEMORIZED_SPELL ~spwi402~
    REMOVE_MEMORIZED_SPELL ~spwi415~
    REMOVE_MEMORIZED_SPELL ~spwi501~
    REMOVE_MEMORIZED_SPELL ~spwi502~
    REMOVE_MEMORIZED_SPELL ~spwi504~
    REMOVE_MEMORIZED_SPELL ~spwi508~
    REMOVE_MEMORIZED_SPELL ~spwi601~
    REMOVE_MEMORIZED_SPELL ~spwi602~
    REMOVE_MEMORIZED_SPELL ~spwi604~
    ADD_MEMORIZED_SPELL ~spwi125~ #0 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi106~ #0 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi105~ #0 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi212~ #1 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi205~ #1 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi201~ #1 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi314~ #2 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi317~ #2 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi405~ #3 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi409~ #3 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi412~ #3 ~wizard~
  END
BUT_ONLY

COPY_EXISTING ~shadfi01.cre~ ~override~ //Shadow Fiend
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_BYTE 0x234 7 // HighestLevelPrimary (was 5)
    WRITE_ASCII 0x268 ~bpshadow~ #8 // Default (was WTASIGHT)
    REMOVE_KNOWN_SPELL ~spwi112~
    REMOVE_KNOWN_SPELL ~spwi304~
    REMOVE_KNOWN_SPELL ~spwi505~
    REMOVE_KNOWN_SPELL ~spwi502~
    REMOVE_KNOWN_SPELL ~spwi306~
    REMOVE_KNOWN_SPELL ~spwi402~
    REMOVE_KNOWN_SPELL ~spwi601~
    REMOVE_KNOWN_SPELL ~spwi602~
    REMOVE_KNOWN_SPELL ~spwi415~
    REMOVE_KNOWN_SPELL ~spwi308~
    REMOVE_KNOWN_SPELL ~spwi604~
    REMOVE_KNOWN_SPELL ~spwi504~
    REMOVE_KNOWN_SPELL ~spwi508~
    REMOVE_MEMORIZED_SPELL ~spwi112~
    REMOVE_MEMORIZED_SPELL ~spwi212~
    REMOVE_MEMORIZED_SPELL ~spwi304~
    REMOVE_MEMORIZED_SPELL ~spwi306~
    REMOVE_MEMORIZED_SPELL ~spwi308~
    REMOVE_MEMORIZED_SPELL ~spwi402~
    REMOVE_MEMORIZED_SPELL ~spwi415~
    REMOVE_MEMORIZED_SPELL ~spwi502~
    REMOVE_MEMORIZED_SPELL ~spwi505~
    REMOVE_MEMORIZED_SPELL ~spwi504~
    REMOVE_MEMORIZED_SPELL ~spwi508~
    REMOVE_MEMORIZED_SPELL ~spwi601~
    REMOVE_MEMORIZED_SPELL ~spwi602~
    REMOVE_MEMORIZED_SPELL ~spwi604~
    ADD_MEMORIZED_SPELL ~spwi106~ #0 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi105~ #0 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi125~ #0 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi212~ #1 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi205~ #1 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi201~ #1 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi305~ #2 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi317~ #2 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi314~ #2 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi412~ #3 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi405~ #3 ~wizard~
  END
BUT_ONLY

COPY_EXISTING ~shadfi02.cre~ ~override~ //Devil Shade
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x260 ~bpshadow~ #8 // General (was NONE)
    REMOVE_MEMORIZED_SPELL ~spwi112~
    REMOVE_MEMORIZED_SPELL ~spwi212~
    REMOVE_MEMORIZED_SPELL ~spwi304~
    REMOVE_MEMORIZED_SPELL ~spwi308~
    REMOVE_MEMORIZED_SPELL ~spwi402~
    REMOVE_MEMORIZED_SPELL ~spwi415~
    REMOVE_MEMORIZED_SPELL ~spwi502~
    REMOVE_MEMORIZED_SPELL ~spwi504~
    REMOVE_MEMORIZED_SPELL ~spwi602~
    REMOVE_MEMORIZED_SPELL ~spwi604~
    ADD_MEMORIZED_SPELL ~spwi106~ #0 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi105~ #0 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi125~ #0 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi212~ #1 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi205~ #1 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi201~ #1 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi305~ #2 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi317~ #2 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi314~ #2 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi405~ #3 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi409~ #3 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi412~ #3 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi419~ #3 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi512~ #4 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi513~ #4 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi607~ #5 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi608~ #5 ~wizard~
    ADD_MEMORIZED_SPELL ~sumshad~ #0 ~innate~ (3)
  END
BUT_ONLY

COPY_EXISTING ~shadow01.cre~ ~override~ //Shadow
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 40 // CurrHP (was 30)
    WRITE_SHORT 0x26 40 // MaxHP (was 30)
    WRITE_BYTE 0x234 5 // HighestLevelPrimary (was 3)
    WRITE_ASCII 0x248 ~~ #8 // Override (was GENSHT01)
    WRITE_ASCII 0x268 ~bpshadow~ #8 // Default (was WTASIGHT)
    REMOVE_KNOWN_SPELL ~spwi112~
    REMOVE_KNOWN_SPELL ~spwi304~
    REMOVE_KNOWN_SPELL ~spwi505~
    REMOVE_KNOWN_SPELL ~spwi502~
    REMOVE_KNOWN_SPELL ~spwi306~
    REMOVE_KNOWN_SPELL ~spwi402~
    REMOVE_KNOWN_SPELL ~spwi601~
    REMOVE_KNOWN_SPELL ~spwi602~
    REMOVE_KNOWN_SPELL ~spwi501~
    REMOVE_KNOWN_SPELL ~spwi415~
    REMOVE_KNOWN_SPELL ~spwi308~
    REMOVE_KNOWN_SPELL ~spwi604~
    REMOVE_KNOWN_SPELL ~spwi504~
    REMOVE_KNOWN_SPELL ~spwi508~
    REMOVE_MEMORIZED_SPELL ~spwi112~
    REMOVE_MEMORIZED_SPELL ~spwi212~
    REMOVE_MEMORIZED_SPELL ~spwi304~
    REMOVE_MEMORIZED_SPELL ~spwi306~
    REMOVE_MEMORIZED_SPELL ~spwi308~
    REMOVE_MEMORIZED_SPELL ~spwi402~
    REMOVE_MEMORIZED_SPELL ~spwi415~
    REMOVE_MEMORIZED_SPELL ~spwi501~
    REMOVE_MEMORIZED_SPELL ~spwi502~
    REMOVE_MEMORIZED_SPELL ~spwi505~
    REMOVE_MEMORIZED_SPELL ~spwi504~
    REMOVE_MEMORIZED_SPELL ~spwi508~
    REMOVE_MEMORIZED_SPELL ~spwi601~
    REMOVE_MEMORIZED_SPELL ~spwi602~
    REMOVE_MEMORIZED_SPELL ~spwi604~
    ADD_MEMORIZED_SPELL ~spwi106~ #0 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi105~ #0 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi125~ #0 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi205~ #1 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi201~ #1 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi212~ #1 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi305~ #2 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi314~ #2 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi405~ #3 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi412~ #3 ~wizard~
  END
BUT_ONLY

COPY_EXISTING ~shadowsu.cre~ ~override~ //Shadow
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x250 ~~ #8 // Class (was GENSHT01)
    WRITE_ASCII 0x268 ~bpwtsigt~ #8 // Default (was WTASIGHT)
    REMOVE_KNOWN_SPELL ~spwi112~
    REMOVE_KNOWN_SPELL ~spwi304~
    REMOVE_KNOWN_SPELL ~spwi505~
    REMOVE_KNOWN_SPELL ~spwi212~
    REMOVE_KNOWN_SPELL ~spwi502~
    REMOVE_KNOWN_SPELL ~spwi306~
    REMOVE_KNOWN_SPELL ~spwi402~
    REMOVE_KNOWN_SPELL ~spwi601~
    REMOVE_KNOWN_SPELL ~spwi602~
    REMOVE_KNOWN_SPELL ~spwi501~
    REMOVE_KNOWN_SPELL ~spwi415~
    REMOVE_KNOWN_SPELL ~spwi308~
    REMOVE_KNOWN_SPELL ~spwi604~
    REMOVE_KNOWN_SPELL ~spwi504~
    REMOVE_KNOWN_SPELL ~spwi508~
    REMOVE_MEMORIZED_SPELL ~spwi112~
    REMOVE_MEMORIZED_SPELL ~spwi212~
    REMOVE_MEMORIZED_SPELL ~spwi304~
    REMOVE_MEMORIZED_SPELL ~spwi306~
    REMOVE_MEMORIZED_SPELL ~spwi308~
    REMOVE_MEMORIZED_SPELL ~spwi402~
    REMOVE_MEMORIZED_SPELL ~spwi415~
    REMOVE_MEMORIZED_SPELL ~spwi501~
    REMOVE_MEMORIZED_SPELL ~spwi502~
    REMOVE_MEMORIZED_SPELL ~spwi505~
    REMOVE_MEMORIZED_SPELL ~spwi504~
    REMOVE_MEMORIZED_SPELL ~spwi508~
    REMOVE_MEMORIZED_SPELL ~spwi601~
    REMOVE_MEMORIZED_SPELL ~spwi602~
    REMOVE_MEMORIZED_SPELL ~spwi604~
  END
BUT_ONLY

COPY_EXISTING ~shawol01.cre~ ~override~ //Shade Wolf
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_BYTE 0x234 5 // HighestLevelPrimary (was 4)
    REMOVE_CRE_ITEM ~P1-8~
    REPLACE_CRE_ITEM ~SHADOWWP~ #0 #0 #0 ~NONE~ ~WEAPON1~ EQUIP
  END
BUT_ONLY

COPY_EXISTING ~wraith01.cre~ ~override~ //Wraith
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 69 // CurrHP (was 43)
    WRITE_SHORT 0x26 69 // MaxHP (was 43)
    WRITE_BYTE 0x52 10 // THAC0 (was 9)
    WRITE_BYTE 0x234 10 // HighestLevelPrimary (was 6)
    WRITE_BYTE 0x23c 22 // Dex (was 10)
    WRITE_ASCII 0x250 ~bpmag14m~ #8 // Class (was NONE)
    WRITE_ASCII 0x268 ~bpshadow~ #8 // Default (was WTASIGHT)
    REMOVE_KNOWN_SPELL ~spwi112~
    REMOVE_KNOWN_SPELL ~spwi304~
    REMOVE_KNOWN_SPELL ~spwi502~
    REMOVE_KNOWN_SPELL ~spwi402~
    REMOVE_KNOWN_SPELL ~spwi601~
    REMOVE_KNOWN_SPELL ~spwi602~
    REMOVE_KNOWN_SPELL ~spwi415~
    REMOVE_KNOWN_SPELL ~spwi308~
    REMOVE_KNOWN_SPELL ~spwi604~
    REMOVE_KNOWN_SPELL ~spwi504~
    REMOVE_KNOWN_SPELL ~spwi508~
    REMOVE_MEMORIZED_SPELL ~spwi112~
    REMOVE_MEMORIZED_SPELL ~spwi212~
    REMOVE_MEMORIZED_SPELL ~spwi304~
    REMOVE_MEMORIZED_SPELL ~spwi308~
    REMOVE_MEMORIZED_SPELL ~spwi402~
    REMOVE_MEMORIZED_SPELL ~spwi415~
    REMOVE_MEMORIZED_SPELL ~spwi502~
    REMOVE_MEMORIZED_SPELL ~spwi504~
    REMOVE_MEMORIZED_SPELL ~spwi508~
    REMOVE_MEMORIZED_SPELL ~spwi601~
    REMOVE_MEMORIZED_SPELL ~spwi602~
    REMOVE_MEMORIZED_SPELL ~spwi604~
    ADD_MEMORIZED_SPELL ~spwi106~ #0 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi105~ #0 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi125~ #0 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi205~ #1 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi212~ #1 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi201~ #1 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi317~ #2 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi314~ #2 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi405~ #3 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi409~ #3 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi607~ #5 ~wizard~
    ADD_MEMORIZED_SPELL ~sumshad~ #0 ~innate~
  END
BUT_ONLY

COPY_EXISTING ~wrashi01.cre~ ~override~ //Shimmering Wraith
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 62 // CurrHP (was 32)
    WRITE_SHORT 0x26 62 // MaxHP (was 32)
    WRITE_BYTE 0x52 13 // THAC0 (was 17)
    WRITE_BYTE 0x234 8 // HighestLevelPrimary (was 6)
    WRITE_ASCII 0x250 ~bpmag14m~ #8 // Class (was NONE)
    WRITE_ASCII 0x268 ~bpshadow~ #8 // Default (was WTASIGHT)
    REMOVE_KNOWN_SPELL ~spwi112~
    REMOVE_KNOWN_SPELL ~spwi304~
    REMOVE_KNOWN_SPELL ~spwi502~
    REMOVE_KNOWN_SPELL ~spwi402~
    REMOVE_KNOWN_SPELL ~spwi602~
    REMOVE_KNOWN_SPELL ~spwi415~
    REMOVE_KNOWN_SPELL ~spwi308~
    REMOVE_KNOWN_SPELL ~spwi604~
    REMOVE_KNOWN_SPELL ~spwi504~
    REMOVE_MEMORIZED_SPELL ~spwi112~
    REMOVE_MEMORIZED_SPELL ~spwi212~
    REMOVE_MEMORIZED_SPELL ~spwi304~
    REMOVE_MEMORIZED_SPELL ~spwi308~
    REMOVE_MEMORIZED_SPELL ~spwi402~
    REMOVE_MEMORIZED_SPELL ~spwi415~
    REMOVE_MEMORIZED_SPELL ~spwi502~
    REMOVE_MEMORIZED_SPELL ~spwi504~
    REMOVE_MEMORIZED_SPELL ~spwi602~
    REMOVE_MEMORIZED_SPELL ~spwi604~
    ADD_MEMORIZED_SPELL ~spwi105~ #0 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi106~ #0 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi125~ #0 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi205~ #1 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi212~ #1 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi201~ #1 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi305~ #2 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi317~ #2 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi314~ #2 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi405~ #3 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi409~ #3 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi412~ #3 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi607~ #5 ~wizard~
    ADD_MEMORIZED_SPELL ~sumshad~ #0 ~innate~ (2)
  END
BUT_ONLY

COPY_EXISTING ~spectr01.cre~ ~override~ //Spectre
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 72 // CurrHP (was 59)
    WRITE_SHORT 0x26 72 // MaxHP (was 59)
    WRITE_ASCII 0x250 ~bpmag14m~ #8 // Class (was NONE)
    WRITE_ASCII 0x268 ~bpwtsigt~ #8 
    REMOVE_MEMORIZED_SPELL ~spwi112~
    REMOVE_MEMORIZED_SPELL ~spwi212~
    REMOVE_MEMORIZED_SPELL ~spwi304~
    REMOVE_MEMORIZED_SPELL ~spwi308~
    REMOVE_MEMORIZED_SPELL ~spwi402~
    REMOVE_MEMORIZED_SPELL ~spwi415~
    REMOVE_MEMORIZED_SPELL ~spwi502~
    REMOVE_MEMORIZED_SPELL ~spwi504~
    REMOVE_MEMORIZED_SPELL ~spwi602~
    REMOVE_MEMORIZED_SPELL ~spwi604~
    ADD_MEMORIZED_SPELL ~spwi106~ #0 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi105~ #0 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi125~ #0 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi212~ #1 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi205~ #1 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi201~ #1 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi305~ #2 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi317~ #2 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi314~ #2 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi405~ #3 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi409~ #3 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi412~ #3 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi419~ #3 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi512~ #4 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi513~ #4 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi607~ #5 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi618~ #5 ~wizard~
    ADD_MEMORIZED_SPELL ~sumshad~ #0 ~innate~ (3)
  END
BUT_ONLY

COPY_EXISTING ~spellh01.cre~ ~override~ //Spellhaunt
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x268 ~bpshadow~ #8 // Default (was WTASIGHT)
    REMOVE_KNOWN_SPELL ~spwi112~
    REMOVE_KNOWN_SPELL ~spwi304~
    REMOVE_KNOWN_SPELL ~spwi502~
    REMOVE_KNOWN_SPELL ~spwi402~
    REMOVE_KNOWN_SPELL ~spwi602~
    REMOVE_KNOWN_SPELL ~spwi501~
    REMOVE_KNOWN_SPELL ~spwi415~
    REMOVE_KNOWN_SPELL ~spwi308~
    REMOVE_KNOWN_SPELL ~spwi604~
    REMOVE_KNOWN_SPELL ~spwi504~
    REMOVE_MEMORIZED_SPELL ~spwi112~
    REMOVE_MEMORIZED_SPELL ~spwi212~
    REMOVE_MEMORIZED_SPELL ~spwi304~
    REMOVE_MEMORIZED_SPELL ~spwi308~
    REMOVE_MEMORIZED_SPELL ~spwi402~
    REMOVE_MEMORIZED_SPELL ~spwi415~
    REMOVE_MEMORIZED_SPELL ~spwi501~
    REMOVE_MEMORIZED_SPELL ~spwi502~
    REMOVE_MEMORIZED_SPELL ~spwi504~
    REMOVE_MEMORIZED_SPELL ~spwi602~
    REMOVE_MEMORIZED_SPELL ~spwi604~
    ADD_MEMORIZED_SPELL ~spwi125~ #0 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi201~ #1 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi205~ #1 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi212~ #1 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi305~ #2 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi317~ #2 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi314~ #2 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi405~ #3 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi409~ #3 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi412~ #3 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi419~ #3 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi513~ #4 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi618~ #5 ~wizard~
    ADD_MEMORIZED_SPELL ~sumshad~ #0 ~innate~ (3)
  END
BUT_ONLY

COPY_EXISTING ~uhcreat.cre~ ~override~ //Shadow
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 48 // CurrHP (was 60)
    WRITE_SHORT 0x26 48 // MaxHP (was 60)
    WRITE_BYTE 0x234 5 // HighestLevelPrimary (was 4)
    WRITE_BYTE 0x23c 21 // Dex (was 10)
    WRITE_ASCII 0x248 ~~ #8 // Override (was GENSHT01)
    WRITE_ASCII 0x268 ~bpshadow~ #8 // Default (was WTASIGHT)
    REMOVE_MEMORIZED_SPELL ~spwi112~
    REMOVE_MEMORIZED_SPELL ~spwi212~
    REMOVE_MEMORIZED_SPELL ~spwi304~
    REMOVE_MEMORIZED_SPELL ~spwi306~
    REMOVE_MEMORIZED_SPELL ~spwi308~
    REMOVE_MEMORIZED_SPELL ~spwi402~
    REMOVE_MEMORIZED_SPELL ~spwi415~
    REMOVE_MEMORIZED_SPELL ~spwi501~
    REMOVE_MEMORIZED_SPELL ~spwi502~
    REMOVE_MEMORIZED_SPELL ~spwi505~
    REMOVE_MEMORIZED_SPELL ~spwi504~
    REMOVE_MEMORIZED_SPELL ~spwi508~
    REMOVE_MEMORIZED_SPELL ~spwi601~
    REMOVE_MEMORIZED_SPELL ~spwi602~
    REMOVE_MEMORIZED_SPELL ~spwi604~
    ADD_MEMORIZED_SPELL ~spwi106~ #0 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi105~ #0 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi125~ #0 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi212~ #1 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi205~ #1 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi201~ #1 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi305~ #2 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi317~ #2 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi314~ #2 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi405~ #3 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi409~ #3 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi412~ #3 ~wizard~
  END
BUT_ONLY


END

/////////////////////////////////////////////////////////////////////////////////////////
DEFINE_ACTION_FUNCTION treants BEGIN


APPEND ~RACE.IDS~ ~160 TREANT~       UNLESS ~TREANT~
APPEND ~spell.ids~ ~3462 TREANT_SUMMON_TREE~ UNLESS ~TREANT_SUMMON_TREE~

ACTION_IF NOT FILE_EXISTS_IN_GAME ~mzo3a1.bam~ BEGIN
  COPY ~bp/bam/core/treant~ ~override~
END

ACTION_IF NOT FILE_EXISTS_IN_GAME ~sptreant.eff~ BEGIN
  COPY ~bp/sfx/core/sptreant.eff~ ~override~
END

ACTION_IF NOT FILE_EXISTS_IN_GAME ~gb-summ.bcs~ BEGIN
  COMPILE ~bp/baf/new_baf/core/gb-summ.baf~
END

ACTION_IF NOT FILE_EXISTS_IN_GAME ~bpdru14t.bcs~ BEGIN
  COMPILE ~bp/baf/re-baf/treant/bpdru14t.baf~
END 

ACTION_IF NOT FILE_EXISTS_IN_GAME ~bpwzasgt.bcs~ BEGIN
  ACTION_IF MOD_IS_INSTALLED ~setup-bp.tp2~ ~175~ BEGIN
    COMPILE ~bp/baf/shouts/no_strings_2/bpwzasgt.baf~
  END ELSE BEGIN
    COMPILE ~bp/baf/shouts/strings/bpwzasgt.baf~
  END
END 

ACTION_IF NOT FILE_EXISTS_IN_GAME ~spin462.spl~ BEGIN
  COPY ~bp/spl/spin462.spl~ ~override~
    SAY NAME1 @151 //Animate Tree
    SAY UNIDENTIFIED_DESC @152
END

ACTION_IF NOT FILE_EXISTS_IN_GAME ~bptresu.cre~ BEGIN
  COPY ~bp/cre/bptresu.cre~ ~override~
    SAY NAME1 @368 //Treant
    SAY NAME2 @368 //Treant
    WRITE_ASCII 0x268 ~bpwzasgt~ #8 // New clean summoners script
END

ACTION_IF NOT FILE_EXISTS_IN_GAME ~bptreant.cre~ BEGIN
COPY ~bp/cre/bptreant.cre~ ~override~
  SAY NAME1 @368 //Treant
  SAY NAME2 @368 //Treant
  WRITE_ASCII 0x268 ~bpwzasgt~ #8 // New clean summoners script
END

ACTION_IF NOT FILE_EXISTS_IN_GAME ~bptrebos.cre~ BEGIN
COPY ~bp/cre/bptrebos.cre~ ~override~
  SAY NAME1 @369 //Treant Chieftain
  SAY NAME2 @369 //Treant Chieftain
  WRITE_ASCII 0x268 ~bpwzasgt~ #8 // New clean summoners script
  PATCH_IF FILE_EXISTS_IN_GAME ~dd0012.are~ BEGIN
    ADD_MEMORIZED_SPELL ~sppr615~ #5 ~priest~
  END
END

ACTION_IF NOT FILE_EXISTS_IN_GAME ~bptreeld.cre~ BEGIN
COPY ~bp/cre/bptreeld.cre~ ~override~
  SAY NAME1 @370 //Treant Elder
  SAY NAME2 @370 //Treant Elder
  WRITE_ASCII 0x268 ~bpwzasgt~ #8 // New clean summoners script
END



END


/////////////////////////////////////////////////////////////////////////////////////////
DEFINE_ACTION_FUNCTION treant_spell BEGIN

APPEND ~RACE.IDS~ ~160 TREANT~       UNLESS ~TREANT~
APPEND ~spell.ids~ ~3462 TREANT_SUMMON_TREE~ UNLESS ~TREANT_SUMMON_TREE~


ACTION_IF NOT FILE_EXISTS_IN_GAME ~gb-summ.bcs~ BEGIN
  COMPILE ~bp/baf/new_baf/core/gb-summ.baf~
END

ACTION_IF NOT FILE_EXISTS_IN_GAME ~bpwzasgt.bcs~ BEGIN
  ACTION_IF MOD_IS_INSTALLED ~setup-bp.tp2~ ~175~ BEGIN
    COMPILE ~bp/baf/shouts/no_strings_2/bpwzasgt.baf~
  END ELSE BEGIN
    COMPILE ~bp/baf/shouts/strings/bpwzasgt.baf~
  END
END 

ACTION_IF NOT FILE_EXISTS_IN_GAME ~mzo3a1.bam~ BEGIN
  COPY ~bp/bam/core/treant~ ~override~
END

ACTION_IF NOT FILE_EXISTS_IN_GAME ~sptreant.eff~ BEGIN
  COPY ~bp/sfx/core/sptreant.eff~ ~override~
END


COPY_EXISTING ~spell.ids~ ~override~
SET xtc = 1 + IDS_OF_SYMBOL (~SPELL~ ~CLERIC_ANIMATE_TREE~)
ACTION_IF (xtc<1) BEGIN
  ADD_SPELL ~bp/spl/sppr716.spl~ ~1~ ~7~ ~CLERIC_ANIMATE_TREE~
    SAY NAME1 @151 //Animate Tree
    SAY UNIDENTIFIED_DESC @152
  
  COPY_EXISTING ~spell.ids~ ~override~

  // A fudgy move, until weidu can handle the 51-99 spell slots  
  SET xtc = 1 + IDS_OF_SYMBOL (~SPELL~ ~CLERIC_ANIMATE_TREE~)
  ACTION_IF (xtc<1) BEGIN
    COPY ~bp/spl/sppr716.spl~ ~override/sppr770.spl~
      SAY NAME1 @151 //Animate Tree
      SAY UNIDENTIFIED_DESC @152
    APPEND ~spell.ids~ ~1770 CLERIC_ANIMATE_TREE~ //it it won't do it the right way, shove that bitch into slot 70
  END
  OUTER_SET treant_set = 1
END


ACTION_IF NOT FILE_EXISTS_IN_GAME ~bptresu.cre~ BEGIN
  COPY ~bp/cre/bptresu.cre~ ~override~
    SAY NAME1 @368 //Treant
    SAY NAME2 @368 //Treant
  WRITE_ASCII 0x268 ~bpwzasgt~ #8 // New clean summoners script
END



END

///////////////TROLLS//////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////
DEFINE_ACTION_FUNCTION trolls BEGIN
INCLUDE ~bp/lib/bp_main.tph~

LAF troll_scripts END


COPY ~bp/bam/snowtroll~ ~override~

COPY_EXISTING ~obsice01.cre~ ~override~ //Snow Troll
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_SHORT 0x24 152 // CurrHP (was 172)
    WRITE_SHORT 0x26 152 // MaxHP (was 172)
    WRITE_SHORT 0x46 2 // ACNatul (was 4)
    WRITE_SHORT 0x48 2 // ACEffec (was 4)
    WRITE_BYTE 0x52 12 // THAC0 (was 13)
    WRITE_BYTE 0x234 11 // HighestLevelPrimary (was 9)
    WRITE_BYTE 0x238 19 // Str (was 18)
    WRITE_ASCII 0x248 ~trolsn01~ #8 // Override (was GENSHT01)
    WRITE_ASCII 0x250 ~gensht01~ #8 // Class (was NONE)
    WRITE_ASCII 0x258 ~bpprist6~ #8 // Race (was NONE)
    WRITE_ASCII 0x260 ~bpmage8~ #8 // General (was TROLSN01)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    REMOVE_CRE_ITEM ~TROLL01~
    REPLACE_CRE_ITEM ~TROLLSN~ #0 #0 #0 ~NONE~ ~WEAPON1~ EQUIP
    REPLACE_CRE_ITEM ~TROLLSN2~ #0 #0 #0 ~NONE~ ~WEAPON2~
  END
BUT_ONLY


COPY_EXISTING ~pptroll1.cre~ ~override~ //Spirit Troll
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 94 // CurrHP (was 64)
    WRITE_SHORT 0x26 94 // MaxHP (was 64)
    WRITE_BYTE 0x234 8 // HighestLevelPrimary (was 6)
    WRITE_BYTE 0x238 18 // Str (was 19)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~rogtro01.cre~ ~override~ //Sea Troll
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_BYTE 0x234 9 // HighestLevelPrimary (was 6)
    WRITE_ASCII 0x248 ~rogtro01~ #8 // Override (was GENSHT01)
    WRITE_ASCII 0x260 ~gensht01~ #8 // General (was ROGTRO01)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    WRITE_ASCII 0x280 ~rogtro02~ #32 // DeathVariable (was SEATROLL)
  END
BUT_ONLY

COPY_EXISTING ~rogtro02.cre~ ~override~ //Sea Troll
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x46 4 // ACNatul (was 10)
    WRITE_SHORT 0x48 4 // ACEffec (was 10)
    WRITE_BYTE 0x234 9 // HighestLevelPrimary (was 6)
    WRITE_BYTE 0x235 1 // HighestLevelSecond (was 30)
  END
BUT_ONLY

COPY_EXISTING ~trolde01.cre~ ~override~ //Desert Troll
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 68 // CurrHP (was 63)
    WRITE_SHORT 0x26 68 // MaxHP (was 63)
    WRITE_BYTE 0x234 7 // HighestLevelPrimary (was 6)
    WRITE_BYTE 0x239 51 // StrBon (was 0)
    WRITE_ASCII 0x248 ~trolde01~ #8 // Override (was GENSHT01)
    WRITE_ASCII 0x260 ~gensht01~ #8 // General (was TROLDE01)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~trolde02.cre~ ~override~ //Desert Troll
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x26 68 // MaxHP (was 163)
    WRITE_SHORT 0x46 4 // ACNatul (was 10)
    WRITE_SHORT 0x48 4 // ACEffec (was 10)
    WRITE_BYTE 0x234 7 // HighestLevelPrimary (was 6)
    WRITE_BYTE 0x235 1 // HighestLevelSecond (was 30)
    WRITE_BYTE 0x239 51 // StrBon (was 0)
    WRITE_ASCII 0x248 ~trolde02~ #8 // Override (was GENSHT01)
    WRITE_ASCII 0x260 ~~ #8 // General (was TROLDE02)
    WRITE_ASCII 0x268 ~~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~trolfr01.cre~ ~override~ //Troll
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 59 // CurrHP (was 49)
    WRITE_SHORT 0x26 59 // MaxHP (was 49)
    WRITE_BYTE 0x239 10 // StrBon (was 0)
    WRITE_ASCII 0x248 ~trolfr01~ #8 // Override (was GENSHT01)
    WRITE_ASCII 0x260 ~gensht01~ #8 // General (was TROLFR01)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    WRITE_BYTE 0x274 1 // IDSSpecifc (was 0)
  END
BUT_ONLY

COPY_EXISTING ~trolfr02.cre~ ~override~ //Troll
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x26 59 // MaxHP (was 149)
    WRITE_SHORT 0x46 4 // ACNatul (was 10)
    WRITE_SHORT 0x48 4 // ACEffec (was 10)
    WRITE_BYTE 0x235 1 // HighestLevelSecond (was 30)
    WRITE_BYTE 0x239 10 // StrBon (was 0)
    WRITE_ASCII 0x248 ~trolfr02~ #8 // Override (was GENSHT01)
    WRITE_ASCII 0x260 ~~ #8 // General (was TROLFR02)
    WRITE_ASCII 0x268 ~~ #8 // Default (was WTASIGHT)
    WRITE_BYTE 0x274 1 // IDSSpecifc (was 0)
  END
BUT_ONLY

COPY_EXISTING ~trolgi01.cre~ ~override~ //Giant Troll
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 121 // CurrHP (was 101)
    WRITE_SHORT 0x26 121 // MaxHP (was 101)
    WRITE_SHORT 0x46 3 // ACNatul (was 4)
    WRITE_SHORT 0x48 3 // ACEffec (was 4)
    WRITE_BYTE 0x52 12 // THAC0 (was 13)
    WRITE_BYTE 0x234 10 // HighestLevelPrimary (was 8)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~trolgi02.cre~ ~override~ //Giant Troll
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x26 121 // MaxHP (was 101)
    WRITE_SHORT 0x46 4 // ACNatul (was 10)
    WRITE_SHORT 0x48 4 // ACEffec (was 10)
    WRITE_BYTE 0x234 10 // HighestLevelPrimary (was 8)
    WRITE_ASCII 0x250 ~~ #8 // Default (was WTASIGHT)
    WRITE_ASCII 0x268 ~~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~trolic01.cre~ ~override~ //Ice Troll
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 37 // CurrHP (was 15)
    WRITE_SHORT 0x26 37 // MaxHP (was 15)
    WRITE_SHORT 0x46 6 // ACNatul (was 8)
    WRITE_SHORT 0x48 6 // ACEffec (was 8)
    WRITE_BYTE 0x52 15 // THAC0 (was 19)
    WRITE_BYTE 0x54 12 // SaveVDth (was 14)
    WRITE_BYTE 0x55 14 // SaveVWnd (was 16)
    WRITE_BYTE 0x56 13 // SaveVPoly (was 15)
    WRITE_BYTE 0x57 15 // SaveVAtks (was 17)
    WRITE_BYTE 0x58 15 // SaveVspell (was 17)
    WRITE_BYTE 0x239 10 // StrBon (was 0)
    WRITE_ASCII 0x248 ~trolic01~ #8 // Override (was GENSHT01)
    WRITE_ASCII 0x260 ~gensht01~ #8 // General (was TROLIC01)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~trolic02.cre~ ~override~ //Ice Troll
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x26 37 // MaxHP (was 100)
    WRITE_SHORT 0x46 6 // ACNatul (was 4)
    WRITE_SHORT 0x48 6 // ACEffec (was 4)
    WRITE_BYTE 0x52 15 // THAC0 (was 13)
    WRITE_BYTE 0x235 1 // HighestLevelSecond (was 30)
    WRITE_BYTE 0x238 18 // Str (was 19)
    WRITE_BYTE 0x239 10 // StrBon (was 0)
  END
BUT_ONLY

COPY_EXISTING ~trolic03.cre~ ~override~ //Blizzard Troll
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x248 ~trolic03~ #8 // Override (was GENSHT01)
    WRITE_ASCII 0x260 ~gensht01~ #8 // General (was TROLIC03)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    REMOVE_CRE_ITEM ~ICETRL~
    REPLACE_CRE_ITEM ~TROLLSN~ #0 #0 #0 ~UNDROPPABLE~ ~WEAPON1~
    REPLACE_CRE_ITEM ~TROLLSN2~ #0 #0 #0 ~UNDROPPABLE~ ~WEAPON2~ EQUIP
    SET_BG2_PROFICIENCY 110 2 //PROFICIENCYMARTIALARTS
  END
BUT_ONLY

COPY_EXISTING ~trolic04.cre~ ~override~ //Blizzard Troll
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x26 121 // MaxHP (was 125)
    REMOVE_CRE_ITEM ~ICETRL~
    REPLACE_CRE_ITEM ~TROLLSN~ #0 #0 #0 ~UNDROPPABLE~ ~WEAPON1~
    REPLACE_CRE_ITEM ~TROLLSN2~ #0 #0 #0 ~UNDROPPABLE~ ~WEAPON2~ EQUIP
    SET_BG2_PROFICIENCY 110 2 //PROFICIENCYMARTIALARTS
  END
BUT_ONLY

COPY_EXISTING ~troll01.cre~ ~override~ //Troll
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 85 // CurrHP (was 50)
    WRITE_SHORT 0x26 85 // MaxHP (was 50)
    WRITE_BYTE 0x238 18 // Str (was 15)
    WRITE_BYTE 0x239 100 // StrBon (was 0)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTATROLL)
  END
BUT_ONLY

COPY_EXISTING ~troll02.cre~ ~override~ //Troll
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x26 85 // MaxHP (was 100)
    WRITE_SHORT 0x46 4 // ACNatul (was 10)
    WRITE_SHORT 0x48 4 // ACEffec (was 10)
    WRITE_BYTE 0x234 8 // HighestLevelPrimary (was 6)
    WRITE_BYTE 0x235 1 // HighestLevelSecond (was 30)
  END
BUT_ONLY

COPY_EXISTING ~troll03.cre~ ~override~ //Troll
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x26 49 // MaxHP (was 40)
    WRITE_BYTE 0x234 8 // HighestLevelPrimary (was 6)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~trollens.cre~ ~override~ //Giant Troll
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 111 // CurrHP (was 101)
    WRITE_SHORT 0x26 111 // MaxHP (was 101)
    WRITE_SHORT 0x46 3 // ACNatul (was 4)
    WRITE_SHORT 0x48 3 // ACEffec (was 4)
    WRITE_BYTE 0x52 12 // THAC0 (was 13)
    WRITE_BYTE 0x54 10 // SaveVDth (was 11)
    WRITE_BYTE 0x55 12 // SaveVWnd (was 13)
    WRITE_BYTE 0x56 11 // SaveVPoly (was 12)
    WRITE_BYTE 0x57 12 // SaveVAtks (was 13)
    WRITE_BYTE 0x58 13 // SaveVspell (was 14)
    WRITE_BYTE 0x234 10 // HighestLevelPrimary (was 8)
    WRITE_ASCII 0x250 ~trolgi01~ #8 // Class (was GENSHT01)
    WRITE_ASCII 0x260 ~gensht01~ #8 // General (was NONE)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~trollsm2.cre~ ~override~ //Troll
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 49 // CurrHP (was 40)
    WRITE_SHORT 0x26 49 // MaxHP (was 40)
    WRITE_BYTE 0x235 1 // HighestLevelSecond (was 30)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~trolsi01.cre~ ~override~ //Spirit Troll
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 94 // CurrHP (was 64)
    WRITE_SHORT 0x26 94 // MaxHP (was 64)
    WRITE_SHORT 0x46 ~-2~ // ACNatul (was 8)
    WRITE_SHORT 0x48 ~-2~ // ACEffec (was 8)
    WRITE_BYTE 0x234 10 // HighestLevelPrimary (was 6)
    WRITE_ASCII 0x248 ~trolsi01~ #8 // Override (was GENSHT01)
    WRITE_ASCII 0x260 ~gensht01~ #8 // General (was TROLSI01)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    WRITE_BYTE 0x271 4 // IDSGeneral (was 1)
  END
BUT_ONLY

COPY_EXISTING ~trolsi02.cre~ ~override~ //Spirit Troll
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x26 94 // MaxHP (was 164)
    WRITE_SHORT 0x46 ~-2~ // ACNatul (was 10)
    WRITE_SHORT 0x48 ~-2~ // ACEffec (was 10)
    WRITE_BYTE 0x234 10 // HighestLevelPrimary (was 6)
    WRITE_BYTE 0x235 1 // HighestLevelSecond (was 30)
    WRITE_ASCII 0x248 ~~ #8 // Override (was GENSHT01)
    WRITE_ASCII 0x268 ~~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~trolsn01.cre~ ~override~ //Troll
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 146 // CurrHP (was 66)
    WRITE_SHORT 0x26 146 // MaxHP (was 66)
    WRITE_SHORT 0x46 2 // ACNatul (was 4)
    WRITE_SHORT 0x48 2 // ACEffec (was 4)
    WRITE_BYTE 0x52 11 // THAC0 (was 13)
    WRITE_BYTE 0x234 11 // HighestLevelPrimary (was 6)
    WRITE_BYTE 0x238 19 // Str (was 18)
    WRITE_ASCII 0x248 ~trolsn01~ #8 // Override (was GENSHT01)
    WRITE_ASCII 0x260 ~gensht01~ #8 // General (was TROLSN01)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    WRITE_BYTE 0x272 129 // IDSRace (was 108)
    WRITE_BYTE 0x273 167 // IDSClass (was 118)
    REMOVE_CRE_ITEM ~TROLL01~
    REPLACE_CRE_ITEM ~TROLLSN~ #0 #0 #0 ~NONE~ ~WEAPON1~ EQUIP
    REPLACE_CRE_ITEM ~TROLLSN2~ #0 #0 #0 ~UNDROPPABLE~ ~WEAPON2~
    SET_BG2_PROFICIENCY 110 2 //PROFICIENCYMARTIALARTS
  END
BUT_ONLY

COPY_EXISTING ~trolsn02.cre~ ~override~ //Troll
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x46 2 // ACNatul (was 10)
    WRITE_SHORT 0x48 2 // ACEffec (was 10)
    WRITE_BYTE 0x52 12 // THAC0 (was 13)
    WRITE_BYTE 0x234 11 // HighestLevelPrimary (was 6)
    WRITE_BYTE 0x235 1 // HighestLevelSecond (was 30)
    WRITE_BYTE 0x238 19 // Str (was 18)
    WRITE_ASCII 0x248 ~~ #8 // Override (was GENSHT01)
    WRITE_ASCII 0x268 ~~ #8 // Default (was WTASIGHT)
    WRITE_BYTE 0x272 129 // IDSRace (was 108)
    WRITE_BYTE 0x273 167 // IDSClass (was 118)
  END
BUT_ONLY

COPY_EXISTING ~trolsp01.cre~ ~override~ //Spectral Troll
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 118 // CurrHP (was 64)
    WRITE_SHORT 0x26 118 // MaxHP (was 64)
    WRITE_BYTE 0x52 11 // THAC0 (was 13)
    WRITE_BYTE 0x234 12 // HighestLevelPrimary (was 6)
    WRITE_BYTE 0x239 51 // StrBon (was 0)
//    WRITE_ASCII 0x248 ~trolsp01~ #8 // Override (was GENSHT01)
//    WRITE_ASCII 0x260 ~gensht01~ #8 // General (was TROLSP01)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    WRITE_BYTE 0x271 4 // IDSGeneral (was 255)
  END
BUT_ONLY

COPY_EXISTING ~trolsp02.cre~ ~override~ //Spectral Troll
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x26 118 // MaxHP (was 164)
    WRITE_SHORT 0x46 0 // ACNatul (was 10)
    WRITE_SHORT 0x48 0 // ACEffec (was 10)
    WRITE_BYTE 0x234 12 // HighestLevelPrimary (was 6)
    WRITE_BYTE 0x235 1 // HighestLevelSecond (was 30)
    WRITE_BYTE 0x239 51 // StrBon (was 0)
    WRITE_ASCII 0x248 ~~ #8 // Override (was GENSHT01)
    WRITE_ASCII 0x268 ~~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~troluo01.cre~ ~override~ //Troll
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_BYTE 0x234 8 // HighestLevelPrimary (was 6)
    WRITE_BYTE 0x235 1 // HighestLevelSecond (was 30)
    WRITE_BYTE 0x239 100 // StrBon (was 0)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~daspitro.cre~ ~override~ //Spirit Troll
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_BYTE 0x234 16 // HighestLevelPrimary (was 6)
    WRITE_ASCII 0x248 ~trolsi01~ #8 // Override (was )
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    REMOVE_CRE_ITEM ~TROLL01~
    REPLACE_CRE_ITEM ~TROLLSPI~ #0 #0 #0 ~NONE~ ~WEAPON1~ EQUIP
    REPLACE_CRE_ITEM ~TROLLIMM~ #0 #0 #0 ~NONE~ ~RRING~
    REPLACE_CRE_ITEM ~ILLBLUR~ #0 #0 #0 ~NONE~ ~HELMET~
  END
BUT_ONLY

COPY_EXISTING ~datroll.cre~ ~override~ //Troll
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_BYTE 0x239 100 // StrBon (was 0)
    WRITE_ASCII 0x248 ~troll01~ #8 // Override (was )
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY ~bp/cre/trolicd2.cre~ ~override~
  SAY NAME1 @339 //Rotted Ice Troll
  SAY NAME2 @339 //Rotted Ice Troll

COPY_EXISTING ~hgtrl01.cre~ ~override~ //Fire Troll
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    // SAY NAME1 #71156 // LongName (was 71155)
    WRITE_SHORT 0x24 125 // CurrHP (was 85)
    WRITE_SHORT 0x26 125 // MaxHP (was 85)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~hgtrl02.cre~ ~override~ //Fire Troll
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    // SAY NAME1 #71156 // LongName (was 71155)
    WRITE_SHORT 0x26 125 // MaxHP (was 85)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~plytroll.cre~ ~override~ //Troll
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_BYTE 0x234 8 // HighestLevelPrimary (was 6)
    WRITE_BYTE 0x238 18 // Str (was 17)
    WRITE_BYTE 0x239 100 // StrBon (was 0)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
    WRITE_BYTE 0x274 1 // IDSSpecifc (was 0)
  END
BUT_ONLY

COPY ~bp/cre/bptrol01.cre~ ~override~
     ~bp/cre/bptrsi01.cre~ ~override~
     ~bp/cre/bptrsn01.cre~ ~override~
     ~bp/cre/bptrsp01.cre~ ~override~
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~shtroll.cre~ ~override~ //Troll
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_BYTE 0x234 8 // HighestLevelPrimary (was 6)
    WRITE_BYTE 0x235 1 // HighestLevelSecond (was 30)
    WRITE_BYTE 0x239 100 // StrBon (was 0)
  END
BUT_ONLY



END

////////////////////////////////////////////////////////////////////////////////////
DEFINE_ACTION_FUNCTION undead BEGIN

INCLUDE ~bp/lib/bp_main.tph~

LAF undead_scripts END



COPY_EXISTING ~demilich.cre~ ~override~ //Demi-Lich
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    // SAY NAME1 #70407 // LongName (was 70406)
    WRITE_LONG 0x1c 5000 // Goldcarried (was 20000)
    WRITE_ASCII 0x268 ~bpwdasgt~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~ghastf01.cre~ ~override~ //Fell Ghast
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 47 // CurrHP (was 34)
    WRITE_SHORT 0x26 47 // MaxHP (was 34)
    WRITE_ASCII 0x248 ~~ #8 // Override (was GHAST)
  END
BUT_ONLY

COPY_EXISTING ~ghastgsu.cre~ ~override~ //Greater Ghast
  WRITE_LONG 0x14 0 //XP value (was 850)
BUT_ONLY

COPY_EXISTING ~ghastsu.cre~ ~override~ //Skeleton
  WRITE_LONG 0x14 0 //XP value (was 150)
  WRITE_LONG 0x18 28 //Power level (was 0)
  WRITE_SHORT 0x24 29 //Current HP
  WRITE_SHORT 0x26 29 //Maximum HP
  WRITE_SHORT 0x28 0x6403 //Animation (skeleton)
  WRITE_SHORT 0x46 4 //Natural AC
  WRITE_SHORT 0x48 4 //Effective AC
  WRITE_BYTE 0x52 16 //THAC0
  WRITE_BYTE 0x53 1 //Attacks per round
  WRITE_BYTE 0x5a 100 //Resist cold
  WRITE_BYTE 0x5b 100 //Resist electricity
  WRITE_BYTE 0x5f 100 //Resist magic cold
  WRITE_BYTE 0x63 30 //Resist missile
  WRITE_BYTE 0x234 3 //Level 1
  WRITE_BYTE 0x238 18 //Strength
  WRITE_BYTE 0x23a 16 //Intelligence
  WRITE_BYTE 0x23b 9 //Wisdom
  WRITE_BYTE 0x23c 9 //Dexterity
  WRITE_BYTE 0x23e 9 //Charisma
  WRITE_ASCII 0x248 ~bornwait~ #8 //Override script
  WRITE_ASCII 0x250 ~bpwdasgt~ #8 //Class script
  WRITE_BYTE 0x272 115 //Race
  WRITE_BYTE 0x273 134 //Class
  REPLACE_CRE_ITEM ~skelshld~ #0 #0 #0 ~NONE~ ~SHIELD~
  REPLACE_CRE_ITEM ~ring99~ #0 #0 #0 ~NONE~ ~LRING~
  REPLACE_CRE_ITEM ~skelclub~ #0 #0 #0 ~NONE~ ~WEAPON1~ EQUIP
BUT_ONLY

COPY_EXISTING ~ghogr01.cre~ ~override~ //Greater Ghoul
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x258 ~~ #8 // Race (was GHAST)
    WRITE_ASCII 0x268 ~bpundead~ #8 // Default (was )
  END
BUT_ONLY

COPY_EXISTING ~gholor01.cre~ ~override~ //Ghoul Lord
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x258 ~gholor01~ #8 // Race (was NONE)
    WRITE_ASCII 0x260 ~bpleader~ #8 // General (was GHOLOR01)
    WRITE_ASCII 0x268 ~bpundead~ #8 // Default (was )
  END
BUT_ONLY

ACTION_IF NOT FILE_EXISTS_IN_GAME ~grskel1.cre~ BEGIN  //TDD
  COPY ~bp/cre/grskel1.cre~ ~override~
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
      WRITE_ASCII 0x268 ~bpundead~ #8 // Default (was )
  END
  BUT_ONLY
END

ACTION_IF NOT FILE_EXISTS_IN_GAME ~grskel2.cre~ BEGIN  //TDD
  COPY ~bp/cre/grskel2.cre~ ~override~
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
      WRITE_ASCII 0x268 ~bpundead~ #8 // Default (was )
  END
  BUT_ONLY
END

ACTION_IF NOT FILE_EXISTS_IN_GAME ~gzombie.cre~ BEGIN  //TDD
  COPY ~bp/cre/gzombie.cre~ ~override~
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
      SAY NAME1 @218 //Greater Zombie
      SAY NAME2 @218 //Greater Zombie
      WRITE_ASCII 0x268 ~bpundead~ #8 // Default (was )
  END
  BUT_ONLY
END

COPY_EXISTING ~hgskl02.cre~ ~override~ //Skeleton Assassin
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x260 ~bpcass2b~ #8 // General (was NONE)
      WRITE_ASCII 0x268 ~bpundead~ #8 // Default (was )
    ADD_MEMORIZED_SPELL ~spcl916~ #0 ~innate~ (3)
    ADD_MEMORIZED_SPELL ~spcl917~ #0 ~innate~
    ADD_MEMORIZED_SPELL ~spcl913~ #0 ~innate~
    ADD_MEMORIZED_SPELL ~spin483~ #0 ~innate~ (3)
  END
BUT_ONLY

COPY_EXISTING ~lich01.cre~ ~override~ //Lich
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x250 ~lich01~ #8 // Class (was MAGE18D)
    WRITE_ASCII 0x260 ~~ #8 // General (was WTASIGHT)
      WRITE_ASCII 0x268 ~bpundead~ #8 // Default (was )
  END
BUT_ONLY

COPY_EXISTING ~lichel01.cre~ ~override~ //Elemental Lich
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_LONG 0x18 11000 // PowerLevel (was 22000)
    WRITE_ASCII 0x250 ~bpmag20b~ #8 // Class (was MAGE18D)
      WRITE_ASCII 0x268 ~bpundead~ #8 // Default (was )
    WRITE_BYTE 0x274 101 // IDSSpecifc (was 0)
  END
BUT_ONLY

COPY_EXISTING ~mumgre01.cre~ ~override~ //Greater mummy
              ~riftcr03.cre~ ~override~ //Greater mummy
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x248 ~mummy01~ #8 // Override (was 16201)
      WRITE_ASCII 0x268 ~bpundead~ #8 // Default (was )
  END
BUT_ONLY

COPY_EXISTING ~mummy01.cre~ ~override~ //mummy
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 56 // CurrHP (was 51)
    WRITE_SHORT 0x26 56 // MaxHP (was 51)
      WRITE_ASCII 0x268 ~bpundead~ #8 // Default (was )
  END
BUT_ONLY


ACTION_IF NOT FILE_EXISTS_IN_GAME ~nighthag.cre~ BEGIN  //TDD
  COPY ~bp/cre/nighthag.cre~ ~override~
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    SAY NAME1 @263 //Night Hag
    SAY NAME2 @263 //Night Hag
      WRITE_ASCII 0x268 ~bpundead~ #8 // Default (was )
  END
BUT_ONLY
END

ACTION_IF NOT FILE_EXISTS_IN_GAME ~nighthag.cre~ BEGIN  // TDD
  COPY ~bp/cre/nightwlk.cre~ ~override~
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    SAY NAME1 @264 //Night Walker
    SAY NAME2 @264 //Night Walker
      WRITE_ASCII 0x268 ~bpundead~ #8 // Default (was )
  END
BUT_ONLY
END

COPY_EXISTING ~nevm1.cre~ ~override~ //Wight
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x268 ~bpundead~ #8 // Default (was BPWDASGT)
  END
BUT_ONLY

COPY_EXISTING ~skelar01.cre~ ~override~ //Skeleton Archer
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_BYTE 0x61 231 // RstCrush (was 0)
      WRITE_ASCII 0x268 ~bpundead~ #8 // Default (was )
  END
BUT_ONLY

COPY_EXISTING ~skelar02.cre~ ~override~ //Skeleton Archer
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
      WRITE_ASCII 0x268 ~bpundead~ #8 // Default (was )
  END
BUT_ONLY

COPY_EXISTING ~skele2.cre~ ~override~ //Skeleton
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    SAY NAME1 #8765 // LongName (~Skeleton~)
    SAY NAME2 #8765 // ShortName (~Skeleton~)
    WRITE_ASCII 0x268 ~bpally~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~skelwa02.cre~ ~override~ //Skeleton Warrior
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
      WRITE_ASCII 0x268 ~bpundead~ #8 // Default (was )
    WRITE_BYTE 0x272 115 // IDSRace (was 1)
  END
BUT_ONLY

COPY_EXISTING ~skelwa03.cre~ ~override~ //Skeleton Warrior
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x268 ~bpwtrsgt~ #8 // Default (was WTARSGT)
    WRITE_BYTE 0x272 115 // IDSRace (was 1)
  END
BUT_ONLY

ACTION_IF NOT FILE_EXISTS_IN_GAME ~skellbadx.cre~ BEGIN
  COPY ~bp/cre/skelbadx.cre~ ~override~
    PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
      SAY NAME1 @323 //Hoarax
      SAY NAME2 @323 //Hoarax
      WRITE_ASCII 0x268 ~bpundead~ #8 // Default (was )
    END
BUT_ONLY
  END

ACTION_IF NOT FILE_EXISTS_IN_GAME ~skull.cre~ BEGIN
  COPY ~bp/cre/skull.cre~ ~override~
    SAY NAME1 @325 //Blood Boil
    SAY NAME2 @325 //Blood Boil
    PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
      WRITE_ASCII 0x268 ~bpundead~ #8 // Default (was )
    END
BUT_ONLY
  END

ACTION_IF NOT FILE_EXISTS_IN_GAME ~undeadlt.cre~ BEGIN
  COPY ~bp/cre/undeadlt.cre~ ~override~
    PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
      WRITE_ASCII 0x268 ~bpundead~ #8 // Default (was )
    END
BUT_ONLY
  END

COPY_EXISTING ~wolfzo01.cre~ ~override~ //Zombie Wolf
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 38 // CurrHP (was 18)
    WRITE_SHORT 0x26 38 // MaxHP (was 18)
    WRITE_BYTE 0x52 17 // THAC0 (was 19)
    WRITE_BYTE 0x61 50 // RstCrush (was 0)
    WRITE_BYTE 0x62 50 // RstPierc (was 0)
    WRITE_BYTE 0x63 50 // RstMissl (was 0)
    WRITE_BYTE 0x234 3 // HighestLevelPrimary (was 1)
      WRITE_ASCII 0x268 ~bpundead~ #8 // Default (was )
  END
BUT_ONLY

ACTION_IF NOT FILE_EXISTS_IN_GAME ~xghast1.cre~ BEGIN
  COPY ~bp/cre/xghast1.cre~ ~override~
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
      WRITE_ASCII 0x268 ~bpundead~ #8 // Default (was )
  END
BUT_ONLY
END

ACTION_IF NOT FILE_EXISTS_IN_GAME ~xghast2.cre~ BEGIN
  COPY ~bp/cre/xghast2.cre~ ~override~
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
      WRITE_ASCII 0x268 ~bpundead~ #8 // Default (was )
  END
BUT_ONLY
END

COPY_EXISTING ~zombie01.cre~ ~override~ //Zombie
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 24 // CurrHP (was 15)
    WRITE_SHORT 0x26 24 // MaxHP (was 15)
      WRITE_ASCII 0x268 ~bpundead~ #8 // Default (was )
  END
BUT_ONLY

COPY_EXISTING ~zombju01.cre~ ~override~ //Zombie
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 48 // CurrHP (was 40)
    WRITE_SHORT 0x26 48 // MaxHP (was 40)
    WRITE_BYTE 0x63 30 // RstMissl (was 25)
      WRITE_ASCII 0x268 ~bpundead~ #8 // Default (was )
  END
BUT_ONLY

COPY_EXISTING ~zomblo01.cre~ ~override~ //Zombie Lord
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_LONG 0x10 0 // CreatureFlags (was 83886081)
    WRITE_SHORT 0x24 88 // CurrHP (was 48)
    WRITE_SHORT 0x26 88 // MaxHP (was 48)
    WRITE_SHORT 0x46 2 // ACNatul (was 6)
    WRITE_SHORT 0x48 2 // ACEffec (was 6)
    WRITE_SHORT 0x4a 4 // ACCrush (was 0)
    WRITE_SHORT 0x4e 4 // ACPierc (was 0)
    WRITE_BYTE 0x52 13 // THAC0 (was 15)
    WRITE_BYTE 0x53 8 // NOAtt (was 2)
    WRITE_BYTE 0x60 15 // RstSlash (was 0)
    WRITE_BYTE 0x61 50 // RstCrush (was 0)
    WRITE_BYTE 0x234 9 // HighestLevelPrimary (was 5)
    WRITE_BYTE 0x239 100 // StrBon (was 1)
    WRITE_ASCII 0x248 ~shoutdlg~ #8 // Override (was SHOUT)
    WRITE_ASCII 0x250 ~bpleader~ #8 // Class (was SHOUTDLG)
    WRITE_ASCII 0x258 ~shout~ #8 // Race (was NONE)
      WRITE_ASCII 0x268 ~bpundead~ #8 // Default (was )
    WRITE_BYTE 0x27b 51 // Alignment (was 50)
  END
BUT_ONLY

COPY_EXISTING ~zombse01.cre~ ~override~ //Sea Zombie
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 59 // CurrHP (was 40)
    WRITE_SHORT 0x26 59 // MaxHP (was 40)
    WRITE_BYTE 0x5a 206 // RstCold (was 156)
    WRITE_BYTE 0x5b 206 // RstElec (was 156)
    WRITE_BYTE 0x5f 206 // RstMCld (was 156)
    WRITE_BYTE 0x60 10 // RstSlash (was 0)
    WRITE_BYTE 0x61 50 // RstCrush (was 0)
    WRITE_BYTE 0x62 50 // RstPierc (was 0)
    WRITE_BYTE 0x63 30 // RstMissl (was 0)
    WRITE_BYTE 0x234 6 // HighestLevelPrimary (was 2)
      WRITE_ASCII 0x268 ~bpundead~ #8 // Default (was )
  END
BUT_ONLY

COPY_EXISTING ~rzomb01.cre~ ~override~ //Zombie
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 43 // CurrHP (was 40)
    WRITE_SHORT 0x26 43 // MaxHP (was 40)
      WRITE_ASCII 0x268 ~bpundead~ #8 // Default (was )
  END
BUT_ONLY

COPY_EXISTING ~rskel01.cre~ ~override~ //Skeleton
              ~skelet01.cre~ ~override~ //Skeleton
              ~skelhp1.cre~ ~override~ //Skeleton
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 18 // CurrHP (was 8)
    WRITE_SHORT 0x26 18 // MaxHP (was 8)
      WRITE_ASCII 0x268 ~bpundead~ #8 // Default (was )
  END
BUT_ONLY

COPY_EXISTING ~hllich.cre~ ~override~ //Elemental Lich
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_LONG 0x18 11500 // PowerLevel (was 22000)
      WRITE_ASCII 0x268 ~bpundead~ #8 // Default (was )
  END
BUT_ONLY

COPY_EXISTING ~firlch01.cre~ ~override~ //Fire Lich
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    // SAY NAME1 #70627 // LongName (was 70626)
    WRITE_ASCII 0x258 ~bpmag20a~ #8 // Race (was NONE)
      WRITE_ASCII 0x268 ~bpundead~ #8 // Default (was )
  END
BUT_ONLY

COPY_EXISTING ~grvlch01.cre~ ~override~ //Lich
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x268 ~wsasight~ #8 // Default (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~gtcit1.cre~ ~override~ //Ghoul
              ~gtcit2.cre~ ~override~ //Ghoul
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 24 // CurrHP (was 15)
    WRITE_SHORT 0x26 24 // MaxHP (was 15)
      WRITE_ASCII 0x268 ~bpundead~ #8 // Default (was )
  END
BUT_ONLY

COPY_EXISTING ~gtcit3.cre~ ~override~ //Zombie
              ~gtcit4.cre~ ~override~ //Zombie
              ~gtcit5.cre~ ~override~ //Zombie
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 22 // CurrHP (was 15)
    WRITE_SHORT 0x26 22 // MaxHP (was 15)
      WRITE_ASCII 0x268 ~bpundead~ #8 // Default (was )
  END
BUT_ONLY

COPY_EXISTING ~sahspc01.cre~ ~override~ //Spectre
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_BYTE 0x234 9 // HighestLevelPrimary (was 5)
    WRITE_ASCII 0x258 ~bpmag14m~ #8 // Race (was NONE)
    WRITE_ASCII 0x260 ~~ #8 // General (was DAO01)
      WRITE_ASCII 0x268 ~bpundead~ #8 // Default (was )
    REMOVE_MEMORIZED_SPELL ~spwi112~
    REMOVE_MEMORIZED_SPELL ~spwi213~
    REMOVE_MEMORIZED_SPELL ~spwi211~
    REMOVE_MEMORIZED_SPELL ~spwi217~
    REMOVE_MEMORIZED_SPELL ~spwi308~
    ADD_MEMORIZED_SPELL ~spwi106~ #0 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi105~ #0 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi125~ #0 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi205~ #1 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi212~ #1 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi201~ #1 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi305~ #2 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi306~ #2 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi314~ #2 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi405~ #3 ~wizard~ (2)
    ADD_MEMORIZED_SPELL ~spwi409~ #3 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi412~ #3 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi508~ #4 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi505~ #4 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi501~ #4 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi512~ #4 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi513~ #4 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi601~ #5 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi607~ #5 ~wizard~
    ADD_MEMORIZED_SPELL ~spwi618~ #5 ~wizard~
    ADD_MEMORIZED_SPELL ~sumshad~ #0 ~innate~ (3)
    REMOVE_CRE_ITEM ~GHOST01~
    REPLACE_CRE_ITEM ~GHOST~ #0 #0 #0 ~NONE~ ~LRING~
  END
BUT_ONLY

ACTION_IF GAME_IS ~tob bgt~ BEGIN
  COPY_EXISTING ~sahzom01.cre~ ~override~ //Sea Zombie Lord
    LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
    PATCH_IF vl BEGIN
      WRITE_SHORT 0x24 98 // CurrHP (was 65)
      WRITE_SHORT 0x26 98 // MaxHP (was 65)
      WRITE_BYTE 0x5a 206 // RstCold (was 156)
      WRITE_BYTE 0x5b 206 // RstElec (was 156)
      WRITE_BYTE 0x5f 206 // RstMCld (was 156)
      WRITE_BYTE 0x60 10 // RstSlash (was 0)
      WRITE_BYTE 0x61 30 // RstCrush (was 10)
      WRITE_BYTE 0x62 50 // RstPierc (was 10)
      WRITE_BYTE 0x63 50 // RstMissl (was 10)
      WRITE_BYTE 0x241 255 // Racial (was 0)
      WRITE_ASCII 0x260 ~bpleader~ #8 // General (was NONE)
      WRITE_ASCII 0x268 ~bpundead~ #8 // Default (was )
      WRITE_BYTE 0x272 108 // IDSRace (was 148)
      WRITE_BYTE 0x273 118 // IDSClass (was 198)
      READ_LONG  0x2c4 effects_offset
      READ_LONG  0x2c8 effects_num
      FOR (cnt=0; cnt<effects_num; cnt=cnt+1) BEGIN
        READ_LONG (effects_offset+cnt*0x108+8) type
        PATCH_IF type = 98 BEGIN
          WRITE_LONG (effects_offset+cnt*0x108+12) 0
          WRITE_LONG (effects_offset+cnt*0x108+20) 2
          WRITE_LONG (effects_offset+cnt*0x108+24) 2
          WRITE_LONG (effects_offset+cnt*0x108+28) 9
        END
        PATCH_IF type = 120 BEGIN
          WRITE_LONG (effects_offset+cnt*0x108+12) 0
          WRITE_LONG (effects_offset+cnt*0x108+28) 9
        END
        PATCH_IF type = 16 BEGIN
          WRITE_LONG (effects_offset+cnt*0x108+12) 0
          WRITE_LONG (effects_offset+cnt*0x108+28) 9
        END
      END
      SET_BG2_PROFICIENCY ~PROFICIENCY2WEAPON~ 3
    END
  BUT_ONLY
END

END

/////////////////////////////////////////////////////////////////

DEFINE_ACTION_FUNCTION wereanimals BEGIN


COPY_EXISTING ~wolfgr01.cre~ ~override~ //Greater Wolfwere
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 96 // CurrHP (was 66)
    WRITE_SHORT 0x26 96 // MaxHP (was 66)
    WRITE_ASCII 0x250 ~bpwdasgt~ #8 // Class (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~aesold.cre~ ~override~ //Soldier
              ~aewere1.cre~ ~override~ //Fighter
              ~aewere2.cre~ ~override~ //Fighter
              ~aewere3.cre~ ~override~ //Fighter
              ~aewere4.cre~ ~override~ //Fighter
              ~aewere5.cre~ ~override~ //Fighter
              ~aewere6.cre~ ~override~ //Fighter
  LAUNCH_PATCH_FUNCTION FJ_CRE_VALIDITY RET vl = valid END
  PATCH_IF vl BEGIN
    WRITE_ASCII 0x268 ~bpwdasgt~ #8
  END
BUT_ONLY


COPY_EXISTING ~gorwowe.cre~ ~override~ //Wolfwere
              ~weregr01.cre~ ~override~ //Greater Werewolf
              ~werewo01.cre~ ~override~ //Werewolf
              ~werewodr.cre~ ~override~ //Werewolf
              ~werewyv1.cre~ ~override~ //Ekim Cyre
              ~werewyv2.cre~ ~override~ //Ekim Cyre
              ~wolfwe01.cre~ ~override~ //Wolfwere
              ~wolfwe02.cre~ ~override~ //Wolfwere
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_ASCII 0x250 ~bpwdasgt~ #8 // Class (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~c6were1.cre~ ~override~ //Wolfwere
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 62 // CurrHP (was 41)
    WRITE_SHORT 0x26 62 // MaxHP (was 41)
    WRITE_BYTE 0x234 8 // HighestLevelPrimary (was 7)
    WRITE_ASCII 0x248 ~gensht01~ #8 // Override (was NONE)
    WRITE_ASCII 0x250 ~bpwdasgt~ #8 // Class (was WTASIGHT)
  END
BUT_ONLY

COPY_EXISTING ~c6were2.cre~ ~override~ //Wolfwere
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    WRITE_SHORT 0x24 67 // CurrHP (was 41)
    WRITE_SHORT 0x26 67 // MaxHP (was 41)
    WRITE_BYTE 0x234 8 // HighestLevelPrimary (was 7)
    WRITE_ASCII 0x250 ~bpwdasgt~ #8 // Class (was WTASIGHT)
  END
BUT_ONLY


END




