Module:Mazunki/Dungeons: Difference between revisions

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 = monster.attackType
local styleName = Constants.getCombatStyleName(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 51: Line 51:
end
end
end
end
return maxHitsPerStyle
return maxHitsPerMonsterStyle
end
end


function p._getDRRequiredPerPlayerStyle(dung, playerStyle, autoEatTreshold, enemyMaxHitsPerStyle)
function p._getDRRequiredPerPlayerStyle(dung, playerStyle, autoEatTreshold, enemyMaxHitsPerStyle, mode)
local _mode = mode or "Hardcore" -- default to hardcore if mode is nil
maxStyleDR = 0
for enemyStyle, styleHit in Shared.skpairs(enemyMaxHitsPerStyle) 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)
styleDR = math.ceil(styleDR / Constants.getTriangleDRModifier(playerStyle, enemyStyle, mode))
styleDR = math.ceil(styleDR / Constants.getTriangleDRModifier(playerStyle, enemyStyle, _mode))
maxStyleDR = math.max(maxStyleDR, styleDR)
maxStyleDR = math.max(maxStyleDR, styleDR)
end
end
end
end
minDR = math.min(minDR, maxStyleDR)
return maxStyleDR
return minDR
end
end


Line 72: Line 73:
local MaxVisibleDR = 85
local MaxVisibleDR = 85
local autoEatTreshhold = math.floor(maxHP * autoEatTresholdPercentage)
local autoEatTreshold = math.floor(maxHP * autoEatTresholdPercentage)
local enemyMaxHitsPerStyle = p._getMaxHitPerMonsterStyle(dung)
local enemyMaxHitsPerStyle = p._getMaxHitPerMonsterStyle(dung)
mw.logObject(enemyMaxHitsPerStyle)
-- mw.logObject(enemyMaxHitsPerStyle)
-- mw.log("ae: "..autoEatTreshold)
local reductionRequiredPerPlayerStyle = { melee = 0, ranged = 0, magic = 0 }
local reductionRequiredPerPlayerStyle = { Melee = 0, Ranged = 0, Magic = 0 }
for playerStyle, dr in ipairs(reductionRequiredPerPlayerStyle) do
for playerStyle, dr in pairs(reductionRequiredPerPlayerStyle) do
reductionRequiredPerPlayerStyle[playerStyle] = p._getDRRequiredPerPlayerStyle(dung, playerStyle, autoEatTreshold, enemyMaxHitsPerStyle)
reductionRequiredPerPlayerStyle[playerStyle] = p._getDRRequiredPerPlayerStyle(dung, playerStyle, autoEatTreshold, enemyMaxHitsPerStyle)
end
end
Line 86: Line 88:


function p._testing()
function p._testing()
local dung = CombatAreas.getArea("Spider Forest")
local dung = CombatAreas.getArea("Dragons Den")
local maxHp = 1120
local maxHp = 1120
local ae = 0.4
local ae = 0.4
return p._getDungeonMinDR(dung, maxHp, ae)
return p._getDungeonTotalHP(dung)
--return p._getDungeonMinDR(dung, maxHp, ae)
end
end


function p._getDungeonDrTable(dung, gamemode, maxHP, autoEatTreshold)
function p._getDungeonDrTable(dung, gamemode, maxHP)
local AutoEatVals = {T1 = 0.2, T2 = 0.3, T3 = 0.4, T3W = 0.45}
local AutoEatVals = { T1 = 0.2, T2 = 0.3, T3 = 0.4, T3W = 0.45 } -- W = wasteful ring
if disableAgilityObstacles ~= nil then
AutoEatVals = {T1 = 0.2, T2 = 0.3, T3 = 0.4}
end


--Finally, build the table using those starting points
--Finally, build the table using those starting points
Line 109: Line 109:
result = result..'\r\n!DR %!!'..StyleHeader
result = result..'\r\n!DR %!!'..StyleHeader


for tier, aevalue in Shared.skpairs(AutoEatValues) do
mw.log(aevalue)
end


result = result..'\r\n|}'
result = result..'\r\n|}'
Line 117: Line 119:


function p._getDungeonTotalHP(dung)
function p._getDungeonTotalHP(dung)
return
totalHp = 0
mw.log(dung.monsters)
for i, monsterID in Shared.skpairs(dung.monsters) do
local monster = Monsters.getMonsterByID(monsterID)
totalHp = totalHp + Monsters.getMonsterHP(monster)
end
end
end


return p
return p
892

edits