Skip to content

Some Vanilla

Michael Cook (mackal) edited this page Jan 11, 2018 · 1 revision

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

if GetClass() == MONK:
  weight = GetWeight()
  if weight < 29:
    weight_bonus = float(level + 5)
    if weight > 14:
      temp_mod = min(float(weight - 14) * 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 > 31:
    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 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() and bonus > 350:
  bonus = 350

return bonus

Accuracy

compute tohit (accuracy)

# skill is the skill of the attack
bonus = GetSkill(SkillOffense) + 7
if IHaveSkill(skill):
  bonus = bonus + GetSkill(skill)
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)