Jump to content

Potion of Magic Blocking


Andyr

Recommended Posts

// potion of magic blocking should only block up to level 5 spells, per description
COPY_EXISTING ~potn33.itm~ ~override~
 READ_LONG   0x64 "abil_off"
 READ_SHORT  0x68 "abil_num"
 READ_LONG   0x6a "fx_off"
 FOR (index = 0; index < abil_num; index = index + 1) BEGIN // looks for magical ability header
   READ_BYTE  ("%abil_off%" +        ("%index%" * 0x38)) "type"
   PATCH_IF ("%type%" = 3) BEGIN //magical ability
     READ_SHORT ("%abil_off%" + 0x1e + ("%index%" * 0x38)) "abil_fx_num"
     READ_SHORT ("%abil_off%" + 0x20 + ("%index%" * 0x38)) "abil_fx_idx"
     FOR (index2 = 0; index2 < abil_fx_num; index2 = index2 + 1) BEGIN // searches through fx for immunity to spell level
       READ_SHORT ("%fx_off%" +        (("%abil_fx_idx%" + "%index2%") * 0x30)) "opcode"
       READ_LONG  ("%fx_off%" + 0x04 + (("%abil_fx_idx%" + "%index2%") * 0x30)) "level"
       PATCH_IF (("%opcode%" = 102) AND ("%level%" > 5)) BEGIN // immunity to spell level > 5
         WRITE_BYTE ("%fx_off%" + 0x12 + (("%abil_fx_idx%" + "%index2%") * 0x30)) 0 // probability
       END
     END
   END
 END
 BUT_ONLY_IF_IT_CHANGES

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...