Module:Monsters: Difference between revisions

added p.getDungeonTotalHp(), with args = { dungeonName }
(Correct monster GP drops)
(added p.getDungeonTotalHp(), with args = { dungeonName })
Line 475: Line 475:
     if val > max then max = val end
     if val > max then max = val end
     end
     end
     result = max
     result = maxg
   else
   else
     return "ERROR: This monster has an invalid attack type somehow[[Category:Pages with script errors]]"
     return "ERROR: This monster has an invalid attack type somehow[[Category:Pages with script errors]]"
Line 953: Line 953:
   table.insert(returnPart, '\r\n|}')
   table.insert(returnPart, '\r\n|}')
   return table.concat(returnPart)
   return table.concat(returnPart)
end
function p.getDungeonTotalHp(frame)
  local areaName = frame.args ~= nil and frame.args[1] or frame
  local area = Areas.getArea(areaName)
  if area == nil then
    return "ERROR: Could not find a dungeon named "..areaName..'[[Category:Pages with script errors]]'
  end
  local totalHP = 0
  for i, monsterID in pairs(area.monsters) do
    if not Shared.contains(usedMonsters, monsterID) then
      local monster = p.getMonsterByID(monsterID)
      totalHP = totalHP + p._getMonsterHP(monster)
    end
  end
  return totalHP
end
end


892

edits