mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-11 11:48:37 +00:00
[Rule] Added MeleeMitigation Level Difference Roll Adjusted for level diffs (#4332)
* Added MeleeMitigation LevelDifferent Roll Adjusted for level diffs * Adjustments per comments * Tune method and const. --------- Co-authored-by: Kinglykrab <kinglykrab@gmail.com>
This commit is contained in:
+21
-1
@@ -1068,6 +1068,26 @@ void Mob::MeleeMitigation(Mob *attacker, DamageHitInfo &hit, ExtraAttackOptions
|
||||
|
||||
auto roll = RollD20(hit.offense, mitigation);
|
||||
|
||||
// Add bonus to roll if level difference is sufficient
|
||||
const int level_diff = attacker->GetLevel() - GetLevel();
|
||||
const int level_diff_roll_check = RuleI(Combat, LevelDifferenceRollCheck);
|
||||
|
||||
if (level_diff_roll_check >= 0) {
|
||||
if (level_diff > level_diff_roll_check) {
|
||||
roll += RuleR(Combat, LevelDifferenceRollBonus);
|
||||
|
||||
if (roll > 2.0f) {
|
||||
roll = 2.0f;
|
||||
}
|
||||
} else if (level_diff < (-level_diff_roll_check)) {
|
||||
roll -= RuleR(Combat, LevelDifferenceRollBonus);
|
||||
|
||||
if (roll < 0.1f) {
|
||||
roll = 0.1f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// +0.5 for rounding, min to 1 dmg
|
||||
hit.damage_done = std::max(static_cast<int>(roll * static_cast<double>(hit.base_damage) + 0.5), 1);
|
||||
|
||||
@@ -2535,7 +2555,7 @@ bool NPC::Death(Mob* killer_mob, int64 damage, uint16 spell, EQ::skills::SkillTy
|
||||
auto app = new EQApplicationPacket(OP_Death, sizeof(Death_Struct));
|
||||
|
||||
auto d = (Death_Struct*) app->pBuffer;
|
||||
|
||||
|
||||
// Convert last message to color to avoid duplicate damage messages
|
||||
// that occur in these rare cases when this is the death blow.
|
||||
if (IsValidSpell(spell) &&
|
||||
|
||||
Reference in New Issue
Block a user