Module:Monsters: Difference between revisions

Tweaked getMonsterMaxHit to allow for the option of ignoring stuns (will be used when making the DungeonDRTable, but by defualt behavior should be unchanged)
(_getMonsterTable: Center align images)
(Tweaked getMonsterMaxHit to allow for the option of ignoring stuns (will be used when making the DungeonDRTable, but by defualt behavior should be unchanged))
Line 296: Line 296:
end
end


function p._getMonsterMaxHit(monster)
function p._getMonsterMaxHit(monster, doStuns)
   -- 2021-06-11 Adjusted for v0.20 stun/sleep changes, where damage multiplier now applies
   -- 2021-06-11 Adjusted for v0.20 stun/sleep changes, where damage multiplier now applies
   -- to all enemy attacks if stun/sleep is present on at least one special attack
   -- to all enemy attacks if stun/sleep is present on at least one special attack
  if doStuns == nil then
    doStuns = true
  elseif type(doStuns) == 'string' then
    doStuns = string.upper(doStuns) == 'TRUE'
  end
   local normalChance = 100
   local normalChance = 100
   local specialMaxHit = 0
   local specialMaxHit = 0
Line 327: Line 333:
     end
     end


     if canStun then damageMultiplier = damageMultiplier * 1.3 end
     if canStun and doStuns then damageMultiplier = damageMultiplier * 1.3 end
     if canSleep then damageMultiplier = damageMultiplier * 1.2 end
     if canSleep and doStuns then damageMultiplier = damageMultiplier * 1.2 end
   end
   end
   --Ensure that if the monster never does a normal attack, the normal max hit is irrelevant
   --Ensure that if the monster never does a normal attack, the normal max hit is irrelevant
Line 337: Line 343:
function p.getMonsterMaxHit(frame)
function p.getMonsterMaxHit(frame)
   local MonsterName = frame.args ~= nil and frame.args[1] or frame
   local MonsterName = frame.args ~= nil and frame.args[1] or frame
  local doStuns = frame.args ~= nil and frame.args[2] or true
   local monster = p.getMonster(MonsterName)
   local monster = p.getMonster(MonsterName)


Line 343: Line 350:
   end
   end


   return p._getMonsterMaxHit(monster)
   return p._getMonsterMaxHit(monster, doStuns)
end
end