Merge pull request #1557 from KayenEQ/spa395fix2

[Spells] Healing focuses effects update and Fix for SPA 395
This commit is contained in:
KayenEQ
2021-10-01 15:52:25 -04:00
committed by GitHub
8 changed files with 110 additions and 92 deletions
+33 -26
View File
@@ -5743,7 +5743,7 @@ int32 Mob::CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, boo
case SE_FcHealPctCritIncoming:
if (type == focusFcHealPctCritIncoming) {
value = focus_spell.base[i];
value = GetFocusRandomEffectivenessValue(focus_spell.base[i], focus_spell.base2[i], best_focus);
}
break;
@@ -5761,7 +5761,7 @@ int32 Mob::CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, boo
case SE_FcHealPctIncoming:
if (type == focusFcHealPctIncoming) {
value = focus_spell.base[i];
value = GetFocusRandomEffectivenessValue(focus_spell.base[i], focus_spell.base2[i], best_focus);
}
break;
@@ -5925,7 +5925,7 @@ void Mob::TryTriggerOnCastFocusEffect(focusType type, uint16 spell_id)
}
}
// Only use of this focus per AA effect.
// Only use one of this focus per AA effect.
if (IsClient() && aabonuses.FocusEffects[type]) {
for (const auto &aa : aa_ranks) {
auto ability_rank = zone->GetAlternateAdvancementAbilityAndRank(aa.first, aa.second.first);
@@ -6372,8 +6372,9 @@ int32 NPC::GetFocusEffect(focusType type, uint16 spell_id) {
//Improved Healing, Damage & Mana Reduction are handled differently in that some are random percentages
//In these cases we need to find the most powerful effect, so that each piece of gear wont get its own chance
if(RuleB(Spells, LiveLikeFocusEffects) && (type == focusManaCost || type == focusImprovedHeal || type == focusImprovedDamage || type == focusImprovedDamage2))
if (RuleB(Spells, LiveLikeFocusEffects) && CanFocusUseRandomEffectivenessByType(type)) {
rand_effectiveness = true;
}
if (RuleB(Spells, NPC_UseFocusFromItems) && itembonuses.FocusEffects[type]){
@@ -6933,50 +6934,54 @@ int32 Mob::GetFcDamageAmtIncoming(Mob *caster, uint32 spell_id, bool use_skill,
int32 Mob::GetFocusIncoming(focusType type, int effect, Mob *caster, uint32 spell_id) {
//**** This can be removed when bot healing focus code is updated ****
/*
This is a general function for calculating best focus effect values for focus effects that exist on targets but modify incoming spells.
Should be used when checking for foci that can exist on clients or npcs ect.
Example: When your target has a focus limited buff that increases amount of healing on them.
*/
if (!caster)
if (!caster) {
return 0;
}
int value = 0;
if (spellbonuses.FocusEffects[type]){
int32 tmp_focus = 0;
int tmp_buffslot = -1;
int32 tmp_focus = 0;
int tmp_buffslot = -1;
int buff_count = GetMaxTotalSlots();
for(int i = 0; i < buff_count; i++) {
int buff_count = GetMaxTotalSlots();
for(int i = 0; i < buff_count; i++) {
if((IsValidSpell(buffs[i].spellid) && IsEffectInSpell(buffs[i].spellid, effect))){
if((IsValidSpell(buffs[i].spellid) && IsEffectInSpell(buffs[i].spellid, effect))){
int32 focus = caster->CalcFocusEffect(type, buffs[i].spellid, spell_id);
int32 focus = caster->CalcFocusEffect(type, buffs[i].spellid, spell_id);
if (!focus)
continue;
if (!focus) {
continue;
}
if (tmp_focus && focus > tmp_focus){
tmp_focus = focus;
tmp_buffslot = i;
}
if (tmp_focus && focus > tmp_focus){
tmp_focus = focus;
tmp_buffslot = i;
}
else if (!tmp_focus){
tmp_focus = focus;
tmp_buffslot = i;
}
else if (!tmp_focus){
tmp_focus = focus;
tmp_buffslot = i;
}
}
value = tmp_focus;
if (tmp_buffslot >= 0)
CheckNumHitsRemaining(NumHit::MatchingSpells, tmp_buffslot);
}
value = tmp_focus;
if (tmp_buffslot >= 0)
CheckNumHitsRemaining(NumHit::MatchingSpells, tmp_buffslot);
}
return value;
}
@@ -8498,6 +8503,8 @@ bool Mob::CanFocusUseRandomEffectivenessByType(focusType type)
case focusSpellHateMod:
case focusSpellVulnerability:
case focusFcSpellDamagePctIncomingPC:
case focusFcHealPctIncoming:
case focusFcHealPctCritIncoming:
return true;
}