Anonymous

Module:Monsters: Difference between revisions

From Melvor Idle
Adjusted gp drops to v0.18 always dropping coins. Fixed max coins to adjust for dropCoins[2] actually being max-1
(Added passive ability related functions)
(Adjusted gp drops to v0.18 always dropping coins. Fixed max coins to adjust for dropCoins[2] actually being max-1)
Line 457: Line 457:
     local avgGp = 0
     local avgGp = 0


     if monster.dropCoins ~= nil then
     if monster.dropCoins ~= nil and monster.dropCoins[2] > 1 then
       avgGp = (monster.dropCoins[1] + monster.dropCoins[2]) / 2
       avgGp = (monster.dropCoins[1] + monster.dropCoins[2] - 1) / 2
       local gpTxt = Icons.GP(monster.dropCoins[1], monster.dropCoins[2])
       local gpTxt = Icons.GP(monster.dropCoins[1], monster.dropCoins[2] - 1)
       if lootChance == 100 then
       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
      else
        result = result.."\r\nIf loot is received, the monster will also drop "..gpTxt
      end
     end
     end


Line 521: Line 517:
       result = result..'style="text-align:right"|'..lootChance..'.00%'
       result = result..'style="text-align:right"|'..lootChance..'.00%'
     end
     end
    --Account for GP only dropping when other loot is dropped
    avgGp = avgGp * (lootChance * .01)
     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"