Module:Monsters: Difference between revisions

Added p._getMonsterBarrier
m (getMonsterName: Fix special case)
(Added p._getMonsterBarrier)
Line 53: Line 53:


function p._getMonsterStat(monster, statName)
function p._getMonsterStat(monster, statName)
if statName == 'HP' then
if statName == 'Barrier' then
return p._getMonsterBarrier(monster)
elseif statName == 'HP' then
return p._getMonsterHP(monster)
return p._getMonsterHP(monster)
elseif statName == 'maxHit' then
elseif statName == 'maxHit' then
Line 120: Line 122:
function p._getMonsterHP(monster)
function p._getMonsterHP(monster)
return 10 * p._getMonsterLevel(monster, 'Hitpoints')
return 10 * p._getMonsterLevel(monster, 'Hitpoints')
end
function p._getMonsterBarrier(monster)
--Monster Barrier is a percentage of its max health
local barPercent = 0
if monster.barrierPercent ~= nil then
barPercent = monster.barrierPercent
end
return p._getMonsterHP(monster) * barPercent * 0.01
end
end