mirror of
https://github.com/EQEmu/Server.git
synced 2026-04-12 14:02:26 +00:00
Update legacy_combat.lua to be more accurate, better logging
This commit is contained in:
parent
69d887b421
commit
61d1c2d75c
@ -1,3 +1,13 @@
|
|||||||
|
--[[
|
||||||
|
*
|
||||||
|
* The purpose of this lua file is to backport combat formulas pre-overhaul
|
||||||
|
* https://github.com/EQEmu/Server/commit/9e824876ba5dac262b121c0e60d022bb2ecc45bd
|
||||||
|
*
|
||||||
|
* If your server has years and years of content built on old formulas, it may be appropriate to use this
|
||||||
|
* instead of taking on the massive task of rescaling tons of carefully tested and layered content
|
||||||
|
*
|
||||||
|
]]
|
||||||
|
|
||||||
MonkACBonusWeight = RuleI.Get(Rule.MonkACBonusWeight);
|
MonkACBonusWeight = RuleI.Get(Rule.MonkACBonusWeight);
|
||||||
NPCACFactor = RuleR.Get(Rule.NPCACFactor);
|
NPCACFactor = RuleR.Get(Rule.NPCACFactor);
|
||||||
OldACSoftcapRules = RuleB.Get(Rule.OldACSoftcapRules);
|
OldACSoftcapRules = RuleB.Get(Rule.OldACSoftcapRules);
|
||||||
@ -6,7 +16,6 @@ LeatherACSoftcap = RuleI.Get(Rule.LeatherACSoftcap);
|
|||||||
MonkACSoftcap = RuleI.Get(Rule.MonkACSoftcap);
|
MonkACSoftcap = RuleI.Get(Rule.MonkACSoftcap);
|
||||||
ChainACSoftcap = RuleI.Get(Rule.ChainACSoftcap);
|
ChainACSoftcap = RuleI.Get(Rule.ChainACSoftcap);
|
||||||
PlateACSoftcap = RuleI.Get(Rule.PlateACSoftcap);
|
PlateACSoftcap = RuleI.Get(Rule.PlateACSoftcap);
|
||||||
|
|
||||||
AAMitigationACFactor = RuleR.Get(Rule.AAMitigationACFactor);
|
AAMitigationACFactor = RuleR.Get(Rule.AAMitigationACFactor);
|
||||||
WarriorACSoftcapReturn = RuleR.Get(Rule.WarriorACSoftcapReturn);
|
WarriorACSoftcapReturn = RuleR.Get(Rule.WarriorACSoftcapReturn);
|
||||||
KnightACSoftcapReturn = RuleR.Get(Rule.KnightACSoftcapReturn);
|
KnightACSoftcapReturn = RuleR.Get(Rule.KnightACSoftcapReturn);
|
||||||
@ -22,15 +31,6 @@ RogShmBstBerACSoftcapReturn = RuleR.Get(Rule.RogShmBstBerACSoftcapReturn);
|
|||||||
SoftcapFactor = RuleR.Get(Rule.SoftcapFactor);
|
SoftcapFactor = RuleR.Get(Rule.SoftcapFactor);
|
||||||
ACthac0Factor = RuleR.Get(Rule.ACthac0Factor);
|
ACthac0Factor = RuleR.Get(Rule.ACthac0Factor);
|
||||||
ACthac20Factor = RuleR.Get(Rule.ACthac20Factor);
|
ACthac20Factor = RuleR.Get(Rule.ACthac20Factor);
|
||||||
|
|
||||||
MeleeBaseCritChance = 0.0;
|
|
||||||
ClientBaseCritChance = 0.0;
|
|
||||||
BerserkBaseCritChance = 6.0;
|
|
||||||
WarBerBaseCritChance = 3.0;
|
|
||||||
RogueCritThrowingChance = 25;
|
|
||||||
RogueDeadlyStrikeChance = 80;
|
|
||||||
RogueDeadlyStrikeMod = 2;
|
|
||||||
|
|
||||||
BaseHitChance = RuleR.Get(Rule.BaseHitChance);
|
BaseHitChance = RuleR.Get(Rule.BaseHitChance);
|
||||||
NPCBonusHitChance = RuleR.Get(Rule.NPCBonusHitChance);
|
NPCBonusHitChance = RuleR.Get(Rule.NPCBonusHitChance);
|
||||||
HitFalloffMinor = RuleR.Get(Rule.HitFalloffMinor);
|
HitFalloffMinor = RuleR.Get(Rule.HitFalloffMinor);
|
||||||
@ -41,9 +41,26 @@ AgiHitFactor = RuleR.Get(Rule.AgiHitFactor);
|
|||||||
WeaponSkillFalloff = RuleR.Get(Rule.WeaponSkillFalloff);
|
WeaponSkillFalloff = RuleR.Get(Rule.WeaponSkillFalloff);
|
||||||
ArcheryHitPenalty = RuleR.Get(Rule.ArcheryHitPenalty);
|
ArcheryHitPenalty = RuleR.Get(Rule.ArcheryHitPenalty);
|
||||||
UseOldDamageIntervalRules = RuleB.Get(Rule.UseOldDamageIntervalRules);
|
UseOldDamageIntervalRules = RuleB.Get(Rule.UseOldDamageIntervalRules);
|
||||||
|
|
||||||
CriticalMessageRange = RuleI.Get(Rule.CriticalDamage);
|
CriticalMessageRange = RuleI.Get(Rule.CriticalDamage);
|
||||||
|
|
||||||
|
--[[
|
||||||
|
*
|
||||||
|
* These are rule values that were removed in the latest combat overhaul, if you are coming from
|
||||||
|
* older source code, you will need to reference what your rule values were for these variables
|
||||||
|
* to make sure that things line up correctly
|
||||||
|
*
|
||||||
|
]]
|
||||||
|
|
||||||
|
MeleeBaseCritChance = 0.0;
|
||||||
|
ClientBaseCritChance = 0.0;
|
||||||
|
BerserkBaseCritChance = 6.0;
|
||||||
|
WarBerBaseCritChance = 3.0;
|
||||||
|
RogueCritThrowingChance = 25;
|
||||||
|
RogueDeadlyStrikeChance = 80;
|
||||||
|
RogueDeadlyStrikeMod = 2;
|
||||||
|
|
||||||
|
-- Source Function: Mob::MeleeMitigation()
|
||||||
|
-- Partial: Rest happens in DoMeleeMitigation
|
||||||
function MeleeMitigation(e)
|
function MeleeMitigation(e)
|
||||||
e.IgnoreDefault = true;
|
e.IgnoreDefault = true;
|
||||||
|
|
||||||
@ -51,11 +68,31 @@ function MeleeMitigation(e)
|
|||||||
return e;
|
return e;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
eq.log_combat(
|
||||||
|
string.format("[%s] [ClientAttack] Damage Table [%i] WeaponDMG [%i]",
|
||||||
|
e.self:GetCleanName(),
|
||||||
|
GetDamageTable(e.other, e.hit.skill),
|
||||||
|
e.hit.base_damage
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
e.hit.damage_done = 2 * e.hit.base_damage * GetDamageTable(e.other, e.hit.skill) / 100;
|
e.hit.damage_done = 2 * e.hit.base_damage * GetDamageTable(e.other, e.hit.skill) / 100;
|
||||||
|
|
||||||
|
eq.log_combat(
|
||||||
|
string.format("[%s] [ClientAttack] DamageDone [%i] BaseDamage [%i] HitSkill [%i]",
|
||||||
|
e.self:GetCleanName(),
|
||||||
|
e.hit.damage_done,
|
||||||
|
e.hit.base_damage,
|
||||||
|
e.hit.skill
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
e.hit = DoMeleeMitigation(e.self, e.other, e.hit, e.opts);
|
e.hit = DoMeleeMitigation(e.self, e.other, e.hit, e.opts);
|
||||||
|
|
||||||
return e;
|
return e;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Source Function: Mob::CheckHitChance()
|
||||||
function CheckHitChance(e)
|
function CheckHitChance(e)
|
||||||
e.IgnoreDefault = true;
|
e.IgnoreDefault = true;
|
||||||
|
|
||||||
@ -194,6 +231,16 @@ function CheckHitChance(e)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local tohit_roll = Random.Real(0, 100);
|
local tohit_roll = Random.Real(0, 100);
|
||||||
|
|
||||||
|
eq.log_combat(
|
||||||
|
string.format("[%s] [Mob::CheckHitChance] Chance [%i] ToHitRoll [%i] Hit? [%s]",
|
||||||
|
e.self:GetCleanName(),
|
||||||
|
chancetohit,
|
||||||
|
tohit_roll,
|
||||||
|
(tohit_roll <= chancetohit) and "true" or "false"
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
if (tohit_roll <= chancetohit) then
|
if (tohit_roll <= chancetohit) then
|
||||||
e.ReturnValue = true;
|
e.ReturnValue = true;
|
||||||
else
|
else
|
||||||
@ -203,6 +250,7 @@ function CheckHitChance(e)
|
|||||||
return e;
|
return e;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Source Function: Mob::TryCriticalHit()
|
||||||
function TryCriticalHit(e)
|
function TryCriticalHit(e)
|
||||||
e.IgnoreDefault = true;
|
e.IgnoreDefault = true;
|
||||||
|
|
||||||
@ -295,6 +343,15 @@ function TryCriticalHit(e)
|
|||||||
critChance = critChance + opts.crit_flat;
|
critChance = critChance + opts.crit_flat;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
eq.log_combat(
|
||||||
|
string.format("[%s] [Mob::TryCriticalHit] CritChance [%i] CritChanceBonus [%i] Dex [%i] Post-Dex-Block",
|
||||||
|
e.self:GetCleanName(),
|
||||||
|
critChance,
|
||||||
|
CritChanceBonus,
|
||||||
|
e.self:GetDEX()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
if (critChance > 0) then
|
if (critChance > 0) then
|
||||||
|
|
||||||
critChance = critChance / 100;
|
critChance = critChance / 100;
|
||||||
@ -316,6 +373,17 @@ function TryCriticalHit(e)
|
|||||||
end
|
end
|
||||||
|
|
||||||
critMod = critMod + GetCritDmgMod(self, e.hit.skill) * 2;
|
critMod = critMod + GetCritDmgMod(self, e.hit.skill) * 2;
|
||||||
|
|
||||||
|
eq.log_combat(
|
||||||
|
string.format("[%s] [Mob::TryCriticalHit] CritChance [%i] CritMod [%i] GetCritDmgMod [%i] CripSuccess [%s]",
|
||||||
|
e.self:GetCleanName(),
|
||||||
|
critChance,
|
||||||
|
critMod,
|
||||||
|
GetCritDmgMod(self, e.hit.skill),
|
||||||
|
(crip_success) and "true" or "false"
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
e.hit.damage_done = e.hit.damage_done * critMod / 100;
|
e.hit.damage_done = e.hit.damage_done * critMod / 100;
|
||||||
|
|
||||||
local deadlySuccess = false;
|
local deadlySuccess = false;
|
||||||
@ -343,6 +411,7 @@ function TryCriticalHit(e)
|
|||||||
return e;
|
return e;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Source Function: Mob::TryPetCriticalHit()
|
||||||
function TryPetCriticalHit(self, defender, hit)
|
function TryPetCriticalHit(self, defender, hit)
|
||||||
if (hit.damage_done < 1) then
|
if (hit.damage_done < 1) then
|
||||||
return hit;
|
return hit;
|
||||||
@ -368,9 +437,28 @@ function TryPetCriticalHit(self, defender, hit)
|
|||||||
local CritPetChance = owner:GetAABonuses():PetCriticalHit() + owner:GetItemBonuses():PetCriticalHit() + owner:GetSpellBonuses():PetCriticalHit();
|
local CritPetChance = owner:GetAABonuses():PetCriticalHit() + owner:GetItemBonuses():PetCriticalHit() + owner:GetSpellBonuses():PetCriticalHit();
|
||||||
local CritChanceBonus = GetCriticalChanceBonus(self, hit.skill);
|
local CritChanceBonus = GetCriticalChanceBonus(self, hit.skill);
|
||||||
|
|
||||||
|
eq.log_combat(
|
||||||
|
string.format("[%s] [Mob::TryPetCriticalHit] CritPetChance [%i] CritChanceBonus [%i] | Bonuses AA [%i] Item [%i] Spell [%i]",
|
||||||
|
e.self:GetCleanName(),
|
||||||
|
CritPetChance,
|
||||||
|
CritChanceBonus,
|
||||||
|
owner:GetAABonuses():PetCriticalHit(),
|
||||||
|
owner:GetItemBonuses():PetCriticalHit(),
|
||||||
|
owner:GetSpellBonuses():PetCriticalHit()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
if (CritPetChance or critChance) then
|
if (CritPetChance or critChance) then
|
||||||
critChance = critChance + CritPetChance;
|
critChance = critChance + CritPetChance;
|
||||||
critChance = critChance + (critChance * CritChanceBonus / 100.0);
|
critChance = critChance + (critChance * CritChanceBonus / 100.0);
|
||||||
|
|
||||||
|
eq.log_combat(
|
||||||
|
string.format("[%s] [Mob::TryPetCriticalHit] critChance [%i] PostCalcs",
|
||||||
|
e.self:GetCleanName(),
|
||||||
|
critChance
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if (critChance > 0) then
|
if (critChance > 0) then
|
||||||
@ -380,15 +468,31 @@ function TryPetCriticalHit(self, defender, hit)
|
|||||||
local entity_list = eq.get_entity_list();
|
local entity_list = eq.get_entity_list();
|
||||||
critMod = critMod + GetCritDmgMod(self, hit.skill) * 2;
|
critMod = critMod + GetCritDmgMod(self, hit.skill) * 2;
|
||||||
hit.damage_done = (hit.damage_done * critMod) / 100;
|
hit.damage_done = (hit.damage_done * critMod) / 100;
|
||||||
entity_list:FilteredMessageClose(this, false, CriticalMessageRange,
|
|
||||||
MT.CritMelee, Filter.MeleeCrits, string.format('%s scores a critical hit! (%d)',
|
eq.log_combat(
|
||||||
self:GetCleanName(), e.hit.damage_done));
|
string.format("[%s] [Mob::TryPetCriticalHit] critMod [%i] DmgMod [%i] DamageDone [%i]",
|
||||||
|
e.self:GetCleanName(),
|
||||||
|
critMod,
|
||||||
|
GetCritDmgMod(self, hit.skill),
|
||||||
|
hit.damage_done
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
entity_list:FilteredMessageClose(
|
||||||
|
this,
|
||||||
|
false,
|
||||||
|
CriticalMessageRange,
|
||||||
|
MT.CritMelee,
|
||||||
|
Filter.MeleeCrits,
|
||||||
|
string.format('%s scores a critical hit! (%d)', self:GetCleanName(), e.hit.damage_done)
|
||||||
|
);
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return hit;
|
return hit;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Source Function: Mob::GetCriticalChanceBonus()
|
||||||
function GetCriticalChanceBonus(self, skill)
|
function GetCriticalChanceBonus(self, skill)
|
||||||
|
|
||||||
local critical_chance = 0;
|
local critical_chance = 0;
|
||||||
@ -404,16 +508,29 @@ function GetCriticalChanceBonus(self, skill)
|
|||||||
critical_chance = critical_chance + spellbonuses:CriticalHitChance(skill);
|
critical_chance = critical_chance + spellbonuses:CriticalHitChance(skill);
|
||||||
critical_chance = critical_chance + aabonuses:CriticalHitChance(skill);
|
critical_chance = critical_chance + aabonuses:CriticalHitChance(skill);
|
||||||
|
|
||||||
|
eq.log_combat(
|
||||||
|
string.format("[%s] [Mob::GetCriticalChanceBonus] Bonuses | Item [%i] Spell [%i] AA [%i] | 2nd Item [%i] Spell [%i] AA [%i] Final Chance [%i]",
|
||||||
|
self:GetCleanName(),
|
||||||
|
itembonuses:CriticalHitChance(Skill.HIGHEST_SKILL + 1),
|
||||||
|
spellbonuses:CriticalHitChance(Skill.HIGHEST_SKILL + 1),
|
||||||
|
aabonuses:CriticalHitChance(Skill.HIGHEST_SKILL + 1),
|
||||||
|
itembonuses:CriticalHitChance(skill),
|
||||||
|
spellbonuses:CriticalHitChance(skill),
|
||||||
|
aabonuses:CriticalHitChance(skill),
|
||||||
|
critical_chance
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
return critical_chance;
|
return critical_chance;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Source Function: Mob::GetCritDmgMob()
|
||||||
function GetCritDmgMod(self, skill)
|
function GetCritDmgMod(self, skill)
|
||||||
local critDmg_mod = 0;
|
local critDmg_mod = 0;
|
||||||
|
|
||||||
local aabonuses = self:GetAABonuses();
|
local aabonuses = self:GetAABonuses();
|
||||||
local itembonuses = self:GetItemBonuses();
|
local itembonuses = self:GetItemBonuses();
|
||||||
local spellbonuses = self:GetSpellBonuses();
|
local spellbonuses = self:GetSpellBonuses();
|
||||||
|
|
||||||
critDmg_mod = critDmg_mod + itembonuses:CritDmgMod(Skill.HIGHEST_SKILL + 1);
|
critDmg_mod = critDmg_mod + itembonuses:CritDmgMod(Skill.HIGHEST_SKILL + 1);
|
||||||
critDmg_mod = critDmg_mod + spellbonuses:CritDmgMod(Skill.HIGHEST_SKILL + 1);
|
critDmg_mod = critDmg_mod + spellbonuses:CritDmgMod(Skill.HIGHEST_SKILL + 1);
|
||||||
critDmg_mod = critDmg_mod + aabonuses:CritDmgMod(Skill.HIGHEST_SKILL + 1);
|
critDmg_mod = critDmg_mod + aabonuses:CritDmgMod(Skill.HIGHEST_SKILL + 1);
|
||||||
@ -421,9 +538,14 @@ function GetCritDmgMod(self, skill)
|
|||||||
critDmg_mod = critDmg_mod + spellbonuses:CritDmgMod(skill);
|
critDmg_mod = critDmg_mod + spellbonuses:CritDmgMod(skill);
|
||||||
critDmg_mod = critDmg_mod + aabonuses:CritDmgMod(skill);
|
critDmg_mod = critDmg_mod + aabonuses:CritDmgMod(skill);
|
||||||
|
|
||||||
|
if (critDmg_mod < -100) then
|
||||||
|
critDmg_mod = -100;
|
||||||
|
end
|
||||||
|
|
||||||
return critDmg_mod;
|
return critDmg_mod;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Source Function: Mob::GetCrippBlowChance()
|
||||||
function GetCrippBlowChance(self)
|
function GetCrippBlowChance(self)
|
||||||
local aabonuses = self:GetAABonuses();
|
local aabonuses = self:GetAABonuses();
|
||||||
local itembonuses = self:GetItemBonuses();
|
local itembonuses = self:GetItemBonuses();
|
||||||
@ -437,6 +559,7 @@ function GetCrippBlowChance(self)
|
|||||||
return crip_chance;
|
return crip_chance;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Source Function: Mob::MeleeMitigation()
|
||||||
function DoMeleeMitigation(defender, attacker, hit, opts)
|
function DoMeleeMitigation(defender, attacker, hit, opts)
|
||||||
if hit.damage_done <= 0 then
|
if hit.damage_done <= 0 then
|
||||||
return hit;
|
return hit;
|
||||||
@ -455,6 +578,22 @@ function DoMeleeMitigation(defender, attacker, hit, opts)
|
|||||||
local weight = 0.0;
|
local weight = 0.0;
|
||||||
local monkweight = MonkACBonusWeight;
|
local monkweight = MonkACBonusWeight;
|
||||||
|
|
||||||
|
eq.log_combat(
|
||||||
|
string.format("[%s] [Mob::MeleeMitigation] Stability Bonuses | AA [%i] Item [%i] Spell [%i]",
|
||||||
|
defender:GetCleanName(),
|
||||||
|
aabonuses:CombatStability(),
|
||||||
|
itembonuses:CombatStability(),
|
||||||
|
spellbonuses:CombatStability()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
eq.log_combat(
|
||||||
|
string.format("[%s] [Mob::MeleeMitigation] Soft Cap [%i]",
|
||||||
|
defender:GetCleanName(),
|
||||||
|
softcap
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
if defender:IsClient() then
|
if defender:IsClient() then
|
||||||
armor, shield_ac = GetRawACNoShield(defender);
|
armor, shield_ac = GetRawACNoShield(defender);
|
||||||
weight = defender:CastToClient():CalcCurrentWeight() / 10;
|
weight = defender:CastToClient():CalcCurrentWeight() / 10;
|
||||||
@ -559,15 +698,32 @@ function DoMeleeMitigation(defender, attacker, hit, opts)
|
|||||||
attack_rating = (attacker:GetATK() + (attacker:GetSkill(Skill.Offense) * 1.345) + ((attacker:GetSTR() - 66) * 0.9));
|
attack_rating = (attacker:GetATK() + (attacker:GetSkill(Skill.Offense) * 1.345) + ((attacker:GetSTR() - 66) * 0.9));
|
||||||
end
|
end
|
||||||
|
|
||||||
|
eq.log_combat(
|
||||||
|
string.format("[%s] [Mob::MeleeMitigation] Attack Rating [%02f] Mitigation Rating [%02f] Damage [%i]",
|
||||||
|
defender:GetCleanName(),
|
||||||
|
attack_rating,
|
||||||
|
mitigation_rating,
|
||||||
|
hit.damage_done
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
hit.damage_done = GetMeleeMitDmg(defender, attacker, hit.damage_done, hit.min_damage, mitigation_rating, attack_rating);
|
hit.damage_done = GetMeleeMitDmg(defender, attacker, hit.damage_done, hit.min_damage, mitigation_rating, attack_rating);
|
||||||
|
|
||||||
if hit.damage_done < 0 then
|
if hit.damage_done < 0 then
|
||||||
hit.damage_done = 0;
|
hit.damage_done = 0;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
eq.log_combat(
|
||||||
|
string.format("[%s] [Mob::MeleeMitigation] Final Damage [%i]",
|
||||||
|
defender:GetCleanName(),
|
||||||
|
hit.damage_done
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
return hit;
|
return hit;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Source Function: N/A
|
||||||
function GetMeleeMitDmg(defender, attacker, damage, min_damage, mitigation_rating, attack_rating)
|
function GetMeleeMitDmg(defender, attacker, damage, min_damage, mitigation_rating, attack_rating)
|
||||||
if defender:IsClient() then
|
if defender:IsClient() then
|
||||||
return ClientGetMeleeMitDmg(defender, attacker, damage, min_damage, mitigation_rating, attack_rating);
|
return ClientGetMeleeMitDmg(defender, attacker, damage, min_damage, mitigation_rating, attack_rating);
|
||||||
@ -576,6 +732,7 @@ function GetMeleeMitDmg(defender, attacker, damage, min_damage, mitigation_ratin
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Source Function: Client::GetMeleeMitDmg()
|
||||||
function ClientGetMeleeMitDmg(defender, attacker, damage, min_damage, mitigation_rating, attack_rating)
|
function ClientGetMeleeMitDmg(defender, attacker, damage, min_damage, mitigation_rating, attack_rating)
|
||||||
if (not attacker:IsNPC() or UseOldDamageIntervalRules) then
|
if (not attacker:IsNPC() or UseOldDamageIntervalRules) then
|
||||||
return MobGetMeleeMitDmg(defender, attacker, damage, min_damage, mitigation_rating, attack_rating);
|
return MobGetMeleeMitDmg(defender, attacker, damage, min_damage, mitigation_rating, attack_rating);
|
||||||
@ -624,11 +781,20 @@ function ClientGetMeleeMitDmg(defender, attacker, damage, min_damage, mitigation
|
|||||||
return math.floor(dmg_bonus + dmg_interval * d);
|
return math.floor(dmg_bonus + dmg_interval * d);
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Source Function: Mob::GetMeleeMitDmg()
|
||||||
function MobGetMeleeMitDmg(defender, attacker, damage, min_damage, mitigation_rating, attack_rating)
|
function MobGetMeleeMitDmg(defender, attacker, damage, min_damage, mitigation_rating, attack_rating)
|
||||||
local d = 10.0;
|
local d = 10.0;
|
||||||
local mit_roll = Random.Real(0, mitigation_rating);
|
local mit_roll = Random.Real(0, mitigation_rating);
|
||||||
local atk_roll = Random.Real(0, attack_rating);
|
local atk_roll = Random.Real(0, attack_rating);
|
||||||
|
|
||||||
|
eq.log_combat(
|
||||||
|
string.format("[%s] [Mob::GetMeleeMitDmg] MitigationRoll [%02f] AtkRoll [%02f]",
|
||||||
|
defender:GetCleanName(),
|
||||||
|
mit_roll,
|
||||||
|
atk_roll
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
if (atk_roll > mit_roll) then
|
if (atk_roll > mit_roll) then
|
||||||
local a_diff = atk_roll - mit_roll;
|
local a_diff = atk_roll - mit_roll;
|
||||||
local thac0 = attack_rating * ACthac0Factor;
|
local thac0 = attack_rating * ACthac0Factor;
|
||||||
@ -656,13 +822,51 @@ function MobGetMeleeMitDmg(defender, attacker, damage, min_damage, mitigation_ra
|
|||||||
end
|
end
|
||||||
|
|
||||||
local interval = (damage - min_damage) / 20.0;
|
local interval = (damage - min_damage) / 20.0;
|
||||||
|
|
||||||
|
eq.log_combat(
|
||||||
|
string.format("[%s] [Mob::GetMeleeMitDmg] Interval [%02f] d [%02f]",
|
||||||
|
defender:GetCleanName(),
|
||||||
|
interval,
|
||||||
|
d
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
damage = damage - (math.floor(d) * interval);
|
damage = damage - (math.floor(d) * interval);
|
||||||
|
|
||||||
|
eq.log_combat(
|
||||||
|
string.format("[%s] [Mob::GetMeleeMitDmg] Damage [%02f] Post Interval",
|
||||||
|
defender:GetCleanName(),
|
||||||
|
damage
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
damage = damage - (min_damage * defender:GetItemBonuses():MeleeMitigation() / 100);
|
damage = damage - (min_damage * defender:GetItemBonuses():MeleeMitigation() / 100);
|
||||||
damage = damage + (damage * (defender:GetSpellBonuses():MeleeMitigationEffect() + defender:GetItemBonuses():MeleeMitigationEffect() + defender:GetAABonuses():MeleeMitigationEffect()) / 100);
|
|
||||||
|
eq.log_combat(
|
||||||
|
string.format("[%s] [Mob::GetMeleeMitDmg] Damage [%02f] Mitigation [%i] Post Mitigation MinDmg",
|
||||||
|
defender:GetCleanName(),
|
||||||
|
damage,
|
||||||
|
defender:GetItemBonuses():MeleeMitigation()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
-- Changed from positive to negative per original
|
||||||
|
damage = damage - (damage * (defender:GetSpellBonuses():MeleeMitigationEffect() + defender:GetItemBonuses():MeleeMitigationEffect() + defender:GetAABonuses():MeleeMitigationEffect()) / 100);
|
||||||
|
|
||||||
|
eq.log_combat(
|
||||||
|
string.format("[%s] [Mob::GetMeleeMitDmg] Damage [%02f] SpellMit [%i] ItemMit [%i] AAMit [%i] Post All Mit Bonuses",
|
||||||
|
defender:GetCleanName(),
|
||||||
|
damage,
|
||||||
|
defender:GetSpellBonuses():MeleeMitigationEffect(),
|
||||||
|
defender:GetItemBonuses():MeleeMitigationEffect(),
|
||||||
|
defender:GetAABonuses():MeleeMitigationEffect()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
return damage;
|
return damage;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Source Function: Client::GetRawACNoShield()
|
||||||
function GetRawACNoShield(self)
|
function GetRawACNoShield(self)
|
||||||
self = self:CastToClient();
|
self = self:CastToClient();
|
||||||
|
|
||||||
@ -684,9 +888,21 @@ function GetRawACNoShield(self)
|
|||||||
end
|
end
|
||||||
|
|
||||||
ac = ac - shield_ac;
|
ac = ac - shield_ac;
|
||||||
|
|
||||||
|
eq.log_combat(
|
||||||
|
string.format("[%s] [Client::GetRawACNoShield] AC [%i] ItemAC [%i] SpellAC [%i] AAAC [%i]",
|
||||||
|
self:GetCleanName(),
|
||||||
|
ac,
|
||||||
|
self:GetItemBonuses():AC(),
|
||||||
|
self:GetSpellBonuses():AC(),
|
||||||
|
self:GetAABonuses():AC()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
return ac, shield_ac;
|
return ac, shield_ac;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Source Function: Mob::GetDamageTable()
|
||||||
function GetDamageTable(attacker, skill)
|
function GetDamageTable(attacker, skill)
|
||||||
if not attacker:IsClient() then
|
if not attacker:IsClient() then
|
||||||
return 100;
|
return 100;
|
||||||
@ -729,26 +945,56 @@ function GetDamageTable(attacker, skill)
|
|||||||
return 100;
|
return 100;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Source Function: N/A - Not used
|
||||||
function ApplyDamageTable(e)
|
function ApplyDamageTable(e)
|
||||||
e.IgnoreDefault = true;
|
e.IgnoreDefault = true;
|
||||||
return e;
|
return e;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Source Function: Mob::CommonOutgoingHitSuccess()
|
||||||
function CommonOutgoingHitSuccess(e)
|
function CommonOutgoingHitSuccess(e)
|
||||||
e = ApplyMeleeDamageBonus(e);
|
e = ApplyMeleeDamageBonus(e);
|
||||||
|
|
||||||
|
eq.log_combat(
|
||||||
|
string.format("[%s] [Mob::CommonOutgoingHitSuccess] Dmg [%i] Post ApplyMeleeDamageBonus",
|
||||||
|
e.self:GetCleanName(),
|
||||||
|
e.hit.damage_done
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
e.hit.damage_done = e.hit.damage_done + (e.hit.damage_done * e.other:GetSkillDmgTaken(e.hit.skill) / 100) + (e.self:GetSkillDmgAmt(e.hit.skill) + e.other:GetFcDamageAmtIncoming(e.self, 0, true, e.hit.skill));
|
e.hit.damage_done = e.hit.damage_done + (e.hit.damage_done * e.other:GetSkillDmgTaken(e.hit.skill) / 100) + (e.self:GetSkillDmgAmt(e.hit.skill) + e.other:GetFcDamageAmtIncoming(e.self, 0, true, e.hit.skill));
|
||||||
|
|
||||||
|
eq.log_combat(
|
||||||
|
string.format("[%s] [Mob::CommonOutgoingHitSuccess] Dmg [%i] SkillDmgTaken [%i] SkillDmgtAmt [%i] FcDmgAmtIncoming [%i] Post DmgCalcs",
|
||||||
|
e.self:GetCleanName(),
|
||||||
|
e.hit.damage_done,
|
||||||
|
e.other:GetSkillDmgTaken(e.hit.skill),
|
||||||
|
e.self:GetSkillDmgAmt(e.hit.skill),
|
||||||
|
e.other:GetFcDamageAmtIncoming(e.self, 0, true, e.hit.skill)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
e = TryCriticalHit(e);
|
e = TryCriticalHit(e);
|
||||||
e.self:CheckNumHitsRemaining(5, -1, 65535);
|
e.self:CheckNumHitsRemaining(5, -1, 65535);
|
||||||
e.IgnoreDefault = true;
|
e.IgnoreDefault = true;
|
||||||
return e;
|
return e;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Source Function: Mob::ApplyMeleeDamageBonus()
|
||||||
function ApplyMeleeDamageBonus(e)
|
function ApplyMeleeDamageBonus(e)
|
||||||
local dmgbonusmod = e.self:GetMeleeDamageMod_SE(e.hit.skill);
|
local dmgbonusmod = e.self:GetMeleeDamageMod_SE(e.hit.skill);
|
||||||
if (opts) then
|
if (opts) then
|
||||||
dmgbonusmod = dmgbonusmod + e.opts.melee_damage_bonus_flat;
|
dmgbonusmod = dmgbonusmod + e.opts.melee_damage_bonus_flat;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
eq.log_combat(
|
||||||
|
string.format("[%s] [Mob::ApplyMeleeDamageBonus] DmgBonusMod [%i] Dmg [%i]",
|
||||||
|
e.self:GetCleanName(),
|
||||||
|
dmgbonusmod,
|
||||||
|
e.hit.damage_done
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
e.hit.damage_done = e.hit.damage_done + (e.hit.damage_done * dmgbonusmod / 100);
|
e.hit.damage_done = e.hit.damage_done + (e.hit.damage_done * dmgbonusmod / 100);
|
||||||
return e;
|
return e;
|
||||||
end
|
end
|
||||||
Loading…
x
Reference in New Issue
Block a user