Skip to content

Commit

Permalink
improve: customizable bosses abilities
Browse files Browse the repository at this point in the history
  • Loading branch information
phacUFPE committed Dec 5, 2024
1 parent 11b1101 commit 1783742
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
7 changes: 7 additions & 0 deletions data-otservbr-global/lib/others/soulpit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,17 @@ SoulPit = {
},
bossAbilities = {
overpowerSoulPit = {
bonusCriticalDamage = 1.1,
player = true,
monster = false,
},
enrageSoulPit = {
bounds = {
[{0.8, 0.6}] = 0.9, -- 10% damage reduction
[{0.6, 0.4}] = 0.75, -- 25% damage reduction
[{0.4, 0.2}] = 0.6, -- 40% damage reduction
[{0.0, 0.2}] = 0.4, -- 60% damage reduction
},
player = false,
monster = true,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,10 @@ function enrage.onHealthChange(creature, attacker, primaryDamage, primaryType, s

local healthPercentage = creature:getHealth() / creature:getMaxHealth()

if healthPercentage >= 0.6 and healthPercentage <= 0.8 then
primaryDamage = primaryDamage * 0.9 -- 10% damage reduction
secondaryDamage = secondaryDamage * 0.9 -- 10% damage reduction
elseif healthPercentage >= 0.4 and healthPercentage < 0.6 then
primaryDamage = primaryDamage * 0.75 -- 25% damage reduction
secondaryDamage = secondaryDamage * 0.75 -- 25% damage reduction
elseif healthPercentage >= 0.2 and healthPercentage < 0.4 then
primaryDamage = primaryDamage * 0.6 -- 40% damage reduction
secondaryDamage = secondaryDamage * 0.6 -- 40% damage reduction
elseif healthPercentage > 0 and healthPercentage < 0.2 then
primaryDamage = primaryDamage * 0.4 -- 60% damage reduction
secondaryDamage = secondaryDamage * 0.4 -- 60% damage reduction
for bounds, reduction in pairs(SoulPit.bossAbilities.enrageSoulPit.bounds) do
if healthPercentage > bounds[2] and healthPercentage <= bounds[1] then
return primaryDamage * reduction, primaryType, secondaryDamage * reduction, secondaryType
end
end

return primaryDamage, primaryType, secondaryDamage, secondaryType
Expand All @@ -27,8 +19,9 @@ enrage:register()
local overpower = CreatureEvent("overpowerSoulPit")
function overpower.onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType)
if creature and attacker and attacker:isMonster() and attacker:getForgeStack() == 40 and not attacker:getMaster() then
primaryDamage = primaryDamage * 1.1
secondaryDamage = secondaryDamage * 1.1
local bonusCriticalDamage = SoulPit.bossAbilities.overpowerSoulPit.bonusCriticalDamage
primaryDamage = primaryDamage * bonusCriticalDamage
secondaryDamage = secondaryDamage * bonusCriticalDamage
creature:getPosition():sendMagicEffect(CONST_ME_CRITICAL_DAMAGE)
end

Expand Down

0 comments on commit 1783742

Please sign in to comment.