Jump to content

Potion of freedom


Recommended Posts

Potion of freedom has several errors. The durations of the free action and display portrait icon effects are too short, it protects against charm (should be haste) and should also protect against two of the held animations. This is a BD recode with additional bugfixes from devSin.

 

// Potion of freedom has several errors
COPY_EXISTING ~potn45.itm~ ~override~
 READ_LONG   0x64 "abil_off"
 READ_SHORT  0x68 "abil_num"
 READ_LONG   0x6a "fx_off"
 SET "loops" = 0
 SET "delta" = 0
 WHILE ("%abil_num%" > "%loop%") BEGIN // looks for magical ability header
   READ_BYTE   ("%abil_off%" +        (("%loop%" + "%delta%") * 0x38)) "type"
   READ_SHORT  ("%abil_off%" + 0x20 + (("%loop%" + "%delta%") * 0x38)) "abil_fx_idx"
   WRITE_SHORT ("%abil_off%" + 0x20 + (("%loop%" + "%delta%") * 0x38)) ("%abil_fx_idx%" + "%delta%")
   PATCH_IF ("%type%" = 3) BEGIN // magical ability check
     READ_SHORT  ("%abil_off%" + 0x1e + (("%loop%" + "%delta%") * 0x38)) "abil_fx_num"
     WRITE_SHORT ("%abil_off%" + 0x1e + (("%loop%" + "%delta%") * 0x38)) ("%abil_fx_num%" + 2)
     WHILE ("%abil_fx_num%" > 0) BEGIN // needs to adjust two effects
       SET "abil_fx_num" = ("%abil_fx_num%" - 1)
       READ_SHORT ("%fx_off%" + (("%abil_fx_idx%" + "%abil_fx_num%" + "%delta%") * 0x30)) "fx_type"
       READ_LONG  ("%fx_off%" + 0x08 + (("%abil_fx_idx%" + "%abil_fx_num%" + "%delta%") * 0x30)) "immunity"
       PATCH_IF (("%fx_type%" = 101) AND ("%immunity%" = 5)) BEGIN // change charm immunity to haste immunity
         WRITE_LONG ("%fx_off%" + 0x08 + (("%abil_fx_idx%" + "%abil_fx_num%" + "%delta%") * 0x30)) 16
       END
       PATCH_IF (("%fx_type%" = 142) OR ("%fx_type%" = 163)) BEGIN // display portrait icon or free action
         WRITE_LONG ("%fx_off%" + 0x0e + (("%abil_fx_idx%" + "%abil_fx_num%" + "%delta%") * 0x30)) 600 // duration
       END
     END
   INSERT_BYTES  ("%fx_off%" +        (("%abil_fx_idx%" + "%delta%") * 0x30)) 0x30
     WRITE_SHORT ("%fx_off%" +        (("%abil_fx_idx%" + "%delta%") * 0x30)) 296 // animation imunity
     WRITE_BYTE  ("%fx_off%" + 0x02 + (("%abil_fx_idx%" + "%delta%") * 0x30)) 1   // target:self
     WRITE_BYTE  ("%fx_off%" + 0x03 + (("%abil_fx_idx%" + "%delta%") * 0x30)) 4   // power
     WRITE_BYTE  ("%fx_off%" + 0x0d + (("%abil_fx_idx%" + "%delta%") * 0x30)) 1   // power
     WRITE_LONG  ("%fx_off%" + 0x0e + (("%abil_fx_idx%" + "%delta%") * 0x30)) 600 // duration
     WRITE_BYTE  ("%fx_off%" + 0x12 + (("%abil_fx_idx%" + "%delta%") * 0x30)) 100 // probability
     WRITE_ASCII ("%fx_off%" + 0x14 + (("%abil_fx_idx%" + "%delta%") * 0x30)) ~spflayer~
   INSERT_BYTES  ("%fx_off%" +        (("%abil_fx_idx%" + "%delta%") * 0x30)) 0x30
     WRITE_SHORT ("%fx_off%" +        (("%abil_fx_idx%" + "%delta%") * 0x30)) 296 // animation imunity
     WRITE_BYTE  ("%fx_off%" + 0x02 + (("%abil_fx_idx%" + "%delta%") * 0x30)) 1   // target:self
     WRITE_BYTE  ("%fx_off%" + 0x03 + (("%abil_fx_idx%" + "%delta%") * 0x30)) 4   // power
     WRITE_BYTE  ("%fx_off%" + 0x0d + (("%abil_fx_idx%" + "%delta%") * 0x30)) 1   // power
     WRITE_LONG  ("%fx_off%" + 0x0e + (("%abil_fx_idx%" + "%delta%") * 0x30)) 600 // duration
     WRITE_BYTE  ("%fx_off%" + 0x12 + (("%abil_fx_idx%" + "%delta%") * 0x30)) 100 // probability
     WRITE_ASCII ("%fx_off%" + 0x14 + (("%abil_fx_idx%" + "%delta%") * 0x30)) ~spmindat~
   SET "delta" = ("%delta%" + 2)
   END
   SET "loops" = ("%loops%" + 1)
 END
 BUT_ONLY_IF_IT_CHANGES

Link to comment

IIRC, Free Action is more of a state toggle that removes various effects that affect movement (like "unstun" or similar effects). It's set to Instant/Permanent in everything BioWare made (duration of 0), and I have no reason to believe it's any sort of error.

Link to comment
Apologies if this has been caught elsewhere, but the Potion of Freedom also fails to protect against the Hold Person Spell (it gives immunity to Hold Creature but not Hold Creature Type).

 

Yes, and it looks like this still hasn't been corrected?

Link to comment

I knew there was a reason I was putting this off. Like Free Action itself, there are serious issues with this item. :) We still need to add:

  • Protection v. seplls spwm164, spin977, spin983, spwish25, spwi312 (Slow needs to be called out explicitly to prevent THAC0 penalties, unlike Haste)
  • Prevent Portrait Icons 38, 55, 129, 144, 145
  • Immunity to Effects 175, 185
  • Remove Icon 13, 55
  • Prevent "held" string
  • Movement Rate set to 100%

Recoded as follows:

 

// Potion of freedom has several errors
COPY_EXISTING ~potn45.itm~ ~override~
 READ_LONG  0x64 "abil_off"
 READ_SHORT 0x68 "abil_num"
 READ_LONG  0x6a "fx_off"
 SET "delta" = 0
 FOR (index = 0; index < abil_num; index = index + 1) BEGIN
READ_SHORT ("%abil_off%" +		(0x28 * "%index%")) "type"
READ_SHORT ("%abil_off%" + 0x20 + (0x28 * "%index%")) "abil_fx_idx"
SET "abil_fx_idx" = ("%abil_fx_idx%" + "%delta%")
WRITE_SHORT ("%abil_off%" + 0x20 + (0x28 * "%index%")) "%abil_fx_idx%"
PATCH_IF ("%type%" = 3) BEGIN // magical ability only
  READ_SHORT ("%abil_off%" + 0x1e + (0x28 * "%index%")) "abil_fx_num"
  FOR (index2 = 0; index2 < abil_fx_num; index2 = index2 + 1) BEGIN
	READ_SHORT ("%fx_off%" +		(("%abil_fx_idx%" + "%index2%") * 0x30)) "fx_type"
	READ_LONG  ("%fx_off%" + 0x08 + (("%abil_fx_idx%" + "%index2%") * 0x30)) "immunity"
	PATCH_IF (("%fx_type%" = 101) AND ("%immunity%" = 5)) BEGIN // change charm immunity to haste immunity
	  WRITE_LONG ("%fx_off%" + 0x08 + (("%abil_fx_idx%" + "%index2%") * 0x30)) 16
	END ELSE
	PATCH_IF (("%fx_type%" = 142) OR ("%fx_type%" = 163)) BEGIN // display portrait icon for free action
	  WRITE_LONG ("%fx_off%" + 0x0e + (("%abil_fx_idx%" + "%index2%") * 0x30)) 600 // duration
	END
  END
  FOR (index3 = 0; index3 < 18; index3 = index3 + 1) BEGIN
	INSERT_BYTES  ("%fx_off%" +		("%abil_fx_idx%" * 0x30)) 0x30
	  WRITE_BYTE  ("%fx_off%" + 0x02 + ("%abil_fx_idx%" * 0x30)) 1   // target:self
	  WRITE_BYTE  ("%fx_off%" + 0x0d + ("%abil_fx_idx%" * 0x30)) 1   // dispel/not bypass
	  WRITE_LONG  ("%fx_off%" + 0x0e + ("%abil_fx_idx%" * 0x30)) 600 // duration
	  WRITE_BYTE  ("%fx_off%" + 0x12 + ("%abil_fx_idx%" * 0x30)) 100 // probability
	PATCH_IF ("%index3%" < 5) BEGIN
	  WRITE_SHORT ("%fx_off%" +		("%abil_fx_idx%" * 0x30)) 206 // protection from spell
	END ELSE
	PATCH_IF (("%index3%" > 4) AND ("%index3%" < 10)) BEGIN
	  WRITE_SHORT ("%fx_off%" +		("%abil_fx_idx%" * 0x30)) 169 // prevent portrait icon
	END ELSE
	PATCH_IF (("%index3%" > 9) AND ("%index3%" < 12)) BEGIN
	  WRITE_SHORT ("%fx_off%" +		("%abil_fx_idx%" * 0x30)) 296 // immunity to animation
	END ELSE
	PATCH_IF (("%index3%" > 11) AND ("%index3%" < 14)) BEGIN
	  WRITE_SHORT ("%fx_off%" +		("%abil_fx_idx%" * 0x30)) 101 // immunity to effect
	END ELSE
	PATCH_IF (("%index3%" > 13) AND ("%index3%" < 16)) BEGIN
	  WRITE_SHORT ("%fx_off%" +		("%abil_fx_idx%" * 0x30)) 240 // remove icon
	  WRITE_BYTE  ("%fx_off%" + 0x0c + ("%abil_fx_idx%" * 0x30)) 1   // instant/permanent
	END ELSE
	PATCH_IF ("%index3%" = 16) BEGIN
	  WRITE_SHORT ("%fx_off%" +		("%abil_fx_idx%" * 0x30)) 267   // disable display string
	  WRITE_LONG  ("%fx_off%" + 0x04 + ("%abil_fx_idx%" * 0x30)) 14102 // "Held"
	END ELSE BEGIN
	  WRITE_SHORT ("%fx_off%" +		("%abil_fx_idx%" * 0x30)) 126 // set movement rate
	  WRITE_LONG  ("%fx_off%" + 0x04 + ("%abil_fx_idx%" * 0x30)) 100 // 100%
	  WRITE_LONG  ("%fx_off%" + 0x08 + ("%abil_fx_idx%" * 0x30)) 2   // set to percentage
	END
  END
  WRITE_LONG  ("%fx_off%" + 0x08 + (("%abil_fx_idx%" +  2) * 0x30))  55 // remove icon: stun
  WRITE_LONG  ("%fx_off%" + 0x08 + (("%abil_fx_idx%" +  3) * 0x30))  13 // remove icon: held
  WRITE_LONG  ("%fx_off%" + 0x08 + (("%abil_fx_idx%" +  4) * 0x30)) 175 // immunity to effect: hold creature 2
  WRITE_LONG  ("%fx_off%" + 0x08 + (("%abil_fx_idx%" +  5) * 0x30)) 185 // immunity to effect: hold creature type
  WRITE_ASCII ("%fx_off%" + 0x14 + (("%abil_fx_idx%" +  6) * 0x30)) ~spflayer~ // immunity to animation
  WRITE_ASCII ("%fx_off%" + 0x14 + (("%abil_fx_idx%" +  7) * 0x30)) ~spmindat~ // immunity to animation
  WRITE_LONG  ("%fx_off%" + 0x08 + (("%abil_fx_idx%" +  8) * 0x30))  38 // prevent icon: haste
  WRITE_LONG  ("%fx_off%" + 0x08 + (("%abil_fx_idx%" +  9) * 0x30))  55 // prevent icon: stun
  WRITE_LONG  ("%fx_off%" + 0x08 + (("%abil_fx_idx%" + 10) * 0x30)) 129 // prevent icon: webbed
  WRITE_LONG  ("%fx_off%" + 0x08 + (("%abil_fx_idx%" + 11) * 0x30)) 144 // prevent icon: entangled
  WRITE_LONG  ("%fx_off%" + 0x08 + (("%abil_fx_idx%" + 12) * 0x30)) 145 // prevent icon: grease
  WRITE_ASCII ("%fx_off%" + 0x14 + (("%abil_fx_idx%" + 13) * 0x30)) ~spwm164~  // protection from spell
  WRITE_ASCII ("%fx_off%" + 0x14 + (("%abil_fx_idx%" + 14) * 0x30)) ~spin977~  // protection from spell
  WRITE_ASCII ("%fx_off%" + 0x14 + (("%abil_fx_idx%" + 15) * 0x30)) ~spin983~  // protection from spell
  WRITE_ASCII ("%fx_off%" + 0x14 + (("%abil_fx_idx%" + 16) * 0x30)) ~spwish25~ // protection from spell
  WRITE_ASCII ("%fx_off%" + 0x14 + (("%abil_fx_idx%" + 17) * 0x30)) ~spwi312~  // protection from spell
  SET "delta" = ("%delta%" + 18)
  WRITE_SHORT ("%abil_off%" + 0x1e + (0x28 * "%index%")) ("%abil_fx_num%" + 18)
END
 END
 BUT_ONLY_IF_IT_CHANGES

Link to comment

Archived

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

×
×
  • Create New...