Anonymous

Module:Constants: Difference between revisions

From Melvor Idle
Added Combat Triangle numbers and getTriangleDamageModifier and getTriangleDRModifier for use in building various other functions in other modules eventually
(Add more modifier types)
(Added Combat Triangle numbers and getTriangleDamageModifier and getTriangleDRModifier for use in building various other functions in other modules eventually)
Line 122: Line 122:
     [5] = 'Elite',
     [5] = 'Elite',
     [6] = 'Insane'}
     [6] = 'Insane'}
--07/03/21: Hardcoding in Combat Triangle Modifiers
local CombatTriangle = {
  damageBonus = 1.1,
  drBonus = 1.25,
  damagePenalty = { Normal = 0.85,
                    Hardcore = 0.75 },
  drPenalty = { Melee = { Normal = 0.5,
                          Hardcore = 0.25 },
                Ranged = { Normal = 0.95,
                          Hardcore = 0.75 },
                Magic = { Normal = 0.85,
                          Hardcore = 0.75 }},
  Melee = { bonus = "Ranged", penalty = "Magic" },
  Ranged = { bonus = "Magic", penalty = "Melee" },
  Magic = { bonus = "Melee", penalty = "Ranged" },
}
function p.getTriangleDamageModifier(playerStyle, enemyStyle, mode)
  if CombatTriangle[playerStyle].bonus == enemyStyle then
    return CombatTriangle.damageBonus
  elseif CombatTriangle[playerStyle].penalty == enemyStyle then
    if mode == 'Hardcore' or mode == 'Adventure' then
      return CombatTriangle.damagePenalty.Hardcore
    else
      return CombatTriangle.damagePenalty.Normal
    end
  else
    return 1
  end
end
--Syntax is like p.getTriangleDRModifier('Melee', 'Ranged', 'Normal')
--Returns a multiplier that can be multiplied with base DR to get the post-Triangle result
function p.getTriangleDRModifier(playerStyle, enemyStyle, mode)
  if CombatTriangle[playerStyle].bonus == enemyStyle then
    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


function p.getDifficultyString(difficulty)
function p.getDifficultyString(difficulty)