Anonymous

Module:Mazunki/Dungeons: Difference between revisions

From Melvor Idle
m
no edit summary
mNo edit summary
mNo edit summary
Line 25: Line 25:
local boss = Monsters.getMonsterByID(dung.monsters[Shared.tableCount(dung.monsters)])
local boss = Monsters.getMonsterByID(dung.monsters[Shared.tableCount(dung.monsters)])
result = result..'||'..Monsters._getMonsterCombatLevel(boss)
result = result..'||'..Monsters._getMonsterCombatLevel(boss)
result = result..'||'..p.getDungeonTotalHP(dung)
result = result..'||'..p._getDungeonTotalHP(dung, true) -- accountForEnemyDR = true
result = result..'||'..p.getDungeonMinDR(dung)
result = result..'||'..p.getDungeonMinDR(dung)


Line 88: Line 88:


function p._testing()
function p._testing()
local dung = CombatAreas.getArea("Dragons Den")
local dung = CombatAreas.getArea("Undead Graveyard")
local maxHp = 1120
local maxHp = 1120
local ae = 0.4
local ae = 0.4
return p._getDungeonTotalHP(dung)
return p._getDungeonTotalHP(dung, true)
--return p._getDungeonMinDR(dung, maxHp, ae)
--return p._getDungeonMinDR(dung, maxHp, ae)
end
end
Line 118: Line 118:
end
end


function p._getDungeonTotalHP(dung)
function p._getDungeonTotalHP(dung, accountForEnemyDR)
local calculateDr = accountForEnemyDR or false
totalHp = 0
totalHp = 0
mw.log(dung.monsters)
mw.log(dung.monsters)
for i, monsterID in Shared.skpairs(dung.monsters) do
for i, monsterID in Shared.skpairs(dung.monsters) do
local monster = Monsters.getMonsterByID(monsterID)
local monster = Monsters.getMonsterByID(monsterID)
totalHp = totalHp + Monsters.getMonsterHP(monster)
local monsterHp = Monsters._getMonsterHP(monster)
local dr = 0
if calculateDR then
for i, eq in Shared.skpairs(monster.equipmentStats) do
if eq.key == "damageReduction" then
dr = eq.value/100
end
end
end
local monsterPostReductionHP = math.floor(monsterHp / (1-dr))
totalHp = totalHp + monsterPostReductionHP
mw.log(monsterPostReductionHP, totalHp)
end
end
return totalHp
end
end


return p
return p
892

edits