Anonymous

Module:Monsters: Difference between revisions

From Melvor Idle
m
getChestDrops: Added punctuation
(Added link to Slayer page from the other monster box section)
m (getChestDrops: Added punctuation)
(3 intermediate revisions by one other user not shown)
Line 300: Line 300:
   local specialMaxHit = 0
   local specialMaxHit = 0
   local normalMaxHit = p._getMonsterBaseMaxHit(monster)
   local normalMaxHit = p._getMonsterBaseMaxHit(monster)
  local hasActiveBuffSpec = false
   if monster.hasSpecialAttack then
   if monster.hasSpecialAttack then
     for i, specID in pairs(monster.specialAttackID) do
     for i, specID in pairs(monster.specialAttackID) do
Line 321: Line 322:
       end
       end
       if thisMax > specialMaxHit then specialMaxHit = thisMax end
       if thisMax > specialMaxHit then specialMaxHit = thisMax end
      if specAttack.activeBuffs then hasActiveBuffSpec = true end
     end
     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
   if normalChance == 0 then normalMaxHit = 0 end
   if normalChance == 0 and not hasActiveBuffSpec then normalMaxHit = 0 end
   return math.max(specialMaxHit, normalMaxHit)
   return math.max(specialMaxHit, normalMaxHit)
end
end
Line 545: Line 547:
       avgGp = (monster.dropCoins[1] + monster.dropCoins[2] - 1) / 2
       avgGp = (monster.dropCoins[1] + monster.dropCoins[2] - 1) / 2
       local gpTxt = Icons.GP(monster.dropCoins[1], monster.dropCoins[2] - 1)
       local gpTxt = Icons.GP(monster.dropCoins[1], monster.dropCoins[2] - 1)
       result = result.."\r\nIn addition to loot, the monster will also drop "..gpTxt
       result = result.."\r\nIn addition to loot, the monster will also drop "..gpTxt..'.'
     end
     end


Line 603: Line 605:
     end
     end
     result = result..'\r\n|}'
     result = result..'\r\n|}'
     result = result..'\r\nThe loot dropped by the average kill is worth '..Icons.GP(Shared.round(lootValue, 2, 0)).." if sold"
     result = result..'\r\nThe loot dropped by the average kill is worth '..Icons.GP(Shared.round(lootValue, 2, 0)).." if sold."
     result = result..'<br/>Including GP, the average kill is worth '..Icons.GP(Shared.round(avgGp + lootValue, 2, 0))
     if avgGp > 0 then
      result = result..'<br/>Including GP, the average kill is worth '..Icons.GP(Shared.round(avgGp + lootValue, 2, 0))..'.'
    end
   end
   end


Line 672: Line 676:
     end
     end
     result = result..'\r\n|}'
     result = result..'\r\n|}'
     result = result..'\r\nThe average value of the contents of one chest is '..Icons.GP(Shared.round(lootValue, 2, 0))
     result = result..'\r\nThe average value of the contents of one chest is '..Icons.GP(Shared.round(lootValue, 2, 0))..'.'
   end
   end