Jump to content

Armor of Faith


CamDawg

Recommended Posts

Protects x2 against missile damaga. Also lacking protection against acid, cold, fire, and elecricity damage. It already covers magic cold (unused) and magic fire (kinda used).

 

// armor of faith not covering acid, cold, fire, electricity, doubles against missiles
COPY_EXISTING ~dgfaith.spl~ ~override~
		  ~sppr111.spl~ ~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" = 0x28
 SET "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%" + "%delta%")
WRITE_SHORT ("%abil_off%" + 0x20 + ("%abil_length%" * "%index%")) ("%abil_fx_idx%")
SET "missile" = 0 // used to track dupe missile protection opcodes
FOR (index2 = 0; index2 < abil_fx_num; index2 = index2 + 1) BEGIN
  READ_SHORT ("%fx_off%" +		(0x30 * ("%abil_fx_idx%" + "%index2%"))) "opcode"
  PATCH_IF ("%opcode%" = 89) BEGIN // missile protection
	PATCH_IF ("%missile%" = 0) BEGIN
	  READ_ASCII ("%fx_off%" +		(0x30 * ("%abil_fx_idx%" + "%index2%"))) "clone" (48) // clones effect
	  SET "missile" = 1
	END ELSE BEGIN
	  DELETE_BYTES ("%fx_off%" +		(0x30 * ("%abil_fx_idx%" + "%index2%"))) 0x30 // delete dupe effects
	  SET "delta" = ("%delta%" - 1)
	  SET "index2" = ("%index2%" - 1)
	  SET "abil_fx_num" = ("%abil_fx_num%" - 1)
	END
  END
END
FOR (index3 = 0; index3 < 4; index3 = index3 + 1) BEGIN
  INSERT_BYTES  ("%fx_off%" +		(0x30 * "%abil_fx_idx%")) 0x30 // insert new effect
	WRITE_EVALUATED_ASCII ("%fx_off%" +		(0x30 * "%abil_fx_idx%")) ~%clone%~		 // use cloned missile resist
	WRITE_SHORT		   ("%fx_off%" +		(0x30 * "%abil_fx_idx%")) (27 + "%index3%") // opcodes 27-30
END
SET "delta" = ("%delta%" + 4)
SET "abil_fx_num" = ("%abil_fx_num%" + 4)
WRITE_SHORT  ("%abil_off%" + 0x1e + ("%abil_length%" * "%index%")) "%abil_fx_num%"
 END
 BUT_ONLY_IF_IT_CHANGES

Link to comment

Archived

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

×
×
  • Create New...