[(BGEE, BG2) bug] Holy smite (0813)
By convention, BG2 spells cap at level 20. Holy Smite is capped at level 19, and had some mistargeted/mistimed effects when cast at levels 6 or 7.
Another ugly, old but functional patch.
Another ugly, old but functional patch.
// holy smite missing level 20 abilities, a few effects mistargeted and/or wrong duration at lev 6, 7
COPY_EXISTING ~sppr313.spl~ ~override~
READ_LONG 0x64 "abil_off"
READ_SHORT 0x68 "abil_num"
READ_LONG 0x6a "fx_off"
SET "orig_abil" = "%abil_num%"
SET "delta" = 0
SET "loops" = 0
SET "min_lev" = 0
WHILE ("%abil_num%" > 0) BEGIN // grabs last ability (lev 19) and does patching for lev 6, 7 abilities
SET "abil_num" = ("%abil_num%" - 1)
READ_SHORT ("%abil_off%" + 0x10 + (0x28 * "%abil_num%")) "level"
PATCH_IF ("%min_lev%" = 0) BEGIN
SET "min_lev" = "%level%" // sets min_lev to use last ability
END
PATCH_IF (("%level%" = 6) OR ("%level%" = 7)) BEGIN
READ_SHORT ("%abil_off%" + 0x1e + (0x28 * "%abil_num%")) "abil_fx_num"
READ_SHORT ("%abil_off%" + 0x20 + (0x28 * "%abil_num%")) "abil_fx_idx"
WHILE ("%abil_fx_num%" > 0) BEGIN
SET "abil_fx_num" = ("%abil_fx_num%" - 1)
READ_ASCII ("%fx_off%" + 0x14 + (0x30 * ("%abil_fx_idx%" + "%abil_fx_num%"))) "eff_file"
PATCH_IF ("%eff_file%" STRING_COMPARE_CASE "hitinvwa" = 0) BEGIN
WRITE_BYTE ("%fx_off%" + 0x0c + (0x30 * ("%abil_fx_idx%" + "%abil_fx_num%"))) 1 // instant/permanent
END ELSE
PATCH_IF ("%eff_file%" STRING_COMPARE_CASE "blind" = 0) BEGIN
WRITE_BYTE ("%fx_off%" + 0x0c + (0x30 * ("%abil_fx_idx%" + "%abil_fx_num%"))) 0 // instant/limited
WRITE_LONG ("%fx_off%" + 0x0e + (0x30 * ("%abil_fx_idx%" + "%abil_fx_num%"))) 6 // duration
END
END
END
END
PATCH_IF ("%min_lev%" < 20) BEGIN
INSERT_BYTES "%fx_off%" 0x28
SET "delta" = 1
READ_ASCII ("%fx_off%" - 0x28) "abil_clone" (0x28) // reads entire ability as block
READ_SHORT (("%fx_off%" - 0x28) + 0x1e) "abil_fx_num"
READ_SHORT (("%fx_off%" - 0x28) + 0x20) "abil_fx_idx"
END
WHILE ("%delta%" > "%loops%") BEGIN // this clones the lev 19 abilities to the lev 20 one
WRITE_EVALUATED_ASCII (("%fx_off%" + (0x28 * "%loops%")) ) "%abil_clone%"
WRITE_SHORT (("%fx_off%" + (0x28 * "%loops%")) + 0x10) ("%min_lev%" + 1 + "%loops%")
WRITE_SHORT (("%fx_off%" + (0x28 * "%loops%")) + 0x1e) "%abil_fx_num%"
WRITE_SHORT (("%fx_off%" + (0x28 * "%loops%")) + 0x20) ("%abil_fx_idx%" + (("%loops%" + 1) * "%abil_fx_num%"))
SET "loops" = ("%loops%" + 1)
END
WRITE_SHORT 0x68 ("%orig_abil%" + "%delta%")
SET "fx_off" = ("%fx_off%" + (0x28 * "%delta%"))
WRITE_LONG 0x6a "%fx_off%"
INSERT_BYTES ("%fx_off%" + (0x30 * ("%abil_fx_num%" + "%abil_fx_idx%"))) (0x30 * ("%delta%" * "%abil_fx_num%"))
WHILE ("%delta%" > 0) BEGIN
SET "loops" = "%abil_fx_num%"
WHILE ("%loops%" > 0) BEGIN
SET "loops" = ("%loops%" - 1)
READ_ASCII ("%fx_off%" + 0x00 + (0x30 * ("%loops%" + "%abil_fx_idx%"))) "clone" (0x30)
WRITE_EVALUATED_ASCII ("%fx_off%" + 0x00 + (0x30 * ("%loops%" + "%abil_fx_idx%")) + ("%delta%" * (0x30 * "%abil_fx_num%"))) "%clone%"
READ_ASCII ("%fx_off%" + 0x14 + (0x30 * ("%loops%" + "%abil_fx_idx%"))) "eff_again"
PATCH_IF ("%eff_again%" STRING_COMPARE_CASE "sp313l19" = 0) BEGIN
WRITE_ASCII ("%fx_off%" + 0x14 + (0x30 * ("%loops%" + "%abil_fx_idx%")) + ("%delta%" * (0x30 * "%abil_fx_num%"))) ~sp313l20~
END ELSE BEGIN
WRITE_EVALUATED_ASCII ("%fx_off%" + 0x14 + (0x30 * ("%loops%" + "%abil_fx_idx%")) + ("%delta%" * (0x30 * "%abil_fx_num%"))) "%eff_again%"
END
END
SET "delta" = ("%delta%" - 1)
END
BUT_ONLY_IF_IT_CHANGES
Post edited by Bhryaen on
1
Comments
with comments to @CamDawg
level 20 header - lol, we fix all bg2ee bugs now?
Btw, by level 20 damage is 40d2, save for half. Which is considerably larger than 20d4
This isn't such a big difference on lower levels, but you used to fix these things before
Now i see what you did @CamDawg
SP313L11.EFF and above could be scrapped (left out from the next biffing round) if needed.
But sp313L2 to sp313l10 all seem to have the correct damage in NI.
However:
@CamDawg, @Avenger_teambg, @SethDavis
What happens now is that when the target fails its save you get damage shown twice in the battle log, when they succeed in their save you only get one line of damage in the battle log. Is this because of the new way this spell is used?
I'm pretty sure that's how all damage with save-for-half works. You'll either get two damage messages or a damage and save vs. whatever.
This one is Confirmed Fixed.
In damage opcode, the lowest 2 bits of param2 determine the damage method:
00 - normal value
01 - set hp to value
10 - percentage
11 - profit!
@SethDavis knows, if this combo (11) could be used for save for half damage, or not.
That is ugly.
You mean you cannot decide to round up or down?