Skip to content

Mid Velious

Michael Cook (mackal) edited this page Dec 23, 2017 · 3 revisions

Note: throughout we will use EQEmu's definition of ItemType and ItemClass, which are of course opposite of MQ2!

Avoidance

defense agility bonus (called by the compute function)

if GetAGI() < 40: # penalty
  return (25 * (GetAGI() - 40)) / 40

if GetAGI() <= 60:
  return 0

if GetAGI() <= 74:
  bonus = 28 - (200 - GetAGI()) / 5
  return 2 * bonus / 3

# so 75+
bonus = max(200 - GetAGI(), 0)
if GetLevel() >= 40:
  bonus = 80 - bonus / 5
elif GetLevel() >= 20:
  bonus = 70 - bonus / 5
elif GetLevel() >= 7:
  bonus = 55 - bonus / 5
else:
  bonus = 35 - bonus / 5
return 2 * bonus / 3

compute defense (avoidance)

skill = max(GetSkill(SkillDefense), 0)
bonus = 400 * skill / 225 + defense_agility_bonus()

if IsClient():
  drunk = float(GetIntoxication() / 2)
  if drunk > 20.0:
    redux = min((110.0 - drunk) * 0.01, 1.0)
    bonus = int(bonus * redux)

return max(bonus, 1)

Mitigation

ac

item_ac = 0
for slot in range(0, 21): # slots 0 - 20
  item = GetItemPossession(slot)
  if item.IsValid and item.GetItemClass() == ItemClassCommon:
    item_ac = item_ac + item.GetItemAC()

if not IsMage(): # silkies
  bonus = 4 * item_ac / 3

if IsClient() and bonus > 6 * GetLevel() + 25:
  bonus = 6 * GetLevel() + 25

weight_hardcap = 30
weight_softcap = 14

if GetLevel() > 59:
  weight_hardcap = 45
  weight_softcap = 24
elif GetLevel() > 54:
  weight_hardcap = 40
  weight_softcap = 20
elif GetLevel() > 50:
  weight_hardcap = 38
  weight_softcap = 18
elif GetLevel() > 44:
  weight_hardcap = 36
  weight_softcap = 17
elif GetLevel() > 29:
  weight_hardcap = 34
  weight_softcap = 16
elif GetLevel() > 14:
  weight_hardcap = 32
  weight_softcap = 15

if GetClass() == MONK:
  weight = GetWeight()
  if weight < weight_hardcap - 1:
    weight_bonus = float(level + 5)
    if weight > weight_softcap:
      temp_mod = min(float(weight - weight_softcap) * 6.66667, 100.0)
      weight_bonus = max(0.0, weight_bonus * ((100.0 - temp_mod) * 0.01))
    bonus = bonus + int(weight_bonus * 11.0 * 0.1)

if bonus < 0:
  bonus = 0

if GetClass() == MONK:
  weight = GetWeight()
  if weight > weight_hardcap + 1:
    weight_penalty = level + 5
    temp_mod = min(1.0, (float(weight) - 20.0) * 0.01)
    bonus = bonus - int(temp_mod)

if GetClass() == ROGUE:
  agi = GetAGI()
  if agi > 75 and GetLevel() > 29:
    LevelScaler = GetLevel() - 26
    if agi >= 100:
      LevelScaler = LevelScaler * 5
    elif agi >= 90:
      LevelScaler = LevelScaler * 4
    elif agi >= 85:
      LevelScaler = LevelScaler * 3
    elif agi >= 80:
      LevelScaler = LevelScaler * 2
    tmp_bonus = LevelScaler / 4
    bonus = bonus + min(12, tmp_bonus)

if GetClass() == BEASTLORD:
  agi = GetAGI()
  if agi > 75 and GetLevel() > 10:
    LevelScaler = GetLevel() - 6
    if agi >= 100:
      LevelScaler = LevelScaler * 5
    elif agi >= 90:
      LevelScaler = LevelScaler * 4
    elif agi >= 85:
      LevelScaler = LevelScaler * 3
    elif agi >= 80:
      LevelScaler = LevelScaler * 2
    tmp_bonus = LevelScaler / 5
    bonus = bonus + min(16, tmp_bonus)

  if GetRace() == IKSAR:
    bonus = bonus + min(35, max(10, GetLevel()) # level clamped to 10 and 35

if IsMage():
  bonus = bonus + GetSkill(SkillDefense) / 2
else:
  bonus = bonus + GetSkill(SkillDefense) / 3

if GetAGI() > 70:
  bonus = bonus + GetAGI() / 20

if IsMage():
  bonus = bonus + TotalEffect(SPA_AC) / 3 # TotalEffect in Kunark sums from buffs and worn effects
else:
  bonus = bonus + TotalEffect(SPA_AC) / 4 # TotalEffect in Kunark sums from buffs and worn effects

if bonus < 0:
  bonus = 0

if IsClient():
  hardcap = 350
  if GetClass() == WARRIOR and GetLevel() > 50:
    hardcap = 430
  if (GetClass() == PALADIN or GetClass() == SHADOWKNIGHT or GetClass() == BARD) and GetLevel() > 50
    hardcap = 403
  if (GetClass() == RANGER or GetClass() == ROGUE or GetClass() == MONK or GetClass() == BEASTLORD) and GetLevel() > 50
    hardcap = 375
  if bonus > hardcap:
    bonus = hardcap

return bonus

Accuracy

compute tohit (accuracy)

# skill is the skill of the attack
bonus = GetSkill(SkillOffense) + 7
if IHaveSkill(skill):
  bonus = bonus + GetSkill(SkillOffense)
if IsClient():
  drunk = float(GetIntoxication() / 2)
  if drunk > 20.0:
    redux = min((110.0 - drunk) * 0.01, 1.0)
    bonus = int(bonus * redux)
  elif IsBerserk():
    bonus = bonus + (2 * GetLevel() / 5)

return max(bonus, 1)

Attack Power (rolled against mitigation)

Offense

# skill is the skill of the attack
bonus = 0
if skill == -1:
  item = GetItemPossession(SlotPrimary)
  if not item.IsValid() or item.GetItemClass() != ItemClassCommon:
    skill = SkillHandToHand
  else:
    skill = SkillUsed(item.GetItemType())

if IHaveSkill(skill):
  bonus = GetSkill(skill)

stat_bonus = 0
if skill == SkillArchery or skill == SkillThrowing:
  stat_bonus = GetDEX()
else:
  stat_bonus = GetSTR()

if stat_bonus >= 75:
  bonus = bonus + ((2 * stat_bonus - 150) / 3)

bonus = bonus + TotalEffect(SPA_Attack)

return max(bonus, 1)
Clone this wiki locally