mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 16:51:29 +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:
parent
87c207e862
commit
9638d9af3a
@ -521,6 +521,8 @@ RULE_BOOL(Combat, NPCCanCrit, false, "Setting whether an NPC can land critical h
|
||||
RULE_BOOL(Combat, UseIntervalAC, true, "Switch whether bonuses, armour class, multipliers, classes and caps should be considered in the calculation of damage values")
|
||||
RULE_INT(Combat, PetAttackMagicLevel, 10, "Level at which pets can cause magic damage, no longer used")
|
||||
RULE_INT(Combat, NPCAttackMagicLevel, 10, "Level at which NPC and pets can cause magic damage")
|
||||
RULE_INT(Combat, LevelDifferenceRollCheck, -1, "Level Difference to enable LeverDifferenceRollBonus for MeleeMitigation - Default: -1 is disabled, 20 is common")
|
||||
RULE_REAL(Combat, LevelDifferenceRollBonus, 0.5, "Roll Bonus/Detrement if using LevelDifferenceRollCheck")
|
||||
RULE_BOOL(Combat, EnableFearPathing, true, "Setting whether to use pathing during fear")
|
||||
RULE_BOOL(Combat, FleeGray, true, "If true FleeGrayHPRatio will be used")
|
||||
RULE_INT(Combat, FleeGrayHPRatio, 50, "HP percentage when a Gray NPC begins to flee")
|
||||
|
||||
@ -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) &&
|
||||
|
||||
@ -1012,6 +1012,26 @@ void Mob::TuneMeleeMitigation(Mob *attacker, DamageHitInfo &hit, int ac_override
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user