Anonymous

Module:Monsters: Difference between revisions

From Melvor Idle
_isDungeonOnlyMonster: Optimise
(Fixed decimal issue with monster drops)
(_isDungeonOnlyMonster: Optimise)
Line 294: Line 294:
function p._isDungeonOnlyMonster(monster)
function p._isDungeonOnlyMonster(monster)
   local areaList = Areas.getMonsterAreas(monster.id)
   local areaList = Areas.getMonsterAreas(monster.id)
   local dunCount = 0
   local inDungeon = false
  local nonDunCount = 0


   for i, area in Shared.skpairs(areaList) do
   for i, area in ipairs(areaList) do
    if area.type == 'dungeon' then
  if area.type == 'dungeon' then
      dunCount = dunCount + 1
    inDungeon = true
    else
  else
      nonDunCount = nonDunCount + 1
    return false
    end
  end
   end
   end
   return dunCount > 0 and nonDunCount == 0
   return inDungeon
end
end