Anonymous

Module:Constants: Difference between revisions

From Melvor Idle
m
Add missing modifier skill
m (Further corrections to RolledReflectDamage)
m (Add missing modifier skill)
(3 intermediate revisions by the same user not shown)
Line 8: Line 8:
--Just hardcoding these because I guess that's where we're at
--Just hardcoding these because I guess that's where we're at
local modifierTypes = {
local modifierTypes = {
["MeleeStrengthBonus"] = { text = "{V}% Melee Strength Bonus", skills = {'Combat'} },
["MeleeStrengthBonus"] = { text = "{V}% Melee Strength Bonus from Equipment", skills = {'Combat'} },
["DamageToDungeonMonsters"] = { text = "{V}% Damage To Dungeon Monsters", skills = {'Combat'} },
["DamageToDungeonMonsters"] = { text = "{V}% Damage To Dungeon Monsters", skills = {'Combat'} },
["GlobalMasteryXP"] = { text = "{V}% Global Mastery XP", skills = {'Woodcutting', 'Fishing', 'Firemaking', 'Cooking', 'Mining', 'Smithing', 'Thieving', 'Farming', 'Fletching', 'Crafting', 'Runecrafting', 'Herblore', 'Agility', 'Summoning', 'Astrology'} },
["GlobalMasteryXP"] = { text = "{V}% Global Mastery XP", skills = {'Woodcutting', 'Fishing', 'Firemaking', 'Cooking', 'Mining', 'Smithing', 'Thieving', 'Farming', 'Fletching', 'Crafting', 'Runecrafting', 'Herblore', 'Agility', 'Summoning', 'Astrology'} },
Line 81: Line 81:
["AttackRolls"] = { text = "+Lucky Hit Chance (Roll twice, take the better result)", skills = {'Combat'} },
["AttackRolls"] = { text = "+Lucky Hit Chance (Roll twice, take the better result)", skills = {'Combat'} },
["AmmoPreservation"] = { text = "{V}% Ammo Preservation", skills = {'Ranged'} },
["AmmoPreservation"] = { text = "{V}% Ammo Preservation", skills = {'Ranged'} },
["RangedStrengthBonus"] = { text = "{V}% Ranged Strength Bonus", skills = {'Combat'} },
["RangedStrengthBonus"] = { text = "{V}% Ranged Strength Bonus from Equipment", skills = {'Combat'} },
["MagicDamageBonus"] = { text = "{V}% Magic Damage Bonus", skills = {'Combat'} },
["MagicDamageBonus"] = { text = "{V}% Magic Damage Bonus from Equipment", skills = {'Combat'} },
["MasteryXP"] = { text = "{V}% {SV0} Mastery XP" },
["MasteryXP"] = { text = "{V}% {SV0} Mastery XP" },
["dungeonEquipmentSwapping"] = { text = "{V} Dungeon Equipment Swapping", skills = {'Combat'} },
["dungeonEquipmentSwapping"] = { text = "{V} Dungeon Equipment Swapping", skills = {'Combat'} },
Line 122: Line 122:
["summoningSynergy_3_11"] = {text = "When successfully pickpocketing the Lumberjack in Thieving, grants {V} Bird Nest instead of GP.", skills = {'Thieving'}},
["summoningSynergy_3_11"] = {text = "When successfully pickpocketing the Lumberjack in Thieving, grants {V} Bird Nest instead of GP.", skills = {'Thieving'}},
["summoningSynergy_3_16"] = {text = "In Woodcutting, {V}% chance for a random Silver or Gold Jewelry to drop instead of a Bird Nest.", skills = {'Woodcutting'}},
["summoningSynergy_3_16"] = {text = "In Woodcutting, {V}% chance for a random Silver or Gold Jewelry to drop instead of a Bird Nest.", skills = {'Woodcutting'}},
["summoningSynergy_3_17"] = {text = "{V}% chance to gain +1 Base Logs from Woodcutting, or produced Items from Smithing.", skills = {'Woodcutting'}},
["summoningSynergy_3_17"] = {text = "{V}% chance to gain +1 Base Logs from Woodcutting, or produced Items from Smithing.", skills = {'Woodcutting', 'Smithing'}},
["summoningSynergy_3_18"] = {text = "While the Bird Nest Potion is active in Woodcutting, grants {V} minimum Bird Nest.", skills = {'Woodcutting'}},
["summoningSynergy_3_18"] = {text = "While the Bird Nest Potion is active in Woodcutting, grants {V} minimum Bird Nest.", skills = {'Woodcutting'}},
["summoningSynergy_3_19"] = {text = "{V}% of Woodcutting Skill XP is earned as Firemaking Skill XP. Chance to double Logs is halved.", skills = {'Woodcutting', 'Firemaking'}},
["summoningSynergy_3_19"] = {text = "{V}% of Woodcutting Skill XP is earned as Firemaking Skill XP. Chance to double Logs is halved.", skills = {'Woodcutting', 'Firemaking'}},
Line 298: Line 298:
["frostBurnImmunity"] = { text = "{V}% chance to ignore Frostburn", skills = {'Combat'} },
["frostBurnImmunity"] = { text = "{V}% chance to ignore Frostburn", skills = {'Combat'} },
["globalEvasionHPScaling"] = { text = "Evasion Ratings are multiplied by {V} times current Hitpoints percent", skills = {'Combat'} },
["globalEvasionHPScaling"] = { text = "Evasion Ratings are multiplied by {V} times current Hitpoints percent", skills = {'Combat'} },
["GPFromFiremaking"] = { text = "{V}% GP from Firemaking.", skills = {'Firemaking'} },
["infiniteLootContainer"] = { text = "The loot container has an infinite amount of slots", skills = {'Combat'} },
["infiniteLootContainer"] = { text = "The loot container has an infinite amount of slots", skills = {'Combat'} },
["magicImmunity"] = { text = "Immune to Magic attacks", skills = {'Combat'} },
["magicImmunity"] = { text = "Immune to Magic attacks", skills = {'Combat'} },
Line 330: Line 331:
[6] = 'Insane'}
[6] = 'Insane'}


--07/03/21: Hardcoding in Combat Triangle Modifiers
function p.getTriangleAttribute(attribute, attackerStyle, targetStyle, mode)
local CombatTriangle = {
if type(attribute) ~= 'string' then
damageBonus = 1.1,  
error("Parameter 'attribute' must be a string", 2)
drBonus = 1.25,
elseif type(attackerStyle) ~= 'string' then
damagePenalty = { Normal = 0.85,
error("Parameter 'attackerStyle' must be a string", 2)
Hardcore = 0.75 },
elseif type(targetStyle) ~= 'string' then
drPenalty = { Melee = { Normal = 0.5,
error("Parameter 'targetStyle' must be a string", 2)
Hardcore = 0.25 },
elseif type(mode) ~= 'string' then
Ranged = { Normal = 0.95,
error("Parameter 'mode' must be a string", 2)
Hardcore = 0.75 },
end
Magic = { Normal = 0.85,
Hardcore = 0.75 }},
local modeID = p.getGamemodeID(mode)
Melee = { bonus = "Ranged", penalty = "Magic" },
if modeID == nil then
Ranged = { bonus = "Magic", penalty = "Melee" },
error("Invalid gamemode '" .. mode .. "'", 2)
Magic = { bonus = "Melee", penalty = "Ranged" },
end
}
 
local attStyle, targStyle = string.lower(attackerStyle), string.lower(targetStyle)
function p.getTriangleDamageModifier(playerStyle, enemyStyle, mode)
local validStyles = { 'magic', 'melee', 'ranged' }
if CombatTriangle[playerStyle].bonus == enemyStyle then
if not Shared.contains(validStyles, string.lower(attStyle)) then
return CombatTriangle.damageBonus
error("Invalid value for parameter 'attackerStyle'", 2)
elseif CombatTriangle[playerStyle].penalty == enemyStyle then
elseif not Shared.contains(validStyles, string.lower(targStyle)) then
if mode == 'Hardcore' or mode == 'Adventure' then
error("Invalid value for parameter 'targetStyle'", 2)
return CombatTriangle.damagePenalty.Hardcore
end
else
return CombatTriangle.damagePenalty.Normal
local triangleID = ConstantData.Gamemode.Data[modeID + 1].combatTriangle
end
local attrData = ConstantData.CombatTriangle[triangleID + 1][attribute]
if attrData == nil then
error("No such attribute: " .. attribute)
else
else
return 1
return attrData[attStyle][targStyle]
end
end
end
function p.getTriangleDamageModifier(attackerStyle, targetStyle, mode)
return p.getTriangleAttribute('damageModifier', attackerStyle, targetStyle, mode)
end
end


--Syntax is like p.getTriangleDRModifier('Melee', 'Ranged', 'Normal')
--Syntax is like p.getTriangleDRModifier('Melee', 'Ranged', 'Normal')
--Returns a multiplier that can be multiplied with base DR to get the post-Triangle result
--Returns a multiplier that can be multiplied with base DR to get the post-Triangle result
function p.getTriangleDRModifier(playerStyle, enemyStyle, mode)
function p.getTriangleDRModifier(attackerStyle, targetStyle, mode)
if CombatTriangle[playerStyle].bonus == enemyStyle then
return p.getTriangleAttribute('reductionModifier', attackerStyle, targetStyle, mode)
return CombatTriangle.drBonus
elseif CombatTriangle[playerStyle].penalty == enemyStyle then
if mode == 'Hardcore' or mode == 'Adventure' then
return CombatTriangle.drPenalty[playerStyle].Hardcore
else
return CombatTriangle.drPenalty[playerStyle].Normal
end
else
return 1
end
end
end


Line 395: Line 392:
function p.getEquipmentSlotID(name)
function p.getEquipmentSlotID(name)
return ConstantData.equipmentSlot[name]
return ConstantData.equipmentSlot[name]
end
function p.getGamemodeName(id)
return ConstantData.Gamemode.Enum[id]
end
function p.getGamemodeID(name)
return ConstantData.Gamemode.Enum[name]
end
end