Skip to content

Commit c3bafd8

Browse files
authored
fix: add taint experience boost for Soul War monsters (opentibiabr#3494)
# Description This PR introduces a fix and enhancement for the experience boost system related to the Soul War quest. Specifically, it ensures that the taint level of the player is correctly factored into the experience calculation when defeating monsters listed in the SoulWarQuest.bagYouDesireMonsters. ## Behaviour ### **Actual** The taint level boost was not applied correctly in some cases. Experience calculation did not account for edge cases where the taint level or boost map might be undefined. ### **Expected** The taint level boost is applied consistently and correctly. Experience calculation handles edge cases gracefully. ## Type of change - [x] New feature (non-breaking change which adds functionality) ## How Has This Been Tested - [x] Hunt any SoulWar monster and see the EXP increasing with different taint levels. ## Checklist - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [x] I checked the PR checks reports - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works
1 parent 5e0e531 commit c3bafd8

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

data-otservbr-global/lib/quests/soul_war.lua

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ SoulWarQuest = {
2323
[34007] = 0.10, -- 10% for the smallest pool
2424
},
2525

26+
taintExperienceBoostMap = { -- Experience Boost per taint (In percentage %)
27+
[1] = { boost = 4.5 },
28+
[2] = { boost = 9.2 },
29+
[3] = { boost = 14.1 },
30+
[4] = { boost = 19.2 },
31+
[5] = { boost = 24.6 },
32+
},
33+
2634
timeToIncreaseCrueltyDefense = 15, -- In seconds, it will increase every 15 seconds if don't use mortal essence in greedy maw
2735
useGreedMawCooldown = 30, -- In seconds
2836
goshnarsCrueltyDefenseChange = 2, -- Defense change, the amount that will decrease or increase defense, the defense cannot decrease more than the monster's original defense amount

data/events/scripts/player.lua

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,18 @@ function Player:onGainExperience(target, exp, rawExp)
582582
end
583583
end
584584

585+
-- Soul War Experience by Taint
586+
if SoulWarQuest then
587+
local monsterType = target:getType()
588+
if monsterType and monsterType:getName() and table.contains(SoulWarQuest.bagYouDesireMonsters, monsterType:getName()) then
589+
local taintLevel = self:getTaintLevel()
590+
if taintLevel > 0 then
591+
local taintBoost = SoulWarQuest.taintExperienceBoostMap[taintLevel] and SoulWarQuest.taintExperienceBoostMap[taintLevel].boost or 0
592+
exp = exp * (1 + taintBoost / 100)
593+
end
594+
end
595+
end
596+
585597
-- Final Adjustments: Low Level Bonus and Base Rate
586598
local lowLevelBonusExp = self:getFinalLowLevelBonus()
587599
local baseRateExp = self:getFinalBaseRateExperience()

0 commit comments

Comments
 (0)