Anonymous

Module:Mazunki/Dungeons: Difference between revisions

From Melvor Idle
m
no edit summary
mNo edit summary
mNo edit summary
Line 42: Line 42:


function p._getMaxHitPerMonsterStyle(dung)
function p._getMaxHitPerMonsterStyle(dung)
local maxHitsPerMonsterStyle = { Melee = 0, Ranged = 0, Magic = 0 }
local maxHitsPerMonsterStyle = { melee = 0, ranged = 0, magic = 0 }
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)
local styleName = Constants.getCombatStyleName(monster.attackType)
local styleName = monster.attackType
local maxHit = Monsters._getMonsterMaxHit(monster, true) -- doStuns = true
local maxHit = Monsters._getMonsterMaxHit(monster, true) -- doStuns = true
if maxHit > maxHitsPerMonsterStyle[styleName] then
if maxHit > maxHitsPerMonsterStyle[styleName] then
Line 54: Line 54:
end
end


function p._getDRRequiredPerPlayerStyle(dung, playerStyle, autoEatTreshold)
function p._getDRRequiredPerPlayerStyle(dung, playerStyle, autoEatTreshold, enemyMaxHitsPerStyle)
for enemyStyle, styleHit in Shared.skpairs(MaxHits) do
for enemyStyle, styleHit in Shared.skpairs(enemyMaxHitsPerStyle) do
if styleHit > 0 and styleHit > autoEatTreshold then
if styleHit > 0 and styleHit > autoEatTreshold then
local styleDR = math.ceil((1 - (autoEatTreshold / styleHit)) * 100)
local styleDR = math.ceil((1 - (autoEatTreshold / styleHit)) * 100)
Line 63: Line 63:
end
end
minDR = math.min(minDR, maxStyleDR)
minDR = math.min(minDR, maxStyleDR)
return minDR
end
end


Line 71: Line 72:
local MaxVisibleDR = 85
local MaxVisibleDR = 85
local autoEatTreshhold = math.floor(maxHp * autoEatTresholdPercentage)
local autoEatTreshhold = math.floor(maxHP * autoEatTresholdPercentage)
local enemyMaxHitsPerStyle = p._getMaxHitPerMonsterStyle(dung)
mw.logObject(enemyMaxHitsPerStyle)
local reductionRequiredPerPlayerStyle = { Melee = 0, Ranged = 0, Magic = 0 }
local reductionRequiredPerPlayerStyle = { melee = 0, ranged = 0, magic = 0 }
for playerStyle, dr in Shared.skpairs(reductionRequiredPerPlayerStyle) do
reductionRequiredPerPlayerStyle[playerStyle] = p._getDRRequiredPerPlayerStyle(dung, playerStyle, autoEatTreshold)
for playerStyle, dr in ipairs(reductionRequiredPerPlayerStyle) do
reductionRequiredPerPlayerStyle[playerStyle] = p._getDRRequiredPerPlayerStyle(dung, playerStyle, autoEatTreshold, enemyMaxHitsPerStyle)
end
end
return reductionRequiredPerPlayerStyle
end
function p._testing()
local dung = CombatAreas.getArea("Spider Forest")
local maxHp = 1120
local ae = 0.4
return p._getDungeonMinDR(dung, maxHp, ae)
end
end


Line 83: Line 97:
if disableAgilityObstacles ~= nil then
if disableAgilityObstacles ~= nil then
AutoEatVals = {T1 = 0.2, T2 = 0.3, T3 = 0.4}
AutoEatVals = {T1 = 0.2, T2 = 0.3, T3 = 0.4}
end
if doStuns == nil then
doStuns = true
elseif type(doStuns) == 'string' then
doStuns = string.upper(doStuns) == 'TRUE'
end
end


Line 101: Line 109:
result = result..'\r\n!DR %!!'..StyleHeader
result = result..'\r\n!DR %!!'..StyleHeader


local getHpForStyle = function(playerStyle, autoEat, playerDR)
return nil
end
 
for dr = minDR, MaxVisibleDR, 1 do
end


result = result..'\r\n|}'
result = result..'\r\n|}'
Line 118: Line 120:
end
end


return pm
return p
892

edits