Skip to content

Commit

Permalink
magic resistance, penetration and damage balanced to be less top heav…
Browse files Browse the repository at this point in the history
…y + DoTs now take longer but deal 50% more
  • Loading branch information
brightrim committed Feb 3, 2025
1 parent 0ad10e1 commit f77f6c9
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 32 deletions.
2 changes: 1 addition & 1 deletion magic/arcane/dealMagicDamage.lua
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ function M.dealMagicDamage(user, target, spell, damage, level, DoT)
local Sih = runes.checkSpellForRuneByName("Sih", spell)
local castTime = castingSpeed.arcaneSpellCastSpeed(user, spell, true)

if DoT then castTime = castTime/5 end -- DoTs have 5 ticks, so this prevents them from giving 5 times the MR
if DoT then castTime = castTime/15 end -- DoTs have 15 ticks, so this prevents them from giving 15 times the MR

M.learnMagicResistance(target, castTime, level)

Expand Down
42 changes: 22 additions & 20 deletions magic/arcane/magicDamage.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,25 @@ local M = {}
local damageList = {
--The listed damage is what a perfect mage will deal before reductions are taken into consideration, maxDamage cap is also 4999 to require 3 shots minimum

{rune = "RA", damage = 3000, element = "Fire"},
{rune = "Pherc", damage = 4500, element = "Water"},
{rune = "Pherc", damage = 4500, element = "Air"},
{rune = "Pherc", damage = 4500, element = "Earth"},
{rune = "Qwan", damage = 6000, element = "Fire"},
{rune = "Luk", damage = 4500, element = "Fire"},
{rune = "Taur", damage = 4500, element = "Fire"},
{rune = "Ura", damage = 4500, element = "Fire"},
{rune = "Yeg", damage = 4500, element = "Fire"},
{rune = "Sul", damage = 4500, element = "Fire"}
{rune = "RA", damage = 1500, element = "Fire"},
{rune = "Pherc", damage = 2250, element = "Water"},
{rune = "Pherc", damage = 2250, element = "Air"},
{rune = "Pherc", damage = 2250, element = "Earth"},
{rune = "Qwan", damage = 3000, element = "Fire"},
{rune = "Luk", damage = 2250, element = "Fire"},
{rune = "Taur", damage = 2250, element = "Fire"},
{rune = "Ura", damage = 2250, element = "Fire"},
{rune = "Yeg", damage = 2250, element = "Fire"},
{rune = "Sul", damage = 2250, element = "Fire"}
}

local damageOverTimeList = { --This damage is balanced around DoTs having 5 ticks that it is spread out over.
{rune = "Pherc", damage = 4500, element = "Fire"},
{rune = "CUN", damage = 3000, element = "Water"},
{rune = "Qwan", damage = 6000, element = "Water"},
{rune = "Taur", damage = 4500, element = "Water"},
{rune = "Ura", damage = 4500, element = "Water"},
{rune = "Yeg", damage = 4500, element = "Water"}
local damageOverTimeList = { --This damage is balanced around DoTs having 15 ticks that it is spread out over. So you would want to start with a DoT before moving onto direct damage spells when fighting high level opponents
{rune = "Pherc", damage = 3375, element = "Fire"},
{rune = "CUN", damage = 2750, element = "Water"},
{rune = "Qwan", damage = 4500, element = "Water"},
{rune = "Taur", damage = 3375, element = "Water"},
{rune = "Ura", damage = 3375, element = "Water"},
{rune = "Yeg", damage = 3375, element = "Water"}
}

M.raceList = {
Expand Down Expand Up @@ -201,15 +201,17 @@ function M.getBonus(user, elementBonus)

local intelligence = user:increaseAttrib("intelligence", 0) -- Intelligence scales damage directly, while essence scales how often you can cast and willpower how much magic defense you can ignore

local statBonus = common.GetAttributeBonusHigh(intelligence)
local baseBonus = 0.3 -- The scaling of damage ended up a bit too top heavy, this counteracts that

local statBonus = common.GetAttributeBonusHigh(intelligence)/2 -- 22 int(18 int + potion) would give about 0.3, 25 int(18 int + potion and unique food) 0.38, while 15 int about 0.12, 30 int gives 0.5

local wandQualityBonus = magic.getQualityBonusWand(user) -- A perfect wand equals a bonus of 0.1

local totalBonus = statBonus + wandQualityBonus + elementBonus -- Best element bonus is 0.1
local totalBonus =baseBonus + statBonus + wandQualityBonus + elementBonus -- Best element bonus is 0.1

--There is no gem bonus for wands here or equipment bonus because that is handled by magic penetration, allowing magic gems in cloaks to cancel out magic gems in wands similar to how fighting works.

return math.min(totalBonus, 1) -- With 22 int, a perfect and correct element wand, you'd reach 0.8 leaving 0.2 for stat potions and food to achieve
return math.min(totalBonus, 1)

end

Expand Down
14 changes: 9 additions & 5 deletions magic/arcane/magicDoT.lua
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function M.dealMagicDoT(user, targets, spell, element, level)
local foundEffect2 = target.effects:find(3)
local DoT = LongTimeEffect(1,10)
DoT:addValue("remainingDamage", damage)
DoT:addValue("remainingTicks", 5)
DoT:addValue("remainingTicks", 15)
DoT:addValue("spell", spell)
DoT:addValue("level", level)
if not foundEffect then
Expand All @@ -58,7 +58,7 @@ function M.dealMagicDoT(user, targets, spell, element, level)
if runes.checkSpellForRuneByName("Sih", spell) and CUN then
local lifesteal = LongTimeEffect(3, 10)
lifesteal:addValue("remainingDamage", damage)
lifesteal:addValue("remaininingTicks", 5)
lifesteal:addValue("remaininingTicks", 15)
lifesteal:addValue("spell", spell)
if not foundEffect2 then
user.effects:addEffect(lifesteal)
Expand All @@ -69,7 +69,7 @@ function M.dealMagicDoT(user, targets, spell, element, level)
local foundEffect3 = target.effects:find(9)
local MoT = LongTimeEffect(9,10)
MoT:addValue("remainingManaReduction", manaReduction)
MoT:addValue("remainingTicks", 5)
MoT:addValue("remainingTicks", 15)
MoT:addValue("spell", spell)
MoT:addValue("level", level)
if not foundEffect3 then
Expand All @@ -80,7 +80,7 @@ function M.dealMagicDoT(user, targets, spell, element, level)
local foundEffect4 = target.effects:find(10)
local SoT = LongTimeEffect(10,10)
SoT:addValue("remainingStaminaReduction", foodReduction)
SoT:addValue("remainingTicks", 5)
SoT:addValue("remainingTicks", 15)
SoT:addValue("spell", spell)
SoT:addValue("level", level)
if not foundEffect4 then
Expand Down Expand Up @@ -120,7 +120,11 @@ function M.callEffect(myEffect, target)
if remainingTicks > 0 then
local damage = math.floor(remainingDamage/remainingTicks)
if Luk and CUN then
damage = math.floor(remainingDamage/2)
if remainingTicks == 1 then
damage = remainingDamage --ensure the last bit is dealt in one go when one tick is left
else
damage = math.floor(remainingDamage/5) -- 20, 36, 48.8, 59.04, etc of the total damage done with each tick instead of the usual 6.66% per tick
end
end
mdamage.dealMagicDamage(nil, target, spell, damage, level, true)
myEffect:addValue("remainingDamage", remainingDamage - damage)
Expand Down
8 changes: 5 additions & 3 deletions magic/arcane/magicPenetration.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@ local function getBonus(user, spell)

local willpower = user:increaseAttrib("willpower", 0) -- Magic penetration and magic resistance, a fight of whose willpower is the greatest!

local statBonus = common.GetAttributeBonusHigh(willpower) -- 22 willpower would give about 0.6, while 15 willpower about 0.23/0.24, 30 willpower gives 1.0
local baseBonus = 0.3 -- A level 100 mage will have at least 30% penetration, up to 50% due to clothes and then the remaining 50% is obtainable from the willpower stat

local statBonus = common.GetAttributeBonusHigh(willpower)/2 -- 22 willpower(potion) would give about 0.3, 25 willpower(potion and unique food) 0.38, while 15 willpower about 0.12, 30 willpower gives 0.5

local equipmentBonus = magic.getMagicBonus(user) -- caps out at 0.2. Best possible jewellery and clothing caps out at 0.2596, so this gives some leeway in terms of fashion by capping it at 0.2

local totalBonus = statBonus + equipmentBonus
local totalBonus = statBonus + equipmentBonus + baseBonus

return math.min(totalBonus, 1)
return math.min(totalBonus, 1) --Realistically the cap with unique food (very rare to get) and +4 potion buff to willpower, you can get up to 88% penetration meaning a level 50(100) monster will take 12% reduced damage and a level 94(188) monster is immune to damage unless the damage pen rune is used

end

Expand Down
14 changes: 11 additions & 3 deletions magic/arcane/magicResistance.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,25 @@ local function getBonus(target)

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

local statBonus = common.GetAttributeBonusHigh(willpower) -- 22 willpower would give about 0.6, while 15 willpower about 0.23/0.24
local baseBonus = 0.3 -- A level 100 magic resistance will have at least 30% resistance, up to 50% due to clothes and then the remaining 50% is obtainable from the willpower stat

local equipmentBonus = magic.getMagicBonus(target) -- about 0.22 if you wear full clothing and archmage stuff
local statBonus = common.GetAttributeBonusHigh(willpower)/2 -- 22 willpower(potion) would give about 0.3, 25 willpower(potion and unique food) 0.38, while 15 willpower about 0.12, 30 willpower gives 0.5

local totalBonus = statBonus + equipmentBonus
local equipmentBonus = magic.getMagicBonus(target) -- caps out at 0.2. Best possible jewellery and clothing caps out at 0.2596, so this gives some leeway in terms of fashion by capping it at 0.2

local totalBonus = statBonus + equipmentBonus + baseBonus

return math.min(totalBonus, 1)

--Realistically the cap with unique food (very rare to get) and +4 potion buff to willpower, you can get up to 88% resistance, which can be cancelled out by a mage with similar buffs and a level 100 monster will deal 12% extra damage regardless as their penetration would be 100%

end






function M.getMagicResistance(target, spell) --Returns a percentage of how much magic damage to reduce

local magicResistance
Expand Down

0 comments on commit f77f6c9

Please sign in to comment.