3,510
edits
(Added support for abyssal resistance in effective monster HP) |
(Fixed lua error and added functions to get the name of the monster's damage type) |
||
Line 142: | Line 142: | ||
local monster = p.getMonster(MonsterName) | local monster = p.getMonster(MonsterName) | ||
if monster ~= nil then | if monster ~= nil then | ||
if monster.damageType == 'melvorD:Normal' then | if monster.damageType == nil or monster.damageType == 'melvorD:Normal' then | ||
return math.floor((p._getMonsterHP(monster)/(1 - p._getMonsterStat(monster, 'damageReduction')/100)) + 0.5) | return math.floor((p._getMonsterHP(monster)/(1 - p._getMonsterStat(monster, 'damageReduction')/100)) + 0.5) | ||
elseif monster.damageType == 'melvorItA:Abyssal' then | elseif monster.damageType == 'melvorItA:Abyssal' then | ||
Line 202: | Line 202: | ||
return p._getMonsterLevel(monster, SkillName) | return p._getMonsterLevel(monster, SkillName) | ||
end | |||
function p._getMonsterDamageType(monster) | |||
local result = 'Normal Damage' | |||
local damageType = GameData.getEntityByID('damageTypes', monster.damageType) | |||
if damageType ~= nil then | |||
result = damageType.name | |||
end | |||
return result | |||
end | |||
function p.getMonsterDamageType(frame) | |||
local MonsterName = frame.args ~= nil and frame.args[1] or frame | |||
local monster = p.getMonster(MonsterName) | |||
if monster == nil then | |||
return Shared.printError('No monster with that name found') | |||
end | |||
return p._getMonsterDamageType(monster) | |||
end | end | ||