////////////////////// // 3. Tweaked Items // ////////////////////// BEGIN @3 INCLUDE ~Item_Pack/Library/d1BG1v.tpa~ // aVENGER's macro for proper Tutu and BGT compatibility // Shield Amulet // Provide immunities simply by being equipped // Only modify it if there is no equipping effect and all effects are // on an ability header. If Item Revisions is installed then nothing happens COPY_EXISTING ~amul15.itm~ ~override~ PATCH_IF (SOURCE_SIZE > 0x71) THEN BEGIN READ_LONG 0x64 abil_off READ_SHORT 0x68 abil_num READ_LONG 0x6a feat_off READ_SHORT 0x6e eqfeat_off READ_SHORT 0x70 eqfeat_num READ_SHORT (abil_off+0x1e) abilfeat_num READ_SHORT (abil_off+0x20) abilfeat_off // No equipping effects and only one ability header with all effects PATCH_IF (abil_num = 1) AND (eqfeat_num = 0) AND (abilfeat_off = 0) THEN BEGIN SAY NAME1 #6852 SAY NAME2 #6917 SAY UNIDENTIFIED_DESC #6900 SAY DESC @1005 // Delete the ability header DELETE_BYTES abil_off 0x38 WRITE_SHORT 0x68 0 // Effects are moved where the ability header was WRITE_LONG 0x6a abil_off WRITE_SHORT 0x6e 0 WRITE_SHORT 0x70 abilfeat_num FOR (i = 0; i < abilfeat_num; i += 1) BEGIN offset = abil_off + i * 0x30 READ_BYTE (offset + 0x0c) timing // If effect timing is duration, change it to while equipped PATCH_IF (timing = 0) THEN BEGIN WRITE_BYTE (offset + 0x0c) 2 END END END END BUT_ONLY ACTION_IF FILE_EXISTS_IN_GAME ~_sw1h01.itm~ BEGIN COPY ~override/amul15.itm~ ~override/%tutu_var%amul15.itm~ SAY NAME2 #6917 SAY DESC @1005 END // Greenstone Amulet // Provide immunities simply by being equipped // IR version remains as with Shield Amulet COPY_EXISTING ~amul17.itm~ ~override~ PATCH_IF (SOURCE_SIZE > 0x71) THEN BEGIN READ_LONG 0x64 abil_off READ_SHORT 0x68 abil_num READ_LONG 0x6a feat_off READ_SHORT 0x6e eqfeat_off READ_SHORT 0x70 eqfeat_num READ_SHORT (abil_off+0x1e) abilfeat_num READ_SHORT (abil_off+0x20) abilfeat_off // No equipping effects and only one ability header with all effects PATCH_IF (abil_num = 1) AND (eqfeat_num = 0) AND (abilfeat_off = 0) THEN BEGIN SAY DESC @1000 // Delete the ability header DELETE_BYTES abil_off 0x38 WRITE_SHORT 0x68 0 // Effects are moved where the ability header was WRITE_LONG 0x6a abil_off WRITE_SHORT 0x6e 0 WRITE_SHORT 0x70 abilfeat_num FOR (i = 0; i < abilfeat_num; i += 1) BEGIN offset = abil_off + i * 0x30 READ_BYTE (offset + 0x0c) timing // If effect timing is duration, change it to while equipped PATCH_IF (timing = 0) THEN BEGIN WRITE_BYTE (offset + 0x0c) 2 END END END END BUT_ONLY ACTION_IF FILE_EXISTS_IN_GAME ~_sw1h01.itm~ BEGIN COPY ~override/amul17.itm~ ~override/%tutu_var%amul17.itm~ SAY DESC @1000 END // Darksteel Shield // Poison Resistance -> Electricity Resistance // Item Revisions has already changed it to Electricity so only description // is changed if IR is installed COPY_EXISTING ~shld31.itm~ ~override~ SAY DESC @1001 PATCH_IF (SOURCE_SIZE > 0x71) THEN BEGIN LPF ALTER_ITEM_EFFECT INT_VAR // Only modify equipping effects check_globals = 1 // Poison Resistance match_opcode = 173 // Change it to Electricity Resistance new_opcode = 29 END END BUT_ONLY // Scarlet Ninja-To // Equippable by thieves and fighters (except Beastmaster) /* I don't know what the intended behavior was. F/M is permitted but not F/D, F/C. Also, F/T and F/M/T are permitted but C/T, M/T are not. I will copy the original behavior. */ COPY ~Item_Pack/Bams/d1iscrlt.bam~ ~override~ COPY_EXISTING ~waninja.itm~ ~override~ SAY DESC @1002 PATCH_IF (SOURCE_SIZE > 0x71) THEN BEGIN READ_BYTE 0x1e use // Permit all alignments WRITE_BYTE 0x1e (%use% BAND 0b11000000) READ_BYTE 0x1f use // Permit Fighter and F/M WRITE_BYTE 0x1f (%use% BAND 0b11010111) READ_BYTE 0x20 use // Permit F/M/T, F/T, Paladin, Ranger, Thief, Elf WRITE_BYTE 0x20 (%use% BAND 0b00001100) READ_BYTE 0x21 use // Permit Dwarf, Half-Elf, Halfling, Human, Gnome, Monk, Half-Orc WRITE_BYTE 0x21 (%use% BAND 0b01000000) READ_BYTE 0x2b kituse // Permit Stalker, Assassin, Bounty Hunter, Swashbuckler and Deny Beastmaster WRITE_BYTE 0x2b (%kituse% BAND 0b11100010 BOR 0b00000010) READ_BYTE 0x2d kituse // Permit Baseclass WRITE_BYTE 0x2d (%kituse% BAND 0b10111111) READ_BYTE 0x2f kituse // Permit Berserker, Wizardslayer, Kensai, Cavalier, Inquisitor, Undead Hunter WRITE_BYTE 0x2f (%kituse% BAND 0b11000000) END BUT_ONLY // Studded Leather Armor of Thorns +6 // 3D4 Fire Damage instead of 1D4 and also 25% Fire Resistance // If IR is installed then leat23a.spl change does not matter because // it is not used by the item. Fire resistance will be 10% i guess since // IR applies a penalty of 15% COPY ~Item_Pack/Bams/d1gTHORN.bam~ ~override~ COPY_EXISTING ~leat23a.spl~ ~override~ LPF ALTER_EFFECT INT_VAR // Only modify ability effects check_headers = 1 // HP: Damage match_opcode = 12 /* I used ALTER_SPELL_EFFECT but match_parameter2 doesn't seem to work so i changed it to ALTER_EFFECT. Do they have the same behavior ? */ match_parameter2 = 524288 dicenumber = 3 END BUT_ONLY COPY_EXISTING ~leat23.itm~ ~override~ SAY DESC @1003 PATCH_IF (SOURCE_SIZE > 0x71) THEN BEGIN // Change Ground Icon WRITE_ASCII 0x44 ~d1gthorn~ #8 LPF DELETE_ITEM_EQEFFECT INT_VAR opcode_to_delete = 30 END LPF ADD_ITEM_EQEFFECT INT_VAR // Fire Resistance Modifier opcode = 30 // Self target = 1 // While equipped timing = 2 // 25% Resistance parameter1 = 25 // Cumulative Mode parameter2 = 0 // Not Dispel / Bypass Resistance resist_dispel = 2 END END BUT_ONLY // Short Sword of Mask +5 // Double chance 30% of triggering both abilities // IR changes SSoM so nothing is altered COPY_EXISTING ~sw1h59.itm~ ~override~ SAY DESC @1004 PATCH_IF (SOURCE_SIZE > 0x71) THEN BEGIN LPF ALTER_EFFECT INT_VAR check_globals = 0 check_headers = 1 // Second Ability match_probability1 = 30 match_probability2 = 16 probability1 = 60 probability2 = 31 END LPF ALTER_EFFECT INT_VAR check_globals = 0 check_headers = 1 // First Ability match_probability1 = 15 match_probability2 = 0 probability1 = 30 END END BUT_ONLY // Ring of Protection: The Warder's Signet // Gets +5 enchantment COPY ~Item_Pack/Bams/d1iRNG41.bam~ ~override~ COPY_EXISTING ~ring41.itm~ ~override~ SAY NAME2 @1006 SAY DESC @1007 PATCH_IF (SOURCE_SIZE > 0x71) THEN BEGIN LPF ALTER_EFFECT INT_VAR check_globals = 1 check_headers = 0 match_parametere1 = 3 parameter1 = 5 END END BUT_ONLY // Staff of Arundel // +2 AC Bonus, 30% Fire/Cold Resistance instead of 10%, IronSkins instead of bonus spells COPY_EXISTING ~wastaff.itm~ ~override~ SAY DESC @1008 PATCH_IF (SOURCE_SIZE > 0x71) THEN BEGIN LPF ALTER_ITEM_EFFECT INT_VAR // Only modify equipping effects check_globals = 1 // Fire Resistance match_opcode = 30 // Change 10% to 30% parameter1 = 30 END LPF ALTER_ITEM_EFFECT INT_VAR // Only modify equipping effects check_globals = 1 // Cold Resistance match_opcode = 28 // Change 10% to 30% parameter1 = 30 END LPF ADD_ITEM_EQEFFECT INT_VAR // AC Bonus opcode = 0 // Self target = 1 // While equipped timing = 2 // 2 Bonus to AC parameter1 = 2 // Bonus to All Weapons parameter2 = 0 END // Delete Bonus Priest Spells LPF DELETE_ITEM_EQEFFECT INT_VAR opcode_to_delete = 62 END END BUT_ONLY // Mercykiller Ring // +1 Backstab multiplier // BAM isn't used in the item file ? COPY ~Item_Pack/Bams/d1iMERCY.bam~ ~override~ COPY_EXISTING ~wa2ring.itm~ ~override~ SAY DESC @1009 PATCH_IF (SOURCE_SIZE > 0x71) THEN BEGIN LPF ADD_ITEM_EQEFFECT INT_VAR // Backstab opcode = 263 // Self target = 1 // While equipped timing = 2 // Bonus Multiplier parameter1 = 1 // Cumulative parameter2 = 0 END END BUT_ONLY // Rod of Smiting // Usable by all classes COPY_EXISTING ~rods04.itm~ ~override~ SAY DESC @1010 // Allow everyone, the lazy way WRITE_LONG 0x1e 0 WRITE_BYTE 0x29 0 WRITE_BYTE 0x2b 0 WRITE_BYTE 0x2d 0 WRITE_BYTE 0x2f 0 BUT_ONLY // Club of Detonation +5 // 15% chance of triggering party friendly fireball // IR changes the weapon so the following code doesn't do anything. ADD_PROJECTILE ~Item_Pack/Items/d1blun27.pro~ // aVENGER's code for adding a custom projectile COPY ~Item_Pack/Items/d1blun27.spl~ ~override/d1blun27.spl~ // to a custom spell READ_LONG 0x64 ab_off READ_SHORT 0x68 ab_num FOR(i=0; i<ab_num; i+=1) BEGIN WRITE_SHORT (ab_off+i*0x28+0x26) "Ñblun27%" // use new projectile END BUT_ONLY_IF_IT_CHANGES COPY_EXISTING ~blun27.itm~ ~override~ SAY DESC @1011 PATCH_IF (SOURCE_SIZE > 0x71) THEN BEGIN LPF ALTER_EFFECT INT_VAR // Only modify ability effects check_headers = 1 // Cast Spell at Target match_opcode = 146 STR_VAR match_resource = ~spwi304~ resource = ~d1blun27~ probability1 = 100 probability2 = 85 END END BUT_ONLY // Harbinger // Also Party fireball COPY_EXISTING ~sw2h07.itm~ ~override~ PATCH_IF (SOURCE_SIZE > 0x71) THEN BEGIN LPF ALTER_EFFECT INT_VAR // Only modify ability effects check_headers = 1 // Cast Spell at Target match_opcode = 146 STR_VAR match_resource = ~spwi304~ resource = ~d1blun27~ probability1 = 15 probability2 = 0 END END BUT_ONLY // Girdle of Fortitude // Set Constitution to 18 while equipped instead of once per day // IR version remains. COPY ~Item_Pack/Bams/d1iGFORT.bam~ ~override~ COPY_EXISTING ~belt09.itm~ ~override~ PATCH_IF (SOURCE_SIZE > 0x71) THEN BEGIN // Change Inventory Icon WRITE_ASCII 0x3a ~d1iGFORT~ #8 READ_LONG 0x64 abil_off READ_SHORT 0x68 abil_num READ_LONG 0x6a feat_off READ_SHORT 0x6e eqfeat_off READ_SHORT 0x70 eqfeat_num READ_SHORT (abil_off+0x1e) abilfeat_num READ_SHORT (abil_off+0x20) abilfeat_off // No equipping effects and only one ability header with all effects PATCH_IF (abil_num = 1) AND (eqfeat_num = 0) AND (abilfeat_off = 0) THEN BEGIN SAY DESC @206 // Delete the ability header DELETE_BYTES abil_off 0x38 WRITE_SHORT 0x68 0 // Effects are moved where the ability header was WRITE_LONG 0x6a abil_off WRITE_SHORT 0x6e 0 WRITE_SHORT 0x70 abilfeat_num FOR (i = 0; i < abilfeat_num; i += 1) BEGIN offset = abil_off + i * 0x30 READ_BYTE (offset + 0x0c) timing // If effect timing is duration, change it to while equipped PATCH_IF (timing = 0) THEN BEGIN WRITE_BYTE (offset + 0x0c) 2 END END END END BUT_ONLY // Cloak of the Stars // +1 THAC0 Bonus, set mastery in darts COPY_EXISTING ~clck25.itm~ ~override~ SAY DESC @508 PATCH_IF (SOURCE_SIZE > 0x71) THEN BEGIN LPF ADD_ITEM_EQEFFECT INT_VAR // THAC0 Modifier opcode = 54 // Self target = 1 // While equipped timing = 2 // Bonus 1 to THAC0 parameter1 = 1 // Cumulative Mode parameter2 = 0 END LPF ADD_ITEM_EQEFFECT INT_VAR // Proficiency opcode = 233 // Self target = 1 // While equipped timing = 2 // Set points to 3 parameter1 = 3 // Type of Darts parameter2 = 106 END END BUT_ONLY // Malla's Soul Stone // Replace Neutralize Poison with Immunity to Poison/Disease, +1 Strength, +1 AC // IR version remains. The code below doesn't do anything with IR installed COPY ~Item_Pack/Bams/d1imalla.bam~ ~override~ COPY_EXISTING ~amsoul01.itm~ ~override~ SAY DESC @608 PATCH_IF (SOURCE_SIZE > 0x71) THEN BEGIN // Change Inventory Icon WRITE_ASCII 0x3a ~d1imalla~ #8 READ_LONG 0x64 abil_off READ_SHORT 0x68 abil_num READ_LONG 0x6a feat_off READ_SHORT 0x6e eqfeat_off READ_SHORT 0x70 eqfeat_num READ_SHORT (abil_off+0x1e) abilfeat_num READ_SHORT (abil_off+0x20) abilfeat_off // Ability header with effects PATCH_IF (abil_num = 1) THEN BEGIN LPF DELETE_EFFECT INT_VAR // Only delete ability effects check_headers = 1 check_globals = 0 END // Delete the item ability itself LPF DELETE_ITEM_HEADER INT_VAR header_type = 3 END LPF ADD_ITEM_EQEFFECT INT_VAR // Strength Modifier opcode = 44 // Self target = 1 // While equipped timing = 2 // Bonus 1 to Strenth parameter1 = 25 // Cumulative Mode parameter2 = 0 END LPF ADD_ITEM_EQEFFECT INT_VAR // AC Bonus opcode = 0 // Self target = 1 // While equipped timing = 2 // 1 Bonus to AC parameter1 = 1 // Bonus to All Weapons parameter2 = 0 END LPF ADD_ITEM_EQEFFECT INT_VAR // Protection from Opcode opcode = 101 // Self target = 1 // While equipped timing = 2 // Poison parameter2 = 25 END LPF ADD_ITEM_EQEFFECT INT_VAR // Protection from Opcode opcode = 101 // Self target = 1 // While equipped timing = 2 // Disease // Original opcode was 79 which is cure disease, isn't it ? parameter2 = 78 END // Prevent strings Poisoned and Diseased from being displayed PATCH_FOR_EACH parameter1 IN 14662 54337 BEGIN LPF ADD_ITEM_EQEFFECT INT_VAR // Protection from Display Specific String opcode = 267 // Self target = 1 // While equipped timing = 2 // String Reference parameter1 END END END END BUT_ONLY // Jerrod's Mace // Immunity to Poison and Bleeding while equipped /* No change because i didn't understand the behavior. Original item uses 177 opcode to load effects wamacea, wamaceb but dltcep cannot find them anywhere in my tree. Item_Pack's version has a effect preventing poison but nothing about bleeding and also has two more effects that prevent certain strings from being displayed but these effects are on the ability header. Shouldn't they be equip effects ? */ COPY ~Item_Pack/Bams/d1ijerro.bam~ ~override~ COPY ~Item_Pack/Items/damacea.eff~ ~override~ COPY ~Item_Pack/Items/damaceb.eff~ ~override~ COPY ~Item_Pack/Items/wamace.itm~ ~override~ SAY DESC @260 ///////////////////////////////////// // 4. Convenient Free Action Items // ///////////////////////////////////// BEGIN @4 INCLUDE ~Item_Pack/Library/d1BG1v.tpa~ // aVENGER's macro for proper Tutu and BGT compatibility COPY_EXISTING ~blun30.itm~ ~override~ ~sper12.itm~ ~override~ ~ring09.itm~ ~override~ // Item_Pack version lacks "Free Action" opcode 163. Does this opcode also // have problems and should be removed ? PATCH_IF (SOURCE_SIZE > 0x71) THEN BEGIN LPF DELETE_EFFECT INT_VAR check_globals = 1 // Protection from Opcode match_opcode = 101 // Movement Modifier match_parameter2 = 126 END LPF DELETE_EFFECT INT_VAR check_globals = 1 // Immunity from Special Effect Icon match_opcode = 169 // Haste Icon match_parameter2 = 38 END PATCH_FOR_EACH match_resource IN spwi305 // Haste spwi613 // Improved Haste spin828 // Innate Haste BEGIN LPF DELETE_EFFECT INT_VAR check_globals = 1 // Protection from Spell match_opcode = 206 STR_VAR match_resource END END END BUT_ONLY // Add extra protection effects COPY_EXISTING ~ring09.itm~ ~override~ SAY DESC @1100 PATCH_IF (SOURCE_SIZE > 0x71) THEN BEGIN LPF DELETE_EFFECT INT_VAR check_globals = 1 match_opcode = 267 match_parameter1 = 14102 END LPF ADD_ITEM_EQEFFECT INT_VAR // Protection from Display Specific String opcode = 267 // Self target = 1 // While equipped timing = 2 // Held parameter1 = 14102 END PATCH_FOR_EACH parameter2 IN 144 // Entagled 145 // Grease BEGIN LPF DELETE_EFFECT INT_VAR check_globals = 1 match_opcode = 169 match_parameter2 = %parameter2% END LPF ADD_ITEM_EQEFFECT INT_VAR // Immunity from Special Effect Icon opcode = 169 // Self target = 1 // While equipped timing = 2 parameter2 END END PATCH_FOR_EACH resource IN spcl522 // Defensive Spin spin977 // Golem Slow spin983 // Innate Slow spwi101 // Grease spwi105 // Color Spray spwi312 // Slow spwish25 // Wish Slow spwm164 // Wild Magic Slow BEGIN LPF DELETE_EFFECT INT_VAR check_globals = 1 match_opcode = 206 STR_VAR match_resource = EVAL ~%resource%~ END LPF ADD_ITEM_EQEFFECT INT_VAR // Protection from Spell opcode = 206 // Self target = 1 // While equipped timing = 2 STR_VAR resource END END END BUT_ONLY ACTION_IF FILE_EXISTS_IN_GAME ~_sw1h01.itm~ BEGIN COPY ~override/ring09.itm~ ~override/%tutu_var%ring09.itm~ SAY NAME2 #6837 SAY DESC @1100 END