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override/msh2.2da~ //Goblin Captain
       ~aurora/bamsoa/µava1.bam~ ~override/msh2a1.bam~
       ~aurora/bamsoa/µava1e.bam~ ~override/msh2a1e.bam~
       ~aurora/bamsoa/µava2.bam~ ~override/msh2a2.bam~
       ~aurora/bamsoa/µava2e.bam~ ~override/msh2a2e.bam~
       ~aurora/bamsoa/µavde.bam~ ~override/msh2de.bam~
       ~aurora/bamsoa/µavdee.bam~ ~override/msh2dee.bam~
       ~aurora/bamsoa/µavgh.bam~ ~override/msh2gh.bam~
       ~aurora/bamsoa/µavghe.bam~ ~override/msh2ghe.bam~
       ~aurora/bamsoa/µavgu.bam~ ~override/msh2gu.bam~
       ~aurora/bamsoa/µavgue.bam~ ~override/msh2gue.bam~
       ~aurora/bamsoa/µavsc.bam~ ~override/msh2sc.bam~
       ~aurora/bamsoa/µavsce.bam~ ~override/msh2sce.bam~
       ~aurora/bamsoa/µavsd.bam~ ~override/msh2sd.bam~
       ~aurora/bamsoa/µavsde.bam~ ~override/msh2sde.bam~
       ~aurora/bamsoa/µavsl.bam~ ~override/msh2sl.bam~
       ~aurora/bamsoa/µavsle.bam~ ~override/msh2sle.bam~
       ~aurora/bamsoa/µavtw.bam~ ~override/msh2tw.bam~
       ~aurora/bamsoa/µavtwe.bam~ ~override/msh2twe.bam~
       ~aurora/bamsoa/µavwk.bam~ ~override/msh2wk.bam~
       ~aurora/bamsoa/µavwke.bam~ ~override/msh2wke.bam~

       ~aurora/bamsoa/µba.2da~ ~override/msh1.2da~ //Goblin Shaman
       ~aurora/bamsoa/µbaa1.bam~ ~override/msh1a1.bam~
       ~aurora/bamsoa/µbaa1e.bam~ ~override/msh1a1e.bam~
       ~aurora/bamsoa/µbaa2.bam~ ~override/msh1a2.bam~
       ~aurora/bamsoa/µbaa2e.bam~ ~override/msh1a2e.bam~
       ~aurora/bamsoa/µbaca.bam~ ~override/msh1ca.bam~
       ~aurora/bamsoa/µbacae.bam~ ~override/msh1cae.bam~
       ~aurora/bamsoa/µbade.bam~ ~override/msh1de.bam~
       ~aurora/bamsoa/µbadee.bam~ ~override/msh1dee.bam~
       ~aurora/bamsoa/µbagh.bam~ ~override/msh1gh.bam~
       ~aurora/bamsoa/µbaghe.bam~ ~override/msh1ghe.bam~
       ~aurora/bamsoa/µbagu.bam~ ~override/msh1gu.bam~
       ~aurora/bamsoa/µbague.bam~ ~override/msh1gue.bam~
       ~aurora/bamsoa/µbasc.bam~ ~override/msh1sc.bam~
       ~aurora/bamsoa/µbasce.bam~ ~override/msh1sce.bam~
       ~aurora/bamsoa/µbasd.bam~ ~override/msh1sd.bam~
       ~aurora/bamsoa/µbasde.bam~ ~override/msh1sde.bam~
       ~aurora/bamsoa/µbasl.bam~ ~override/msh1sl.bam~
       ~aurora/bamsoa/µbasle.bam~ ~override/msh1sle.bam~
       ~aurora/bamsoa/µbasp.bam~ ~override/msh1sp.bam~
       ~aurora/bamsoa/µbaspe.bam~ ~override/msh1spe.bam~
       ~aurora/bamsoa/µbatw.bam~ ~override/msh1tw.bam~
       ~aurora/bamsoa/µbatwe.bam~ ~override/msh1twe.bam~
       ~aurora/bamsoa/µbawk.bam~ ~override/msh1wk.bam~
       ~aurora/bamsoa/µbawke.bam~ ~override/msh1wke.bam~

       ~aurora/bamsoa/µbma1.bam~ ~override/mgh2a1.bam~ //Svirfneblin Pale Axe
       ~aurora/bamsoa/µbma1e.bam~ ~override/mgh2a1e.bam~
       ~aurora/bamsoa/µbma2.bam~ ~override/mgh2a2.bam~
       ~aurora/bamsoa/µbma2e.bam~ ~override/mgh2a2e.bam~
       ~aurora/bamsoa/µbma4.bam~ ~override/mgh2a4.bam~
       ~aurora/bamsoa/µbma4e.bam~ ~override/mgh2a4e.bam~
       ~aurora/bamsoa/µbmca.bam~ ~override/mgh2ca.bam~
       ~aurora/bamsoa/µbmcae.bam~ ~override/mgh2cae.bam~
       ~aurora/bamsoa/µbmde.bam~ ~override/mgh2de.bam~
       ~aurora/bamsoa/µbmdee.bam~ ~override/mgh2dee.bam~
       ~aurora/bamsoa/µbmgh.bam~ ~override/mgh2gh.bam~
       ~aurora/bamsoa/µbmghe.bam~ ~override/mgh2ghe.bam~
       ~aurora/bamsoa/µbmgu.bam~ ~override/mgh2gu.bam~
       ~aurora/bamsoa/µbmgue.bam~ ~override/mgh2gue.bam~
       ~aurora/bamsoa/µbmsc.bam~ ~override/mgh2sc.bam~
       ~aurora/bamsoa/µbmsce.bam~ ~override/mgh2sce.bam~
       ~aurora/bamsoa/µbmsd.bam~ ~override/mgh2sd.bam~
       ~aurora/bamsoa/µbmsde.bam~ ~override/mgh2sde.bam~
       ~aurora/bamsoa/µbmsl.bam~ ~override/mgh2sl.bam~
       ~aurora/bamsoa/µbmsle.bam~ ~override/mgh2sle.bam~
       ~aurora/bamsoa/µbmsp.bam~ ~override/mgh2sp.bam~
       ~aurora/bamsoa/µbmspe.bam~ ~override/mgh2spe.bam~
       ~aurora/bamsoa/µbmtw.bam~ ~override/mgh2tw.bam~
       ~aurora/bamsoa/µbmtwe.bam~ ~override/mgh2twe.bam~
       ~aurora/bamsoa/µbmwk.bam~ ~override/mgh2wk.bam~
       ~aurora/bamsoa/µbmwke.bam~ ~override/mgh2wke.bam~

       ~aurora/bamsoa/µbna1.bam~ ~override/mgh3a1.bam~ //Svirfneblin Pale No Axe
       ~aurora/bamsoa/µbna1e.bam~ ~override/mgh3a1e.bam~
       ~aurora/bamsoa/µbna2.bam~ ~override/mgh3a2.bam~
       ~aurora/bamsoa/µbna2e.bam~ ~override/mgh3a2e.bam~
       ~aurora/bamsoa/µbna4.bam~ ~override/mgh3a4.bam~
       ~aurora/bamsoa/µbna4e.bam~ ~override/mgh3a4e.bam~
       ~aurora/bamsoa/µbnca.bam~ ~override/mgh3ca.bam~
       ~aurora/bamsoa/µbncae.bam~ ~override/mgh3cae.bam~
       ~aurora/bamsoa/µbnde.bam~ ~override/mgh3de.bam~
       ~aurora/bamsoa/µbndee.bam~ ~override/mgh3dee.bam~
       ~aurora/bamsoa/µbngh.bam~ ~override/mgh3gh.bam~
       ~aurora/bamsoa/µbnghe.bam~ ~override/mgh3ghe.bam~
       ~aurora/bamsoa/µbngu.bam~ ~override/mgh3gu.bam~
       ~aurora/bamsoa/µbngue.bam~ ~override/mgh3gue.bam~
       ~aurora/bamsoa/µbnsc.bam~ ~override/mgh3sc.bam~
       ~aurora/bamsoa/µbnsce.bam~ ~override/mgh3sce.bam~
       ~aurora/bamsoa/µbnsd.bam~ ~override/mgh3sd.bam~
       ~aurora/bamsoa/µbnsde.bam~ ~override/mgh3sde.bam~
       ~aurora/bamsoa/µbnsl.bam~ ~override/mgh3sl.bam~
       ~aurora/bamsoa/µbnsle.bam~ ~override/mgh3sle.bam~
       ~aurora/bamsoa/µbnsp.bam~ ~override/mgh3sp.bam~
       ~aurora/bamsoa/µbnspe.bam~ ~override/mgh3spe.bam~
       ~aurora/bamsoa/µbntw.bam~ ~override/mgh3tw.bam~
       ~aurora/bamsoa/µbntwe.bam~ ~override/mgh3twe.bam~
       ~aurora/bamsoa/µbnwk.bam~ ~override/mgh3wk.bam~
       ~aurora/bamsoa/µbnwke.bam~ ~override/mgh3wke.bam~

       ~aurora/bamsoa/µboa1.bam~ ~override/mwiga1.bam~ //Svirfneblin Dark Axe
       ~aurora/bamsoa/µboa1e.bam~ ~override/mwiga1e.bam~
       ~aurora/bamsoa/µboa2.bam~ ~override/mwiga2.bam~
       ~aurora/bamsoa/µboa2e.bam~ ~override/mwiga2e.bam~
       ~aurora/bamsoa/µboa4.bam~ ~override/mwiga4.bam~
       ~aurora/bamsoa/µboa4e.bam~ ~override/mwiga4e.bam~
       ~aurora/bamsoa/µboca.bam~ ~override/mwigca.bam~
       ~aurora/bamsoa/µbocae.bam~ ~override/mwigcae.bam~
       ~aurora/bamsoa/µbode.bam~ ~override/mwigde.bam~
       ~aurora/bamsoa/µbodee.bam~ ~override/mwigdee.bam~
       ~aurora/bamsoa/µbogh.bam~ ~override/mwiggh.bam~
       ~aurora/bamsoa/µboghe.bam~ ~override/mwigghe.bam~
       ~aurora/bamsoa/µbogu.bam~ ~override/mwiggu.bam~
       ~aurora/bamsoa/µbogue.bam~ ~override/mwiggue.bam~
       ~aurora/bamsoa/µbosc.bam~ ~override/mwigsc.bam~
       ~aurora/bamsoa/µbosce.bam~ ~override/mwigsce.bam~
       ~aurora/bamsoa/µbosd.bam~ ~override/mwigsd.bam~
       ~aurora/bamsoa/µbosde.bam~ ~override/mwigsde.bam~
       ~aurora/bamsoa/µbosl.bam~ ~override/mwigsl.bam~
       ~aurora/bamsoa/µbosle.bam~ ~override/mwigsle.bam~
       ~aurora/bamsoa/µbosp.bam~ ~override/mwigsp.bam~
       ~aurora/bamsoa/µbospe.bam~ ~override/mwigspe.bam~
       ~aurora/bamsoa/µbotw.bam~ ~override/mwigtw.bam~
       ~aurora/bamsoa/µbotwe.bam~ ~override/mwigtwe.bam~
       ~aurora/bamsoa/µbowk.bam~ ~override/mwigwk.bam~
       ~aurora/bamsoa/µbowke.bam~ ~override/mwigwke.bam~

       ~aurora/bamsoa/µbpa1.bam~ ~override/mwi2a1.bam~ //Svirfneblin Dark No Axe
       ~aurora/bamsoa/µbpa1e.bam~ ~override/mwi2a1e.bam~
       ~aurora/bamsoa/µbpa2.bam~ ~override/mwi2a2.bam~
       ~aurora/bamsoa/µbpa2e.bam~ ~override/mwi2a2e.bam~
       ~aurora/bamsoa/µbpa4.bam~ ~override/mwi2a4.bam~
       ~aurora/bamsoa/µbpa4e.bam~ ~override/mwi2a4e.bam~
       ~aurora/bamsoa/µbpca.bam~ ~override/mwi2ca.bam~
       ~aurora/bamsoa/µbpcae.bam~ ~override/mwi2cae.bam~
       ~aurora/bamsoa/µbpde.bam~ ~override/mwi2de.bam~
       ~aurora/bamsoa/µbpdee.bam~ ~override/mwi2dee.bam~
       ~aurora/bamsoa/µbpgh.bam~ ~override/mwi2gh.bam~
       ~aurora/bamsoa/µbpghe.bam~ ~override/mwi2ghe.bam~
       ~aurora/bamsoa/µbpgu.bam~ ~override/mwi2gu.bam~
       ~aurora/bamsoa/µbpgue.bam~ ~override/mwi2gue.bam~
       ~aurora/bamsoa/µbpsc.bam~ ~override/mwi2sc.bam~
       ~aurora/bamsoa/µbpsce.bam~ ~override/mwi2sce.bam~
       ~aurora/bamsoa/µbpsd.bam~ ~override/mwi2sd.bam~
       ~aurora/bamsoa/µbpsde.bam~ ~override/mwi2sde.bam~
       ~aurora/bamsoa/µbpsl.bam~ ~override/mwi2sl.bam~
       ~aurora/bamsoa/µbpsle.bam~ ~override/mwi2sle.bam~
       ~aurora/bamsoa/µbpsp.bam~ ~override/mwi2sp.bam~
       ~aurora/bamsoa/µbpspe.bam~ ~override/mwi2spe.bam~
       ~aurora/bamsoa/µbptw.bam~ ~override/mwi2tw.bam~
       ~aurora/bamsoa/µbptwe.bam~ ~override/mwi2twe.bam~
       ~aurora/bamsoa/µbpwk.bam~ ~override/mwi2wk.bam~
       ~aurora/bamsoa/µbpwke.bam~ ~override/mwi2wke.bam~
END ELSE BEGIN //ToB
  COPY ~aurora/bamsoa~ ~override~
  COPY ~aurora/bamtob~ ~override~
END

COPY_EXISTING ~mgo3a1.bam~ ~override~
  z3 = SOURCE_SIZE
BUT_ONLY

COPY_EXISTING ~mgo4a1.bam~ ~override~
  z4 = SOURCE_SIZE
BUT_ONLY

ACTION_IF (z3 != 70696) OR (z4 != 45025) BEGIN
  COPY ~aurora/restore~ ~override~
END

COPY_EXISTING ~elehob01.cre~ ~override~ //Goblin Commando
  PATCH_INCLUDE ~aurora/lib/fj_cre_validity.tpp~
  PATCH_IF vl BEGIN
    PATCH_INCLUDE ~aurora/lib/fj_cre_reindex.tpp~
    REPLACE_CRE_ITEM ~sw1h04~ #0 #0 #0 ~UNSTEALABLE~ ~WEAPON2~ //Long Sword (was sw1h01 Bastard Sword)
  END
BUT_ONLY

COPY_EXISTING ~icgob01.cre~ ~override~ //Goblins
              ~icgob02.cre~ ~override~
  PATCH_INCLUDE ~aurora/lib/fj_cre_validity.tpp~
  PATCH_IF vl BEGIN
    PATCH_INCLUDE ~aurora/lib/fj_cre_reindex.tpp~
    WRITE_SHORT 0x28 0xe400 //Animation ID (goblin_axe, was 0xe410 goblin_bow)
    REMOVE_CRE_ITEM ~bow01~ ~dagg01~ ~sw1h07~
    REPLACE_CRE_ITEM ~bow05~ #0 #0 #0 ~UNSTEALABLE~ ~WEAPON1~ EQUIP TWOHANDED //Short Bow (was bow01 Composite Long Bow)
    REPLACE_CRE_ITEM ~sw1h07~ #0 #0 #0 ~UNSTEALABLE~ ~WEAPON2~ //Short Sword
  END
BUT_ONLY

COPY_EXISTING ~icgob04.cre~ ~override~ //Goblin Captain
  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
    PATCH_IF (~%tbs%~ STRING_EQUAL ~soa~ = 1) BEGIN //SoA
      WRITE_SHORT 0x28 0xea20 //Animation (goblin_captain)
    END ELSE BEGIN //ToB
      WRITE_SHORT 0x28 0x5252
    END
  END
BUT_ONLY

ACTION_IF FILE_EXISTS_IN_GAME ~fshorde2.cre~ THEN BEGIN //ToB
  COPY_EXISTING ~fshorde2.cre~ ~override~ //Goblin
    PATCH_INCLUDE ~aurora/lib/fj_cre_validity.tpp~
    PATCH_IF vl BEGIN
      PATCH_INCLUDE ~aurora/lib/fj_cre_reindex.tpp~
      WRITE_SHORT 0x28 0xe400 //Animation ID (goblin_axe, was 0xe410 goblin_bow)
      REPLACE_CRE_ITEM ~bow05~ #0 #0 #0 ~UNSTEALABLE~ ~WEAPON1~ //Short Bow (was bow01 Composite Long Bow)
    END
  BUT_ONLY
END

ACTION_IF FILE_EXISTS_IN_GAME ~bptarget.cre~ THEN BEGIN //Big Picture
  COPY_EXISTING ~bptarget.cre~ ~override~ //Target
    PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
      WRITE_SHORT 0x28 0x7f38 //Animation ID (wizard_eye, was goblin_axe)
    END
  BUT_ONLY
END

ACTION_IF FILE_EXISTS_IN_GAME ~o!gobl.cre~ THEN BEGIN //BoM Item Pack
  COPY_EXISTING ~o!gobl.cre~ ~override~ //Jerry
    PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
      REPLACE_CRE_ITEM ~sw1h04~ #0 #0 #0 ~UNSTEALABLE~ ~WEAPON2~ //Long Sword (was sw1h01 Bastard Sword)
    END
  BUT_ONLY
END

ACTION_IF FILE_EXISTS_IN_GAME ~tcsvir01.cre~ THEN BEGIN //Classic Adventures
  COPY_EXISTING ~tcsvir01.cre~ ~override~ //Svirfneblin
    PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
      WRITE_SHORT 0x28 0x5266 //Animation (svirfneblin_dark_noaxe)
      WRITE_BYTE 0x2f 38 //Skin color (light dirt brown, was 7 light metallic green)
      WRITE_BYTE 0x32 5 //Hair color (light silver, was 109 terracotta)
      WRITE_BYTE 0x45 60 //Hide in shadows
      WRITE_SHORT 0x46 ~-3~ //Base AC (was 10)
      WRITE_SHORT 0x46 ~-3~ //Effective AC (was 10)
      WRITE_BYTE 0x54 8 //Save vs. death (was 9)
      WRITE_BYTE 0x55 9 //Save vs. wands (was 11)
      WRITE_BYTE 0x56 8 //Save vs. polymorph (was 10)
      WRITE_BYTE 0x57 9 //Save vs. breath (was 11)
      WRITE_BYTE 0x58 10 //Save vs. spells (was 12)
      WRITE_BYTE 0x5d 45 //Resist magic
      WRITE_BYTE 0x5e 45 //Resist magic fire
      WRITE_BYTE 0x5f 45 //Resist magic cold
      WRITE_BYTE 0x64 100 //Detect illusion
      WRITE_BYTE 0x66 8 //Lore
      SAY INITIAL_MEETING @439 //Hello there. [T-SVN01A]
      SAY MORALE @447 //Farewell. [T-SVN03A]
      SAY UNHAPPY_BREAKING_POINT @249 //Farewell. [T-SVN03A]
      SAY BATTLE_CRY1 @443 //Get 'em! [T-SVN02A]
      SAY BATTLE_CRY2 @444 //I will cut you down to size! [T_SVN02B]
      SAY ATTACK1 ~~ [T-SVN04A]
      SAY DAMAGE ~~ [T-SVN05A]
      SAY DYING ~~ [T-SVN06A]
      SAY HURT @449 //I am hurt! [T-SVN07]
      SAY SELECT_COMMON1 @439 //Hello there. [T-SVN01A]
      SAY SELECT_COMMON2 @440 //Yes. [T-SVN01B]
      SAY SELECT_COMMON3 @441 //Come and talk a while. [T-SVN01C]
      SAY SELECT_COMMON4 @442 //Oh ho ho ho! [T-SVN01D]
      SAY DIALOGUE_HOSTILE @450 //You're heading for a good beating, you are! [T-SVN08]
      SAY CRITICAL_HIT @451 //Well look at that! [T-SVN09]
      SAY CRITICAL_MISS @452 //No... [T-SVN10]
      SAY SPELL_DISRUPTED @452 //No... [T-SVN10]
      WRITE_BYTE 0x23f 13 //Morale (was 12)
      WRITE_BYTE 0x240 6 //Morale break (was 7)
      WRITE_BYTE 0x242 30 //Morale recovery (was 60)
      WRITE_ASCII 0x250 ~agsvir01~ #8 //Class script  
      ADD_MEMORIZED_SPELL ~spwi106~ #0 ~wizard~ //Blindness
      ADD_MEMORIZED_SPELL ~spwi201~ #1 ~wizard~ //Blur
      ADD_MEMORIZED_SPELL ~spwi622~ #5 ~wizard~ //Conjure Earth Elemental
      ADD_CRE_ITEM ~agblun01~ #0 #0 #0 ~UNDROPPABLE~ ~WEAPON1~ //Svirfneblin Club
      ADD_CRE_ITEM ~t-ring05~ #0 #0 #0 ~UNSTEALABLE~ ~LRING RRING~ //Svirfneblin Ring
    END
  BUT_ONLY
END

ACTION_IF FILE_EXISTS_IN_GAME ~f_medgaz.itm~ THEN BEGIN //Drizzt Saga
  COPY_EXISTING ~f_medgaz.itm~ ~override~ //Medusa Gaze
    PATCH_IF SOURCE_SIZE > 0x71 BEGIN
      WRITE_SHORT 0x1c 0 //Item type
      WRITE_ASCII 0x3a ~spwi111b~ #8 //Inventory icon
      READ_LONG 0x64 hf //Extended header offset
      READ_SHORT 0x68 hc //Extended header count
      FOR (i = 0; i < hc; i += 1) BEGIN //Cycle through headers
        WRITE_BYTE (0x38 * i + hf) 2 //Attack type (projectile)
        WRITE_ASCII (0x38 * i + hf + 4) ~spwi111b~ #8 //Use icon 1
        WRITE_SHORT (0x38 * i + hf + 0x14) 0 //THAC0 bonus
        WRITE_SHORT (0x38 * i + hf + 0x16) 0 //Die sides
      END
    END
  BUT_ONLY
END

ACTION_IF FILE_EXISTS_IN_GAME ~dsgobchf.cre~ THEN BEGIN //DSotSC
  COPY_EXISTING ~dsgobchf.cre~ ~override~ //Goblin Chief
    PATCH_INCLUDE ~aurora/lib/fj_cre_validity.tpp~
    PATCH_IF vl BEGIN
      PATCH_INCLUDE ~aurora/lib/fj_cre_reindex.tpp~
      PATCH_IF (~%tbs%~ STRING_EQUAL ~soa~ = 1) BEGIN //SoA
        WRITE_SHORT 0x28 0xea20 //Animation (goblin_captain)
      END ELSE BEGIN //ToB
        WRITE_SHORT 0x28 0x5252
      END
    END
  BUT_ONLY
END

ACTION_IF FILE_EXISTS_IN_GAME ~lhgobc1.cre~ THEN BEGIN //Epic Endeavors
  COPY_EXISTING ~lhgobc1.cre~ ~override~ //Goblin Captain
    PATCH_INCLUDE ~aurora/lib/fj_cre_validity.tpp~
    PATCH_IF vl BEGIN
      PATCH_INCLUDE ~aurora/lib/fj_cre_reindex.tpp~
      PATCH_IF (~%tbs%~ STRING_EQUAL ~soa~ = 1) BEGIN //SoA
        WRITE_SHORT 0x28 0xea20 //Animation (goblin_captain)
      END ELSE BEGIN //ToB
        WRITE_SHORT 0x28 0x5252
      END
    END
  BUT_ONLY

  COPY_EXISTING ~lhgobm1.cre~ ~override~ //Goblin Commando
    PATCH_INCLUDE ~aurora/lib/fj_cre_validity.tpp~
    PATCH_IF vl BEGIN
      PATCH_INCLUDE ~aurora/lib/fj_cre_reindex.tpp~
      WRITE_SHORT 0x28 0xe400 //Animation ID (goblin_axe, was 0xe410 goblin_bow)
      REPLACE_CRE_ITEM ~sw1h04~ #0 #0 #0 ~UNSTEALABLE~ ~WEAPON2~ //Long Sword (was sw1h01 Bastard Sword)
    END
  BUT_ONLY
END

ACTION_IF FILE_EXISTS_IN_GAME ~tupungcs.cre~ THEN BEGIN //NEJ2
  COPY_EXISTING ~icgob05.cre~ ~override~ //Goblin
    PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN
      REPLACE_CRE_ITEM ~bow06~ #0 #0 #0 ~UNSTEALABLE~ ~WEAPON1~ EQUIP TWOHANDED //Short Bow +1 (was bow04 Long Bow +1)
    END
  BUT_ONLY

  COPY_EXISTING ~tupungcs.cre~ ~override~ //Goblin
    PATCH_INCLUDE ~aurora/lib/fj_cre_validity.tpp~
    PATCH_IF vl BEGIN
      PATCH_INCLUDE ~aurora/lib/fj_cre_reindex.tpp~
      SAY NAME1 ~Pung~ //Fix invalid reference
      REPLACE_CRE_ITEM ~ax1h01~ #0 #0 #0 ~UNDROPPABLE~ ~WEAPON1~ EQUIP //Battle Axe
      ADD_CRE_ITEM ~ringtom~ #0 #0 #0 ~UNSTEALABLE~ ~LRING~ //Ring of Fading (was in weapon1)
    END
  BUT_ONLY
END

ACTION_IF FILE_EXISTS_IN_GAME ~arenago5.cre~ THEN BEGIN //RoT
  COPY_EXISTING ~arenago5.cre~ ~override~ //Goblin
                ~arenago6.cre~ ~override~
                ~arengo13.cre~ ~override~
                ~arengo14.cre~ ~override~
                ~arengo15.cre~ ~override~
                ~iwdgob1.cre~ ~override~
    PATCH_INCLUDE ~aurora/lib/fj_cre_validity.tpp~
    PATCH_IF vl BEGIN
      PATCH_INCLUDE ~aurora/lib/fj_cre_reindex.tpp~
      REPLACE_CRE_ITEM ~bow05~ #0 #0 #0 ~UNSTEALABLE~ ~WEAPON1~ EQUIP TWOHANDED //Short Bow (was bow01 Composite Long Bow)
    END
  BUT_ONLY
END
