Skip to content

Commit

Permalink
Fix scroll crash
Browse files Browse the repository at this point in the history
  • Loading branch information
Eksekk committed Apr 28, 2023
1 parent 2d2953e commit 0bd67f4
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions Scripts/General/skem-spell-overrides.lua
Expand Up @@ -1185,7 +1185,12 @@ local function modifiedHealCharacterWithSpell(d, def, targetPtr, amount)
t.TargetIndex, t.Target = GetPlayer(targetPtr) -- also index u2[spellStructurePtr + 4]
t.Spell = mem.u2[spellStructurePtr]
t.CasterIndex, t.Caster = mem.u2[spellStructurePtr + 2], Party.PlayersArray[mem.u2[spellStructurePtr + 2] ]
t.Skill, t.Mastery = SplitSkill(t.Caster.Skills[const.Skills.Fire + math.ceil(t.Spell / 11) - 1])
if mem.u1[spellStructurePtr + 8]:And(1) ~= 0 then -- casted by scroll?
t.Skill, t.Mastery = SplitSkill(mem.u1[spellStructurePtr + 10])
t.FromScroll = true
else
t.Skill, t.Mastery = SplitSkill(t.Caster.Skills[const.Skills.Fire + math.ceil(t.Spell / 11) - 1])
end
events.call("HealingSpellPower", t)
def(targetPtr, t.Result)
end
Expand Down Expand Up @@ -1238,7 +1243,12 @@ mem.hookfunction(0x484840, 1, 3, function(d, def, playerPtr, cond, timeLow, tim
local t = {Condition = cond, Spell = mem.u2[d.ebx]}
t.CasterIndex, t.Caster = mem.u2[d.ebx + 2], Party.PlayersArray[mem.u2[d.ebx + 2] ]
t.TargetIndex, t.Target = GetPlayer(playerPtr)
t.Skill, t.Mastery = SplitSkill(t.Caster.Skills[const.Skills.Fire + math.ceil(t.Spell / 11) - 1])
if mem.u1[d.ebx + 8]:And(1) ~= 0 then -- casted by scroll?
t.Skill, t.Mastery = SplitSkill(mem.u1[d.ebx + 10])
t.FromScroll = true
else
t.Skill, t.Mastery = SplitSkill(t.Caster.Skills[const.Skills.Fire + math.ceil(t.Spell / 11) - 1])
end
-- time is calculated by subtracting spell's time limit from Game.Time, and then
-- checking if result is <= condition affect time,
-- so to calc spell time limit we need to subtract time from Game.Time
Expand Down

0 comments on commit 0bd67f4

Please sign in to comment.