Jump to content


Assigning schools and secondary types to item abilities


6 replies to this topic

#1 aVENGER_(RR)

    Sneaksie!

  • Fixpackers
  • 1008 posts
  • Gender:Male

Posted 27 February 2010 - 07:15 PM

The recent discovery of the fields which regulate spells schools and secondary types in an item's extended header, we might be able to finally fix a couple of longstanding issues. In some way, this is more of a standardization since the Bioware developers used these flags sporadically, though a pattern can be observed in several cases. Here are some suggestions for things that can reasonably be considered as bugfixes:

// Standardize the school and secondary type of items which cast illusionary spells

COPY_EXISTING ~ring28.itm~ ~override~								// Ring of Air Control
			  ~sw1h26.itm~ ~override~								// Ilbratha +1
  READ_LONG  0x64 "abil_off"
  READ_SHORT 0x68 "abil_num"
  FOR (index = 0; index < "%abil_num%"; index = index + 1) BEGIN	 // parse each ability
	READ_BYTE ("%abil_off%" + ("%index%" * 0x38)) "abil_type"		// determine ability type
	PATCH_IF  ("%abil_type%" = 3) BEGIN							  // only patch the magical ability header
	  READ_ASCII ("%abil_off%" + 0x04 + ("%index%" * 0x38)) "icon"   // use icon (BAM name)
	  PATCH_IF (("%icon%" STRING_EQUAL_CASE ~SPWI212B~) OR ("%icon%" STRING_EQUAL_CASE ~SPWI405B~)) BEGIN // Mirror Image or Improved Invisibility
		WRITE_BYTE ("%abil_off%" + 0x17 + ("%index%" * 0x38)) "5"	// school: Illusionist
		WRITE_BYTE ("%abil_off%" + 0x19 + ("%index%" * 0x38)) "3"	// secondary type: Illusionary Protections
	  END
	END
  END
BUT_ONLY_IF_IT_CHANGES


// Standardize the school and secondary type of items which cast abjuration spells

COPY_EXISTING ~staf11.itm~ ~override~								// Staff of the Magi
			  ~wand18.itm~ ~override~								// Wand of Spell Striking
  READ_LONG  0x64 "abil_off"
  READ_SHORT 0x68 "abil_num"
  FOR (index = 0; index < "%abil_num%"; index = index + 1) BEGIN	 // parse each ability
	READ_BYTE ("%abil_off%" + ("%index%" * 0x38)) "abil_type"		// determine ability type
	PATCH_IF  ("%abil_type%" = 3) BEGIN							  // only patch the magical ability header
	  READ_ASCII ("%abil_off%" + 0x04 + ("%index%" * 0x38)) "icon"   // use icon (BAM name)
	  PATCH_IF ("%icon%" STRING_EQUAL_CASE ~SPWI902B~) BEGIN		 // Spell Trap
		WRITE_BYTE ("%abil_off%" + 0x17 + ("%index%" * 0x38)) "1"	// school: Abjurer
		WRITE_BYTE ("%abil_off%" + 0x19 + ("%index%" * 0x38)) "1"	// secondary type: Spell Protections
	  END
	  PATCH_IF (("%icon%" STRING_EQUAL_CASE ~SPWI513B~) OR ("%icon%" STRING_EQUAL_CASE ~SPWI608B~)) BEGIN // Breach or Pierce Magic
		WRITE_BYTE ("%abil_off%" + 0x17 + ("%index%" * 0x38)) "1"	// school: Abjurer
		WRITE_BYTE ("%abil_off%" + 0x19 + ("%index%" * 0x38)) "4"	// secondary type: Magic Attack
	  END
	END
  END
BUT_ONLY_IF_IT_CHANGES


// Assign the proper school and secondary type to the special ability of the Shield amulet

COPY_EXISTING ~amul15.itm~ ~override~							 // Shield Amulet
  READ_LONG  0x64 "abil_off"
  READ_SHORT 0x68 "abil_num"
  FOR (index = 0; index < "%abil_num%"; index = index + 1) BEGIN  // parse each ability
	READ_BYTE ("%abil_off%" + ("%index%" * 0x38)) "abil_type"	 // determine ability type
	PATCH_IF  ("%abil_type%" = 3) BEGIN						   // only patch the magical ability header
	  WRITE_BYTE ("%abil_off%" + 0x17 + ("%index%" * 0x38)) "6"   // school: Invoker
	  WRITE_BYTE ("%abil_off%" + 0x19 + ("%index%" * 0x38)) "7"   // secondary type: Combat Protections
	END
  END
BUT_ONLY_IF_IT_CHANGES


OTOH, this batch is more likely a candidate for a tweak mod. Heh, I might even include it in some future version of aTweaks. :suspect:

// Standardize the school and secondary type of items which cast offensive spells

COPY_EXISTING ~staf13.itm~ ~override~								// Staff of Thunder and Lightning
			  ~wand03.itm~ ~override~								// Wand of Magic Missiles
			  ~wand05.itm~ ~override~								// Wand of Fire
			  ~wand06.itm~ ~override~								// Wand of Frost
			  ~wand07.itm~ ~override~								// Wand of Lightning
			  ~wand11.itm~ ~override~								// Wand of the Heavens
			  ~wand13.itm~ ~override~								// Wand of Cloudkill
  READ_LONG  0x64 "abil_off"
  READ_SHORT 0x68 "abil_num"
  FOR (index = 0; index < "%abil_num%"; index = index + 1) BEGIN	 // parse each ability
	READ_BYTE ("%abil_off%" + ("%index%" * 0x38)) "abil_type"		// determine ability type
	PATCH_IF  ("%abil_type%" = 3) BEGIN							  // only patch the magical ability header
	  READ_ASCII ("%abil_off%" + 0x04 + ("%index%" * 0x38)) "icon"   // use icon (BAM name)
	  PATCH_IF NOT (("%icon%" STRING_EQUAL_CASE ~SPWI103B~) OR ("%icon%" STRING_EQUAL_CASE ~SPWI104B~)) BEGIN // not Burning Hands or Charm
		WRITE_BYTE ("%abil_off%" + 0x17 + ("%index%" * 0x38)) "6"	// school: Invoker
		WRITE_BYTE ("%abil_off%" + 0x19 + ("%index%" * 0x38)) "10"   // secondary type: Offensive Damage
	  END
	  PATCH_IF ("%icon%" STRING_EQUAL_CASE ~SPWI103B~) BEGIN		 // Burning Hands
		WRITE_BYTE ("%abil_off%" + 0x17 + ("%index%" * 0x38)) "8"	// school: Transmuter
		WRITE_BYTE ("%abil_off%" + 0x19 + ("%index%" * 0x38)) "10"   // secondary type: Offensive Damage
	  END
	  PATCH_IF ("%icon%" STRING_EQUAL_CASE ~IWAND13~) BEGIN		  // Wand of Cloudkill
		WRITE_BYTE ("%abil_off%" + 0x17 + ("%index%" * 0x38)) "6"	// school: Invoker
		WRITE_BYTE ("%abil_off%" + 0x19 + ("%index%" * 0x38)) "9"	// secondary type: Battleground
	  END
	END
  END
BUT_ONLY_IF_IT_CHANGES

// Standardize the school and secondary type of items which cast alteration spells

COPY_EXISTING ~brac16.itm~ ~override~								// Bracers of Blinding Strike
			  ~boot12.itm~ ~override~								// Gargoyle Boots
			  ~ring29.itm~ ~override~								// Ring of Earth Control
			  ~ring39.itm~ ~override~								// Ring of Gaxx
			  ~staf16.itm~ ~override~								// Staff of Earth +2
			  ~sw1h27.itm~ ~override~								// Arbane's Sword +2
			  ~sw1h36.itm~ ~override~								// Namarra +2
  READ_LONG  0x64 "abil_off"
  READ_SHORT 0x68 "abil_num"
  FOR (index = 0; index < "%abil_num%"; index = index + 1) BEGIN	 // parse each ability
	READ_BYTE ("%abil_off%" + ("%index%" * 0x38)) "abil_type"		// determine ability type
	PATCH_IF  ("%abil_type%" = 3) BEGIN							  // only patch the magical ability header
	  READ_ASCII ("%abil_off%" + 0x04 + ("%index%" * 0x38)) "icon"   // use icon (BAM name)
	  PATCH_IF (("%icon%" STRING_EQUAL_CASE ~SPWI305B~) OR ("%icon%" STRING_EQUAL_CASE ~SPWI613B~) OR ("%icon%" STRING_EQUAL_CASE ~SPWI625B~)) BEGIN // Haste, Improved Haste or Stone to Flesh
		WRITE_BYTE ("%abil_off%" + 0x17 + ("%index%" * 0x38)) "8"	// school: Transmuter
		WRITE_BYTE ("%abil_off%" + 0x19 + ("%index%" * 0x38)) "13"   // secondary type: Non-Combat
	  END
	  PATCH_IF ("%icon%" STRING_EQUAL_CASE ~SPWI408B~) BEGIN		 // Stoneskin
		WRITE_BYTE ("%abil_off%" + 0x17 + ("%index%" * 0x38)) "8"	// school: Transmuter
		WRITE_BYTE ("%abil_off%" + 0x19 + ("%index%" * 0x38)) "7"	// secondary type: Combat Protections
	  END
	  PATCH_IF ("%icon%" STRING_EQUAL_CASE ~SPPR211B~) BEGIN		 // Silence 15' Radius
		WRITE_BYTE ("%abil_off%" + 0x17 + ("%index%" * 0x38)) "8"	// school: Transmuter
		WRITE_BYTE ("%abil_off%" + 0x19 + ("%index%" * 0x38)) "11"   // secondary type: Disabling
	  END
	END
  END
BUT_ONLY_IF_IT_CHANGES


// Standardize the school and secondary type of items which cast divination spells

COPY_EXISTING ~sw1h32.itm~ ~override~								// Dragonslayer
			  ~sw1h34.itm~ ~override~								// Albruin +1
  READ_LONG  0x64 "abil_off"
  READ_SHORT 0x68 "abil_num"
  FOR (index = 0; index < "%abil_num%"; index = index + 1) BEGIN	 // parse each ability
	READ_BYTE ("%abil_off%" + ("%index%" * 0x38)) "abil_type"		// determine ability type
	PATCH_IF  ("%abil_type%" = 3) BEGIN							  // only patch the magical ability header
	  READ_ASCII ("%abil_off%" + 0x04 + ("%index%" * 0x38)) "icon"   // use icon (BAM name)
	  PATCH_IF ("%icon%" STRING_EQUAL_CASE ~SPWI203B~) BEGIN		 // Detect Invisibility
		WRITE_BYTE ("%abil_off%" + 0x17 + ("%index%" * 0x38)) "3"	// school: Diviner
		WRITE_BYTE ("%abil_off%" + 0x19 + ("%index%" * 0x38)) "5"	// secondary type: Divination Attack
	  END
	END
  END
BUT_ONLY_IF_IT_CHANGES

For reference, this code assigns schools and secondary types only to items which clearly state that they duplicate the respective spell in their description. Items which may confer similar effects through other means (i.e. the Jansen Spectroscopes Detect Invisibility ability) were deliberately left untouched. Similarly, items which cast the actual spells, rather than mimic their effects were not altered.

Edited by aVENGER_(RR), 27 February 2010 - 07:20 PM.

Retired modder

Rogue Rebalancing - Author
aTweaks - Author
Wizard Slayer Rebalancing - Co-Author
BG2 Fixpack - Contributor

#2 devSin

  • Fixpackers
  • 3017 posts
  • Gender:Male

Posted 27 February 2010 - 10:13 PM

You may want to test that reverting the wand of spellstriking works (make sure it behaves correctly with spell shield). Otherwise, I'd include all of that.

Note that these should allow us to completely drop the staff of magi spelltrap and similar changes (the old "un-breachable protections" issues, since we can now set the type correctly for all the effects) where we switch to casting a spell just to get the school/type. That probably means just that and the Staff of Power, and the Wand of Spellstriking if it works; I don't remember any others right now.

#3 aVENGER_(RR)

    Sneaksie!

  • Fixpackers
  • 1008 posts
  • Gender:Male

Posted 28 February 2010 - 12:01 AM

View PostdevSin, on Feb 28 2010, 07:13 AM, said:

You may want to test that reverting the wand of spellstriking works (make sure it behaves correctly with spell shield). Otherwise, I'd include all of that.

Sure thing. For reference, here's a comparison between several item abilities as they appear in the unmodded game and after applying the abovementioned code:


Ilbratha +1

Quote

Before: Mirror Image cast by the sword cannot be removed by Detect Illusions, Oracle and True Sight
After: Mirror Image cast by the sword is properly removed by Detect Illusions, Oracle and True Sight


Staff of the Magi

Quote

Before: Spell Trap cast by the Staff of the Magi cannot be removed by Spell Strike
After: Spell Trap cast by the Staff of the Magi is properly removed by Spell Strike


Wand of Spell Striking

Quote

Before: Both abilities of the wand bypass Spell Shield
After: Both abilities of the wand are stopped by Spell Shield


Wand of Fire

Quote

Before: Both abilities of the wand bypass Spell Immunity: Evocation and/or the Cloak of Mirroring
After: Both abilities of the wand are stopped by Spell Immunity: Evocation and/or by the Cloak of Mirroring


Wand of Frost

Quote

Before: The wand's ability is stopped by Spell Immunity: Evocation but it bypasses the Cloak of Mirroring
After: The wand's ability is stopped by Spell Immunity: Evocation and/or by the Cloak of Mirroring

View PostdevSin, on Feb 28 2010, 07:13 AM, said:

Staff of Power

I thought about that, but I'd rather retain the current Staff of Power fix than rebuild the Globe of Invulnerability within the item simply due to the sheer complexity of the spell in question.
Retired modder

Rogue Rebalancing - Author
aTweaks - Author
Wizard Slayer Rebalancing - Co-Author
BG2 Fixpack - Contributor

#4 devSin

  • Fixpackers
  • 3017 posts
  • Gender:Male

Posted 28 February 2010 - 01:43 PM

Oh, yeah, we add a bunch of crap to Globe, you're right. Good call.

#5 Guest_Marcellus Caesar_*

  • Guests

Posted 06 March 2010 - 02:26 PM

I'm actually following this thread closely... any estimate on when this bugfix can be implemented, and if the fixes for the wands can also apply to Tutu?

I have little WeiDU knowledge, so I'd apply these changes myself otherwise seeing as this seems like a pretty big fix for a number of items.

#6 aVENGER_(RR)

    Sneaksie!

  • Fixpackers
  • 1008 posts
  • Gender:Male

Posted 06 March 2010 - 08:51 PM

View PostMarcellus Caesar, on Mar 6 2010, 11:26 PM, said:

I'm actually following this thread closely... any estimate on when this bugfix can be implemented,

The abovementioned material (or at least a part of it) is going to be implemented in the next version of the fixpack. We are working on that right now, but there's no official release date. By my rough estimate, it will take us at least a few more months.

Quote

and if the fixes for the wands can also apply to Tutu?

The BG2 Fixpack is not applicable on Tutu. Its author would have to implement the fixes manually in the next version of that mod. However, after the item school/secondary type fixes are finalized (several parts are still under review) I could release them in a form which would work on Tutu as well.

Edited by aVENGER_(RR), 06 March 2010 - 08:59 PM.

Retired modder

Rogue Rebalancing - Author
aTweaks - Author
Wizard Slayer Rebalancing - Co-Author
BG2 Fixpack - Contributor

#7 Guest_Marcellus Caesar_*

  • Guests

Posted 06 March 2010 - 09:06 PM

View PostaVENGER_(RR), on Mar 6 2010, 08:51 PM, said:

View PostMarcellus Caesar, on Mar 6 2010, 11:26 PM, said:

I'm actually following this thread closely... any estimate on when this bugfix can be implemented,

The abovementioned material (or at least a part of it) is going to be implemented in the next version of the fixpack. We are working on that right now, but there's no official release date. By my rough estimate, it will take us at least a few more months.

Quote

and if the fixes for the wands can also apply to Tutu?

The BG2 Fixpack is not applicable on Tutu. Its author would have to implement the fixes manually in the next version of that mod. However, after the item school/secondary type fixes are finalized (several parts are still under review) I could release them in a form which would work on Tutu as well.
Great! Thank you for your and everyone else's work in continuing to patch one hell of a good game! I'll be waiting for the next edition of the fixpack with bated breath!




Reply to this topic



  


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users