892
edits
mNo edit summary |
mNo edit summary |
||
Line 105: | Line 105: | ||
function p._testing() | function p._testing() | ||
local dung = CombatAreas.getArea(" | local dung = CombatAreas.getArea("Into the Mist") | ||
local maxHp = 1120 | local maxHp = 1120 | ||
local ae = 0.4 | local ae = 0.4 | ||
return p._getDungeonTotalHP(dung, true) | |||
return p._getDungeonMinDR(dung, maxHp, ae) | --return p._getDungeonMinDR(dung, maxHp, ae) | ||
end | end | ||
Line 133: | Line 133: | ||
return result | return result | ||
end | |||
function p._getAfflictedAverageHP() | |||
local totalHp = 0 | |||
local afflicted = Monsters._getAfflictedMonsterIdList() | |||
for _, id in Shared.skpairs(afflicted) do | |||
local monster = Monsters.getMonsterByID(id) | |||
totalHp = totalHp + Monsters._getMonsterHP(monster) | |||
end | |||
return math.ceil(totalHp / #(afflicted)) | |||
end | end | ||
function p._getDungeonTotalHP(dung, accountForEnemyDR) | function p._getDungeonTotalHP(dung, accountForEnemyDR) | ||
local calculateDr = accountForEnemyDR or false | local calculateDr = accountForEnemyDR or false | ||
totalHp = 0 | local totalHp = 0 | ||
for i, monsterID in Shared.skpairs(dung.monsters) do | for i, monsterID in Shared.skpairs(dung.monsters) do | ||
local dr = 0 | |||
local monsterHp = 0 | |||
local monster = Monsters.getMonsterByID(monsterID) | local monster = Monsters.getMonsterByID(monsterID) | ||
if monster == nil and monsterID == -1 then | |||
monsterHp = p._getAfflictedAverageHP() | |||
dr = 0.2 -- afflicted always have +20% dr | |||
-- it's probably a bit higher, even, due to some monsters having natural dr | |||
-- but good enough | |||
else | |||
monsterHp = Monsters._getMonsterHP(monster) | |||
dr = 0 | |||
end | |||
if calculateDR then | if calculateDR then | ||
for i, eq in Shared.skpairs(monster.equipmentStats) do | for i, eq in Shared.skpairs(monster.equipmentStats) do |
edits