Skip to content

Commit

Permalink
Characters can no longer get one-shot by magic due to having insanely…
Browse files Browse the repository at this point in the history
… high GM-set attributes (EG: 250 willpower etc) that is impossible to achieve through normal gameplay anways
  • Loading branch information
brightrim committed Feb 23, 2025
1 parent e57b67e commit b21585b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
4 changes: 3 additions & 1 deletion magic/arcane/effectScaling.lua
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ function M.getEffectScaling(user, target, spell, earthTrap)
wandGemBonus = earthTrap:getData("gemBonus")
end

local retVal = 1*(1+magicDamage.intImpact(user)+magicDamage.getEquipmentImpact(user, elementBonus))*(1+magicPenetration-magicResistance)
local retVal = 1*(1+magicDamage.intImpact(user)+magicDamage.getEquipmentImpact(user, elementBonus))

retVal = magicDamage.resistanceAndPenetrationImpact(magicResistance, magicPenetration, retVal)

retVal = magicDamage.crit(user, retVal) -- Up to 50% increase if crit, based on perception stat and RNG

Expand Down
12 changes: 11 additions & 1 deletion magic/arcane/magicDamage.lua
Original file line number Diff line number Diff line change
Expand Up @@ -229,13 +229,23 @@ end

function M.constitutionImpact(target, damage)

if damage < 0 then
return 0
end

local constitution = target:increaseAttrib("constitution", 0)

return damage* (1- common.GetAttributeBonusLow(constitution))
end

function M.resistanceAndPenetrationImpact(resist, penetration, damage)

if damage < 0 then
return 0
end

return math.max(0, damage*(1- resist + penetration)) -- never return negative values
end

function M.getMagicDamage(user, spell, element, target, DoT, Orl, earthTrap, castDuration)

Expand Down Expand Up @@ -270,7 +280,7 @@ function M.getMagicDamage(user, spell, element, target, DoT, Orl, earthTrap, cas

if playerOrMonster ~= Character.npc and not illusion then
magicResist = MR.getMagicResistance(target, spell)
finalDamage = damage*(1- magicResist + magicPen)
finalDamage = M.resistanceAndPenetrationImpact(magicResist, magicPen, damage)
end

if runes.checkSpellForRuneByName("Sul",spell) then
Expand Down
2 changes: 1 addition & 1 deletion monster/base/spells/base.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function M.dealMagicDamage(target, damage, usedMovepoints, level, monster)

local resistance = magicResistance.getMagicResistance(target)

damage = damage * (1.0 - resistance + penetration)
damage = magicDamage.resistanceAndPenetrationImpact(resistance, penetration, damage)

damage = magicDamage.constitutionImpact(target, damage)

Expand Down

0 comments on commit b21585b

Please sign in to comment.