4,951
edits
Falterfire (talk | contribs) (Moving stuff here from CombatAreas/Tables because I totally forgot this page existed.) |
Falterfire (talk | contribs) (Some initial prepwork on setting up dungeon DR tables. Too lazy to finish it right now) |
||
Line 199: | Line 199: | ||
result = result..'\r\n|}' | result = result..'\r\n|}' | ||
return result | return result | ||
end | |||
function p._getDungeonDRTable(dung, mode, doStuns) | |||
local AutoEatVals = {T1 = 0.2, T2 = 0.3, T3 = 0.4, T3W = 0.45} | |||
--NOTE: Due to Agility Obstacles, this value is a tad arbitrary | |||
local MaxViableHP = 1120 | |||
--This is the highest DR to list as possible. Value might be slightly off right now, currently just setting up value for testing | |||
local MaxViableDR = 81 | |||
--This is the highest DR row shown. This should be higher than MaxViableDR | |||
local MaxVisibleDR = 85 | |||
if doStuns == nil then | |||
doStuns = true | |||
elseif type(doStuns) == 'string' then | |||
doStuns = string.upper(doStuns) == 'TRUE' | |||
end | |||
--First, figure out what our max hit for each style is | |||
local MaxHits = { Melee = 0, Ranged = 0, Magic = 0 } | |||
for i, monsterID in Shared.skpairs(dung.monsters) do | |||
local monster = Monsters.getMonsterByID(monsterID) | |||
local styleName = Constants.getCombatStyleName(monster.attackType) | |||
local maxHit = Monsters._getMonsterMaxHit(monster, doStuns) | |||
if maxHit > MaxHits[styleName] then | |||
MaxHits[styleName] = maxHit | |||
end | |||
end | |||
--Then, figure out the DR row to start with | |||
--This is the DR that is one lower than the lowest possible DR for the best style | |||
local StyleArray = {"Melee", "Ranged", "Magic"} | |||
local EatThreshold = math.floor(MaxViableHP * AutoEatVals.T3W) | |||
local minDR = 100 | |||
for i, playerStyle in Shared.skpairs(StyleArray) do | |||
local maxStyleDR = 0 | |||
for enemyStyle, styleHit in Shared.skpairs(MaxHits) do | |||
if styleHit > 0 and styleHit > EatThreshold then | |||
local styleDR = math.ceil((1 - (EatThreshold / styleHit)) * 100) | |||
styleDR = math.ceil(styleDR / Constants.getTriangleDRModifier(playerStyle, enemyStyle, mode)) | |||
maxStyleDR = math.max(maxStyleDR, styleDR) | |||
end | |||
end | |||
minDR = math.min(minDR, maxStyleDR) | |||
end | |||
minDR = minDR - 1 | |||
--Finally, build the table using those starting points | |||
local StyleHeader = "Melee!!Ranged!!Magic" | |||
StyleHeader = StyleHeader..'!!'..StyleHeader..'!!'..StyleHeader..'!!'..StyleHeader | |||
local result = '{| class="wikitable stickyHeader"' | |||
result = result..'\r\n|-class="headerRow-0"' | |||
result = result..'\r\n!Pre-Triangle DR!!colspan=3|AE T3 + Wasteful!!colspan=3|Auto Eat Tier 3!!colspan=3|Auto Eat Tier 2!!colspan=3|Auto Eat Tier 1' | |||
result = result..'\r\n|-class="headerRow-0"' | |||
result = result..'\r\n!DR %!!'..StyleHeader | |||
local getHpForStyle = function(playerStyle, autoEat, playerDR) | |||
end | |||
for dr = minDR, MaxVisibleDR, 1 do | |||
end | |||
result = result..'\r\n|}' | |||
return result | |||
end | |||
function p.getDungeonDRTable(frame) | |||
local dungName = frame.args ~= nil and frame.args[1] or frame[1] | |||
local mode = frame.args ~= nil and frame.args[2] or frame[2] | |||
local doStuns = frame.args ~= nil and frame.args[3] or frame[3] | |||
local dung = CombatAreas.getArea(dungName) | |||
if dung == nil then | |||
return 'ERROR: Invalid dungeon name' | |||
end | |||
return p._getDungeonDRTable(dung, mode, doStuns) | |||
end | end | ||
return p | return p |