From d460fb3db8a144c2d41e572024dae8a02ed51817 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Wed, 15 Dec 2021 22:00:34 -0500 Subject: [PATCH] [Spells] Update to SPA 440 SE_FinishingBlowMaxLevel limit value sets HP ratio for FB (#1890) * fb max level update * Update to SPA 440 SE_FinishingBlowMaxLevel limit value sets HP ratio for FB --- zone/attack.cpp | 9 +++++++-- zone/bonuses.cpp | 13 ++++++------- zone/common.h | 5 +++-- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/zone/attack.cpp b/zone/attack.cpp index da4394d91..633383d17 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -4758,8 +4758,13 @@ void Mob::TryCriticalHit(Mob *defender, DamageHitInfo &hit, ExtraAttackOptions * bool Mob::TryFinishingBlow(Mob *defender, int &damage) { - // base2 of FinishingBlowLvl is the HP limit (cur / max) * 1000, 10% is listed as 100 - if (defender && !defender->IsClient() && defender->GetHPRatio() < 10) { + float hp_limit = 10.0f; + auto fb_hp_limit = std::max({ aabonuses.FinishingBlowLvl[SBIndex::FINISHING_BLOW_LEVEL_HP_RATIO], spellbonuses.FinishingBlowLvl[SBIndex::FINISHING_BLOW_LEVEL_HP_RATIO], itembonuses.FinishingBlowLvl[SBIndex::FINISHING_BLOW_LEVEL_HP_RATIO] }); + + if (fb_hp_limit) { + hp_limit = fb_hp_limit/10.0f; + } + if (defender && !defender->IsClient() && defender->GetHPRatio() < hp_limit) { uint32 FB_Dmg = aabonuses.FinishingBlow[SBIndex::FINISHING_EFFECT_DMG] + spellbonuses.FinishingBlow[SBIndex::FINISHING_EFFECT_DMG] + itembonuses.FinishingBlow[SBIndex::FINISHING_EFFECT_DMG]; diff --git a/zone/bonuses.cpp b/zone/bonuses.cpp index 28b98d655..5684abfc4 100644 --- a/zone/bonuses.cpp +++ b/zone/bonuses.cpp @@ -1349,7 +1349,7 @@ void Mob::ApplyAABonuses(const AA::Rank &rank, StatBonuses *newbon) // base1 = level, base2 = ??? (Set to 200 in AA data, possible proc rate mod?) if (newbon->FinishingBlowLvl[SBIndex::FINISHING_EFFECT_LEVEL_MAX] < base_value) { newbon->FinishingBlowLvl[SBIndex::FINISHING_EFFECT_LEVEL_MAX] = base_value; - newbon->FinishingBlowLvl[SBIndex::FINISHING_EFFECT_LEVEL_CHANCE_BONUS] = limit_value; + newbon->FinishingBlowLvl[SBIndex::FINISHING_BLOW_LEVEL_HP_RATIO] = limit_value; } break; } @@ -3507,10 +3507,9 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses *ne case SE_FinishingBlowLvl: { - //base1 = level, base2 = ??? (Set to 200 in AA data, possible proc rate mod?) if (new_bonus->FinishingBlowLvl[SBIndex::FINISHING_EFFECT_LEVEL_MAX] < effect_value){ - new_bonus->FinishingBlowLvl[SBIndex::FINISHING_EFFECT_LEVEL_MAX] = effect_value; - new_bonus->FinishingBlowLvl[SBIndex::FINISHING_EFFECT_LEVEL_CHANCE_BONUS] = limit_value; + new_bonus->FinishingBlowLvl[SBIndex::FINISHING_EFFECT_LEVEL_MAX] = effect_value; + new_bonus->FinishingBlowLvl[SBIndex::FINISHING_BLOW_LEVEL_HP_RATIO] = limit_value; } break; } @@ -5405,9 +5404,9 @@ void Mob::NegateSpellEffectBonuses(uint16 spell_id) if (negate_spellbonus) { spellbonuses.FinishingBlowLvl[SBIndex::FINISHING_EFFECT_LEVEL_MAX] = effect_value; } if (negate_aabonus) { aabonuses.FinishingBlowLvl[SBIndex::FINISHING_EFFECT_LEVEL_MAX] = effect_value; } if (negate_itembonus) { itembonuses.FinishingBlowLvl[SBIndex::FINISHING_EFFECT_LEVEL_MAX] = effect_value; } - if (negate_spellbonus) { spellbonuses.FinishingBlowLvl[SBIndex::FINISHING_EFFECT_LEVEL_CHANCE_BONUS] = effect_value; } - if (negate_aabonus) { aabonuses.FinishingBlowLvl[SBIndex::FINISHING_EFFECT_LEVEL_CHANCE_BONUS] = effect_value; } - if (negate_itembonus) { itembonuses.FinishingBlowLvl[SBIndex::FINISHING_EFFECT_LEVEL_CHANCE_BONUS] = effect_value; } + if (negate_spellbonus) { spellbonuses.FinishingBlowLvl[SBIndex::FINISHING_BLOW_LEVEL_HP_RATIO] = effect_value; } + if (negate_aabonus) { aabonuses.FinishingBlowLvl[SBIndex::FINISHING_BLOW_LEVEL_HP_RATIO] = effect_value; } + if (negate_itembonus) { itembonuses.FinishingBlowLvl[SBIndex::FINISHING_BLOW_LEVEL_HP_RATIO] = effect_value; } break; case SE_Sanctuary: diff --git a/zone/common.h b/zone/common.h index 4998d3889..a853b564e 100644 --- a/zone/common.h +++ b/zone/common.h @@ -606,7 +606,7 @@ struct StatBonuses { int32 OffhandRiposteFail; // chance for opponent to fail riposte with offhand attack. int32 ItemATKCap; // Raise item attack cap int32 FinishingBlow[2]; // Chance to do a finishing blow for specified damage amount. - uint32 FinishingBlowLvl[2]; // Sets max level an NPC can be affected by FB. (base1 = lv, base2= ???) + uint32 FinishingBlowLvl[2]; // Sets max level an NPC can be affected by FB. (base1 = lv, base2= hit point ratio) int32 ShieldEquipDmgMod; // Increases weapon's base damage by base1 % when shield is equipped (indirectly increasing hate) bool TriggerOnCastRequirement; // Triggers off various different conditions defined as emum SpellRestrictions int8 StunBashChance; // chance to stun with bash. @@ -682,7 +682,8 @@ namespace SBIndex { constexpr uint16 FINISHING_EFFECT_PROC_CHANCE = 0; // SPA 278, 439, 217 constexpr uint16 FINISHING_EFFECT_DMG = 1; // SPA 278, 439, 217 constexpr uint16 FINISHING_EFFECT_LEVEL_MAX = 0; // SPA 440, 345, 346 - constexpr uint16 FINISHING_EFFECT_LEVEL_CHANCE_BONUS = 1; // SPA 440, 345, 346 + constexpr uint16 FINISHING_EFFECT_LEVEL_CHANCE_BONUS = 1; // SPA 345, 346 + constexpr uint16 FINISHING_BLOW_LEVEL_HP_RATIO = 1; // SPA 440 constexpr uint16 DOUBLE_MELEE_ROUND_CHANCE = 0; // SPA 471 constexpr uint16 DOUBLE_MELEE_ROUND_DMG_BONUS = 1; // SPA 471 constexpr uint16 REFLECT_CHANCE = 0; // SPA 158