Jump to content

Invisibility Cumulativity patch


Nythrun

Recommended Posts

Is making Shadow Door non-cumulative (though this spell hasn't any saving throw bonus to cumulate) and is omitting a few others that either state "as Improved Invisibility" or are direct copies of that spell.

COPY_EXISTING ~balth10.spl~  ~override~ // Shadow Stance! 
		  ~spdr401.spl~ ~override~ // Invisible Stalker Improved Invisibility
		  ~spin544.spl~ ~override~ // PSIONIC _SUPERIOR_INVISIBILITY
		  ~spin687.spl~ ~override~ // Create Shadows
		  ~spin698.spl~ ~override~ // Cerebus Improved Invisibility
		  ~spwi405.spl~ ~override~ // Improved Invisibility
		  ~spwi505.spl~ ~override~ // Shadow Door
		  ~spwi607.spl~ ~override~ // Mislead

are the ones I change :)

Link to comment

I'm not sure why I initially omitted save bonuses from Mass Invisibility and Shadow Door, as they both state their effects are the same as Improved Invisibility. Recoded the patch to be slightly less dumb and to catch the new spells listed.

 

// improved invisibility is missing +4 save bonuses and should not be able to stack with itself
COPY_EXISTING ~balth10.spl~ ~override~ // Shadow Stance!
		  ~spdr401.spl~ ~override~ // Invisible Stalker Improved Invisibility
		  ~spin544.spl~ ~override~ // PSIONIC_SUPERIOR_INVISIBILITY
		  ~spin687.spl~ ~override~ // Create Shadows
		  ~spin698.spl~ ~override~ // Cerebus Improved Invisibility
		  ~spwi405.spl~ ~override~ // improved invis (mage)
		  ~spwi505.spl~ ~override~ // shadow door (mage)
		  ~spwi607.spl~ ~override~ // Mislead
		  ~spwi721.spl~ ~override~ // mass invisibility 
 PATCH_IF (SOURCE_SIZE > 0x71) THEN BEGIN // protects against invalid files
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%" + 0x1e + (0x28 * "%index%")) "abil_fx_num"
  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%"
  SET "save1" = 0
  SET "save2" = 0
  SET "save3" = 0
  SET "save4" = 0
  SET "save5" = 0
  FOR (index2 = 0; index2 < abil_fx_num; index2 = index2 + 1) BEGIN
	READ_SHORT ("%fx_off%" +		(0x30 * ("%abil_fx_idx%" + "%index2%"))) "opcode"
	PATCH_IF ("%opcode%" = 20) BEGIN
	  READ_ASCII ("%fx_off%" +		(0x30 * ("%abil_fx_idx%" + "%index2%"))) "clone" (0x30)
	END ELSE
	PATCH_IF ("%opcode%" = 33) BEGIN
	  SET "save1" = 1
	END ELSE
	PATCH_IF ("%opcode%" = 34) BEGIN
	  SET "save2" = 1
	END ELSE
	PATCH_IF ("%opcode%" = 35) BEGIN
	  SET "save3" = 1
	END ELSE
	PATCH_IF ("%opcode%" = 36) BEGIN
	  SET "save4" = 1
	END ELSE
	PATCH_IF ("%opcode%" = 37) BEGIN
	  SET "save5" = 1
	END
  END
  FOR (index4 = 0; index4 < 9; index4 = index4 + 1) BEGIN
	INSERT_BYTES			("%fx_off%" +		(0x30 * ("%abil_fx_num%" + "%abil_fx_idx%"))) 0x30
	  WRITE_EVALUATED_ASCII ("%fx_off%" +		(0x30 * ("%abil_fx_num%" + "%abil_fx_idx%"))) "%clone%"
	  WRITE_SHORT		   ("%fx_off%" +		(0x30 * ("%abil_fx_num%" + "%abil_fx_idx%"))) 206  // spell immunity
	  SAY				   ("%fx_off%" + 0x04 + (0x30 * ("%abil_fx_num%" + "%abil_fx_idx%"))) @114 // ~You cannot cast...~
  END
  WRITE_ASCII		   ("%fx_off%" + 0x14 + (0x30 * ("%abil_fx_num%" + "%abil_fx_idx%"	))) ~balth10~ #8 // resref
  WRITE_ASCII		   ("%fx_off%" + 0x14 + (0x30 * ("%abil_fx_num%" + "%abil_fx_idx%" + 1))) ~spdr401~ #8 // resref
  WRITE_ASCII		   ("%fx_off%" + 0x14 + (0x30 * ("%abil_fx_num%" + "%abil_fx_idx%" + 2))) ~spin544~ #8 // resref
  WRITE_ASCII		   ("%fx_off%" + 0x14 + (0x30 * ("%abil_fx_num%" + "%abil_fx_idx%" + 3))) ~spin687~ #8 // resref
  WRITE_ASCII		   ("%fx_off%" + 0x14 + (0x30 * ("%abil_fx_num%" + "%abil_fx_idx%" + 4))) ~spin698~ #8 // resref
  WRITE_ASCII		   ("%fx_off%" + 0x14 + (0x30 * ("%abil_fx_num%" + "%abil_fx_idx%" + 5))) ~spwi405~ #8 // resref
  WRITE_ASCII		   ("%fx_off%" + 0x14 + (0x30 * ("%abil_fx_num%" + "%abil_fx_idx%" + 6))) ~spwi505~ #8 // resref
  WRITE_ASCII		   ("%fx_off%" + 0x14 + (0x30 * ("%abil_fx_num%" + "%abil_fx_idx%" + 7))) ~spwi607~ #8 // resref
  WRITE_EVALUATED_ASCII ("%fx_off%" + 0x14 + (0x30 * ("%abil_fx_num%" + "%abil_fx_idx%" + 8))) ~%SOURCE_RES%~ #8  // resref
  PATCH_IF ("%SOURCE_RES%" STRING_COMPARE_CASE "balth10" = 0) BEGIN
	WRITE_ASCII		 ("%fx_off%" + 0x14 + (0x30 * ("%abil_fx_num%" + "%abil_fx_idx%"	 ))) ~spwi721~ #8 // resref
  END ELSE
  PATCH_IF ("%SOURCE_RES%" STRING_COMPARE_CASE "spdr401" = 0) BEGIN
	WRITE_ASCII		 ("%fx_off%" + 0x14 + (0x30 * ("%abil_fx_num%" + "%abil_fx_idx%" +  1))) ~spwi721~ #8 // resref
  END ELSE
  PATCH_IF ("%SOURCE_RES%" STRING_COMPARE_CASE "spin544" = 0) BEGIN
	WRITE_ASCII		 ("%fx_off%" + 0x14 + (0x30 * ("%abil_fx_num%" + "%abil_fx_idx%" +  2))) ~spwi721~ #8 // resref
  END ELSE
  PATCH_IF ("%SOURCE_RES%" STRING_COMPARE_CASE "spin687" = 0) BEGIN
	WRITE_ASCII		 ("%fx_off%" + 0x14 + (0x30 * ("%abil_fx_num%" + "%abil_fx_idx%" +  3))) ~spwi721~ #8 // resref
  END ELSE
  PATCH_IF ("%SOURCE_RES%" STRING_COMPARE_CASE "spin698" = 0) BEGIN
	WRITE_ASCII		 ("%fx_off%" + 0x14 + (0x30 * ("%abil_fx_num%" + "%abil_fx_idx%" +  4))) ~spwi721~ #8 // resref
  END ELSE
  PATCH_IF ("%SOURCE_RES%" STRING_COMPARE_CASE "spwi405" = 0) BEGIN
	WRITE_ASCII		 ("%fx_off%" + 0x14 + (0x30 * ("%abil_fx_num%" + "%abil_fx_idx%" +  5))) ~spwi721~ #8 // resref
  END ELSE
  PATCH_IF ("%SOURCE_RES%" STRING_COMPARE_CASE "spwi505" = 0) BEGIN
	WRITE_ASCII		 ("%fx_off%" + 0x14 + (0x30 * ("%abil_fx_num%" + "%abil_fx_idx%" +  6))) ~spwi721~ #8 // resref
  END ELSE
  PATCH_IF ("%SOURCE_RES%" STRING_COMPARE_CASE "spwi607" = 0) BEGIN
	WRITE_ASCII		 ("%fx_off%" + 0x14 + (0x30 * ("%abil_fx_num%" + "%abil_fx_idx%" +  7))) ~spwi721~ #8 // resref
  END
  SET "delta"	   = ("%delta%"	   + 14 - ("%save1%" + "%save2%" + "%save3%" + "%save4%" + "%save5%"))
  SET "abil_fx_num" = ("%abil_fx_num%" + 14 - ("%save1%" + "%save2%" + "%save3%" + "%save4%" + "%save5%"))
  FOR (index3 = (save1 + save2 + save3 + save4 + save5); index3 < 5; index3 = index3 + 1) BEGIN
	INSERT_BYTES			("%fx_off%" +		(0x30 * "%abil_fx_idx%")) 0x30
	  WRITE_EVALUATED_ASCII ("%fx_off%" +		(0x30 * "%abil_fx_idx%")) "%clone%"
	  PATCH_IF ("%save1%" = 0) BEGIN
		WRITE_SHORT		 ("%fx_off%" +		(0x30 * "%abil_fx_idx%")) 33 // save v death
		SET "save1" = 1
	  END ELSE
	  PATCH_IF ("%save2%" = 0) BEGIN
		WRITE_SHORT		 ("%fx_off%" +		(0x30 * "%abil_fx_idx%")) 34 // save v wands
		SET "save2" = 1
	  END ELSE
	  PATCH_IF ("%save3%" = 0) BEGIN
		WRITE_SHORT		 ("%fx_off%" +		(0x30 * "%abil_fx_idx%")) 35 // save v poly
		SET "save3" = 1
	  END ELSE
	  PATCH_IF ("%save4%" = 0) BEGIN
		WRITE_SHORT		 ("%fx_off%" +		(0x30 * "%abil_fx_idx%")) 36 // save v breath
		SET "save4" = 1
	  END ELSE
	  PATCH_IF ("%save5%" = 0) BEGIN
		WRITE_SHORT		 ("%fx_off%" +		(0x30 * "%abil_fx_idx%")) 37 // save v spells
		SET "save5" = 1
	  END
	  WRITE_LONG			("%fx_off%" + 0x04 + (0x30 * "%abil_fx_idx%")) 4 // save bonus
	  WRITE_LONG			("%fx_off%" + 0x08 + (0x30 * "%abil_fx_idx%")) 0 // increase/decrease
  END
  WRITE_SHORT ("%abil_off%" + 0x1e + (0x28 * "%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...