Jump to content

Wand of Cursing (wand19.itm)


CamDawg

Recommended Posts

// wand of cursing should cause deafness but is not
COPY_EXISTING ~wand19.itm~ ~override~
 READ_LONG  0x64 "abil_off" ELSE 0
 READ_SHORT 0x68 "abil_num" ELSE 0
 READ_LONG  0x6a "fx_off"   ELSE 0
 SET "abil_length" = 0x38
 SET "fx_delta" = 0
 FOR (index = 0 ; index < abil_num ; index = index + 1) BEGIN // start iterating through abilities
   READ_SHORT  ("%abil_off%" + 0x1e + ("%abil_length%" * "%index%")) "abil_fx_num"
   READ_SHORT  ("%abil_off%" + 0x20 + ("%abil_length%" * "%index%")) "abil_fx_idx"
   SET "abil_fx_idx" = ("%abil_fx_idx%" + "%fx_delta%")
   WRITE_SHORT ("%abil_off%" + 0x20 + ("%abil_length%" * "%index%")) ("%abil_fx_idx%")
   FOR (index2 = 0 ; index2 < abil_fx_num ; index2 = index2 + 1) BEGIN
     READ_SHORT ("%fx_off%" +        (0x30 * ("%abil_fx_idx%" + "%index2%"))) "opcode"
     READ_LONG  ("%fx_off%" + 0x04 + (0x30 * ("%abil_fx_idx%" + "%index2%"))) "string"
     PATCH_IF ("%opcode%" = 38) BEGIN // blindness
       READ_ASCII ("%fx_off%" +        (0x30 * ("%abil_fx_idx%" + "%index2%"))) "clone" (48) // clone fx
       // insert protection from mage version of MM
       INSERT_BYTES            ("%fx_off%" +        (0x30 * "%abil_fx_idx%")) 0x30         // insert new effect
         WRITE_EVALUATED_ASCII ("%fx_off%" +        (0x30 * "%abil_fx_idx%")) "%clone%"    // clones portrait icon
         WRITE_SHORT           ("%fx_off%" +        (0x30 * "%abil_fx_idx%")) 80           // opcode: deafness
       SET "fx_delta" = "%fx_delta%" + 1
       SET "abil_fx_num" = "%abil_fx_num%" + 1
       SET "index2" = "%index2%" + 1
     END
     PATCH_IF (("%opcode%" = 139) AND ("%string%" = 14002)) BEGIN // display 'silence' string
       READ_ASCII ("%fx_off%" +        (0x30 * ("%abil_fx_idx%" + "%index2%"))) "clone" (48) // clone fx
       // insert protection from mage version of MM
       INSERT_BYTES            ("%fx_off%" +        (0x30 * "%abil_fx_idx%")) 0x30         // insert new effect
         WRITE_EVALUATED_ASCII ("%fx_off%" +        (0x30 * "%abil_fx_idx%")) "%clone%"    // clones display string
         WRITE_LONG            ("%fx_off%" + 0x04 + (0x30 * "%abil_fx_idx%")) 54318        // string 'deaf'
       SET "fx_delta" = "%fx_delta%" + 1
       SET "abil_fx_num" = "%abil_fx_num%" + 1
       SET "index2" = "%index2%" + 1
     END
     WRITE_SHORT  ("%abil_off%" + 0x1e + ("%abil_length%" * "%index%")) "%abil_fx_num%"
   END
 END
 BUT_ONLY_IF_IT_CHANGES

Link to comment

Archived

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

×
×
  • Create New...