4,951
edits
Falterfire (talk | contribs) (fixed passives inexplicably having percentages attached) |
Falterfire (talk | contribs) (made p.getMonsterLevel accessible to templates and added damageReduction to monster stats) |
||
Line 66: | Line 66: | ||
elseif statName == 'magicEvasionRating' then | elseif statName == 'magicEvasionRating' then | ||
return p._getMonsterER(monster, 'Magic') | return p._getMonsterER(monster, 'Magic') | ||
elseif statName == 'damageReduction' then | |||
return p.getEquipmentStat(monster, 'damageReduction') | |||
end | end | ||
Line 114: | Line 116: | ||
function p._getMonsterHP(monster) | function p._getMonsterHP(monster) | ||
return 10 * p. | return 10 * p._getMonsterLevel(monster, 'Hitpoints') | ||
end | end | ||
Line 127: | Line 129: | ||
end | end | ||
function p. | function p._getMonsterLevel(monster, skillName) | ||
local result = 0 | local result = 0 | ||
if monster.levels[skillName] ~= nil then | if monster.levels[skillName] ~= nil then | ||
Line 133: | Line 135: | ||
end | end | ||
return result | return result | ||
end | |||
function p.getMonsterLevel(frame) | |||
local MonsterName = frame.args ~= nil and frame.args[1] or frame[1] | |||
local SkillName = frame.args ~= nil and frame.args[2] or frame[2] | |||
local monster = p.getMonster(MonsterName) | |||
if monster == nil then | |||
return "ERROR: No monster with that name found[[Category:Pages with script errors]]" | |||
end | |||
return p._getMonsterLevel(monster, SkillName) | |||
end | end | ||
Line 172: | Line 186: | ||
function p._getMonsterCombatLevel(monster) | function p._getMonsterCombatLevel(monster) | ||
local base = 0.25 * (p. | local base = 0.25 * (p._getMonsterLevel(monster, 'Defence') + p._getMonsterLevel(monster, 'Hitpoints')) | ||
local melee = 0.325 * (p. | local melee = 0.325 * (p._getMonsterLevel(monster, 'Attack') + p._getMonsterLevel(monster, 'Strength')) | ||
local range = 0.325 * (1.5 * p. | local range = 0.325 * (1.5 * p._getMonsterLevel(monster, 'Ranged')) | ||
local magic = 0.325 * (1.5 * p. | local magic = 0.325 * (1.5 * p._getMonsterLevel(monster, 'Magic')) | ||
if melee > range and melee > magic then | if melee > range and melee > magic then | ||
return math.floor(base + melee) | return math.floor(base + melee) | ||
Line 200: | Line 214: | ||
local bonus = 0 | local bonus = 0 | ||
if monster.attackType == 'melee' then | if monster.attackType == 'melee' then | ||
baseLevel = p. | baseLevel = p._getMonsterLevel(monster, 'Attack') | ||
bonus = p.getEquipmentStat(monster, 'stabAttackBonus') | bonus = p.getEquipmentStat(monster, 'stabAttackBonus') | ||
elseif monster.attackType == 'ranged' then | elseif monster.attackType == 'ranged' then | ||
baseLevel = p. | baseLevel = p._getMonsterLevel(monster, 'Ranged') | ||
bonus = p.getEquipmentStat(monster, 'rangedAttackBonus') | bonus = p.getEquipmentStat(monster, 'rangedAttackBonus') | ||
elseif monster.attackType == 'magic' then | elseif monster.attackType == 'magic' then | ||
baseLevel = p. | baseLevel = p._getMonsterLevel(monster, 'Magic') | ||
bonus = p.getEquipmentStat(monster, 'magicAttackBonus') | bonus = p.getEquipmentStat(monster, 'magicAttackBonus') | ||
else | else | ||
Line 231: | Line 245: | ||
if style == "Melee" then | if style == "Melee" then | ||
baseLevel = p. | baseLevel = p._getMonsterLevel(monster, 'Defence') | ||
bonus = p.getEquipmentStat(monster, 'meleeDefenceBonus') | bonus = p.getEquipmentStat(monster, 'meleeDefenceBonus') | ||
elseif style == "Ranged" then | elseif style == "Ranged" then | ||
baseLevel = p. | baseLevel = p._getMonsterLevel(monster, 'Defence') | ||
bonus = p.getEquipmentStat(monster, 'rangedDefenceBonus') | bonus = p.getEquipmentStat(monster, 'rangedDefenceBonus') | ||
elseif style == "Magic" then | elseif style == "Magic" then | ||
baseLevel = math.floor(p. | baseLevel = math.floor(p._getMonsterLevel(monster, 'Magic') * 0.7 + p._getMonsterLevel(monster, 'Defence') * 0.3) | ||
bonus = p.getEquipmentStat(monster, 'magicDefenceBonus') | bonus = p.getEquipmentStat(monster, 'magicDefenceBonus') | ||
else | else | ||
Line 403: | Line 417: | ||
local result = 0 | local result = 0 | ||
if monster.attackType == 'melee' then | if monster.attackType == 'melee' then | ||
local baseLevel = p. | local baseLevel = p._getMonsterLevel(monster, 'Strength') | ||
local bonus = p.getEquipmentStat(monster, 'meleeStrengthBonus') | local bonus = p.getEquipmentStat(monster, 'meleeStrengthBonus') | ||
result = p.calculateStandardMaxHit(baseLevel, bonus) | result = p.calculateStandardMaxHit(baseLevel, bonus) | ||
elseif monster.attackType == 'ranged' then | elseif monster.attackType == 'ranged' then | ||
local baseLevel = p. | local baseLevel = p._getMonsterLevel(monster, 'Ranged') | ||
local bonus = p.getEquipmentStat(monster, 'rangedStrengthBonus') | local bonus = p.getEquipmentStat(monster, 'rangedStrengthBonus') | ||
result = p.calculateStandardMaxHit(baseLevel, bonus) | result = p.calculateStandardMaxHit(baseLevel, bonus) | ||
Line 415: | Line 429: | ||
local bonus = p.getEquipmentStat(monster, 'magicDamageBonus') | local bonus = p.getEquipmentStat(monster, 'magicDamageBonus') | ||
local baseLevel = p. | local baseLevel = p._getMonsterLevel(monster, 'Magic') | ||
result = math.floor(10 * mSpell.maxHit * (1 + bonus / 100) * (1 + (baseLevel + 1) / 200)) | result = math.floor(10 * mSpell.maxHit * (1 + bonus / 100) * (1 + (baseLevel + 1) / 200)) |