diff --git a/common/ruletypes.h b/common/ruletypes.h index 395319ff7..cb73f3983 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -542,6 +542,7 @@ RULE_BOOL(Combat, SummonMeleeRange, true, "Enable or disable summoning of a play RULE_BOOL(Combat, WaterMatchRequiredForAutoFireLoS, true, "Enable/Disable the requirement of both the attacker/victim being both in or out of water for AutoFire LoS to pass.") RULE_INT(Combat, ExtraAllowedKickClassesBitmask, 0, "Bitmask for allowing extra classes beyond Warrior, Ranger, Beastlord, and Berserker to kick, No Extra Classes (0) by default") RULE_INT(Combat, MaxProcs, 4, "Adjustable maximum number of procs per round, the hard cap is MAX_PROCS (11). Requires mob repop or client zone when changed") +RULE_BOOL(Combat, FinishingBlowOnlyWhenFleeing, false, "Enable to only allow Finishing Blow when fleeing (Original Style Finishing Blow)") RULE_CATEGORY_END() RULE_CATEGORY(NPC) diff --git a/zone/attack.cpp b/zone/attack.cpp index aac26dd75..04f86cc13 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -5191,7 +5191,6 @@ void Mob::TryCriticalHit(Mob *defender, DamageHitInfo &hit, ExtraAttackOptions * bool Mob::TryFinishingBlow(Mob *defender, int64 &damage) { float hp_limit = 10.0f; - auto fb_hp_limit = std::max( { aabonuses.FinishingBlowLvl[SBIndex::FINISHING_BLOW_LEVEL_HP_RATIO], @@ -5203,28 +5202,36 @@ bool Mob::TryFinishingBlow(Mob *defender, int64 &damage) if (fb_hp_limit) { hp_limit = fb_hp_limit/10.0f; } - if (defender && !defender->IsClient() && defender->GetHPRatio() < hp_limit) { - uint32 FB_Dmg = + if (defender && !defender->IsClient() && defender->GetHPRatio() < hp_limit) { + uint32 finishing_blow_damage = aabonuses.FinishingBlow[SBIndex::FINISHING_EFFECT_DMG] + spellbonuses.FinishingBlow[SBIndex::FINISHING_EFFECT_DMG] + itembonuses.FinishingBlow[SBIndex::FINISHING_EFFECT_DMG]; - uint32 FB_Level = 0; - FB_Level = aabonuses.FinishingBlowLvl[SBIndex::FINISHING_EFFECT_LEVEL_MAX]; - if (FB_Level < spellbonuses.FinishingBlowLvl[SBIndex::FINISHING_EFFECT_LEVEL_MAX]) - FB_Level = spellbonuses.FinishingBlowLvl[SBIndex::FINISHING_EFFECT_LEVEL_MAX]; - else if (FB_Level < itembonuses.FinishingBlowLvl[SBIndex::FINISHING_EFFECT_LEVEL_MAX]) - FB_Level = itembonuses.FinishingBlowLvl[SBIndex::FINISHING_EFFECT_LEVEL_MAX]; + uint32 finishing_blow_level = 0; + finishing_blow_level = aabonuses.FinishingBlowLvl[SBIndex::FINISHING_EFFECT_LEVEL_MAX]; + if (finishing_blow_level < spellbonuses.FinishingBlowLvl[SBIndex::FINISHING_EFFECT_LEVEL_MAX]) { + finishing_blow_level = spellbonuses.FinishingBlowLvl[SBIndex::FINISHING_EFFECT_LEVEL_MAX]; + } else if (finishing_blow_level < itembonuses.FinishingBlowLvl[SBIndex::FINISHING_EFFECT_LEVEL_MAX]) { + finishing_blow_level = itembonuses.FinishingBlowLvl[SBIndex::FINISHING_EFFECT_LEVEL_MAX]; + } // modern AA description says rank 1 (500) is 50% chance - int ProcChance = ( + int proc_chance = ( aabonuses.FinishingBlow[SBIndex::FINISHING_EFFECT_PROC_CHANCE] + itembonuses.FinishingBlow[SBIndex::FINISHING_EFFECT_PROC_CHANCE] + spellbonuses.FinishingBlow[SBIndex::FINISHING_EFFECT_PROC_CHANCE] ); - if (FB_Level && FB_Dmg && (defender->GetLevel() <= FB_Level) && - (ProcChance >= zone->random.Int(1, 1000))) { - + if ( + ( + (RuleB(Combat, FinishingBlowOnlyWhenFleeing) && !defender->currently_fleeing) || + !RuleB(Combat, FinishingBlowOnlyWhenFleeing) + ) && + finishing_blow_level && + finishing_blow_damage && + defender->GetLevel() <= finishing_blow_level && + proc_chance >= zone->random.Int(1, 1000) + ) { /* Finishing Blow Critical Message */ entity_list.FilteredMessageCloseString( this, /* Sender */ @@ -5237,7 +5244,7 @@ bool Mob::TryFinishingBlow(Mob *defender, int64 &damage) GetCleanName() /* Message1 */ ); - damage = FB_Dmg; + damage = finishing_blow_damage; return true; } }