Implemented SPA 483

Implemented
Fc_Spell_Damage_Pct_IncomingPC	483
- Focus effect that modifies iby percent incoming spell damage on the target.
Base1= min Base2= max. Final percent is random between max and min each time focus is applied from a spell cast.

Note: Written to stack with similar functioning focus SPA 269 SE_FcSpellVulnerability.
This commit is contained in:
KayenEQ
2021-07-14 22:13:39 -04:00
parent 4ada3fccdf
commit a08fa7f2bf
5 changed files with 101 additions and 22 deletions
+67 -15
View File
@@ -3767,28 +3767,40 @@ void Mob::TryOnSpellFinished(Mob *caster, Mob *target, uint16 spell_id)
int32 Mob::GetVulnerability(Mob* caster, uint32 spell_id, uint32 ticsremaining)
{
/*
Modifies incoming spell damage by percent, to increase or decrease damage, can be limited to specific resists.
Can be applied through quest function, spell focus or npc_spells_effects table. This function is run on the target of the spell.
*/
if (!IsValidSpell(spell_id))
return 0;
if (!caster)
return 0;
int32 value = 0;
int32 total_mod = 0;
int32 innate_mod = 0;
int32 fc_spell_vulnerability_mod = 0;
int32 fc_spell_damage_pct_incomingPC_mod = 0;
//Apply innate vulnerabilities
//Apply innate vulnerabilities from quest functions and tables
if (Vulnerability_Mod[GetSpellResistType(spell_id)] != 0)
value = Vulnerability_Mod[GetSpellResistType(spell_id)];
innate_mod = Vulnerability_Mod[GetSpellResistType(spell_id)];
else if (Vulnerability_Mod[HIGHEST_RESIST+1] != 0)
value = Vulnerability_Mod[HIGHEST_RESIST+1];
innate_mod = Vulnerability_Mod[HIGHEST_RESIST+1];
//Apply spell derived vulnerabilities
if (spellbonuses.FocusEffects[focusSpellVulnerability]){
//[Apply spell derived vulnerabilities] Step 1: Check this focus effect exists on the mob.
if (spellbonuses.FocusEffects[focusSpellVulnerability]){
int32 tmp_focus = 0;
int tmp_buffslot = -1;
/*
Find all buffs that may contain SPA 296, then find which slot has the highest possible effect. Since the focus can use
a min and max amount value to determine final focus amt. To find the best focus, use only max value if possible. Once the
best is found. Run it again to get the final value randoming between min and max.
*/
int buff_count = GetMaxTotalSlots();
for(int i = 0; i < buff_count; i++) {
@@ -3808,21 +3820,61 @@ int32 Mob::GetVulnerability(Mob* caster, uint32 spell_id, uint32 ticsremaining)
tmp_focus = focus;
tmp_buffslot = i;
}
}
}
tmp_focus = caster->CalcFocusEffect(focusSpellVulnerability, buffs[tmp_buffslot].spellid, spell_id);
if (tmp_focus < -99)
tmp_focus = -99;
value += tmp_focus;
fc_spell_vulnerability_mod = caster->CalcFocusEffect(focusSpellVulnerability, buffs[tmp_buffslot].spellid, spell_id);
if (tmp_buffslot >= 0)
CheckNumHitsRemaining(NumHit::MatchingSpells, tmp_buffslot);
}
return value;
if (spellbonuses.FocusEffects[focusFcSpellDamagePctIncomingPC]) {
int32 tmp_focus = 0;
int tmp_buffslot = -1;
/*
Find all buffs that may contain SPA 483, then find which slot has the highest possible effect. Since the focus can use
a min and max amount value to determine final focus amt. To find the best focus, use only max value if possible. Once the
best is found. Run it again to get the final value randoming between min and max.
*/
int buff_count = GetMaxTotalSlots();
for (int i = 0; i < buff_count; i++) {
if ((IsValidSpell(buffs[i].spellid) && IsEffectInSpell(buffs[i].spellid, SE_Fc_Spell_Damage_Pct_IncomingPC))) {
int32 focus = caster->CalcFocusEffect(focusFcSpellDamagePctIncomingPC, buffs[i].spellid, spell_id, true);
if (!focus)
continue;
if (tmp_focus && focus > tmp_focus) {
tmp_focus = focus;
tmp_buffslot = i;
}
else if (!tmp_focus) {
tmp_focus = focus;
tmp_buffslot = i;
}
}
}
fc_spell_damage_pct_incomingPC_mod = caster->CalcFocusEffect(focusFcSpellDamagePctIncomingPC, buffs[tmp_buffslot].spellid, spell_id);
if (tmp_buffslot >= 0)
CheckNumHitsRemaining(NumHit::MatchingSpells, tmp_buffslot);
}
total_mod = fc_spell_vulnerability_mod + fc_spell_damage_pct_incomingPC_mod;
//Don't let focus derived mods reduce past 99% mitigation. Quest related can, and for custom functionality if negative will give a healing affect instead of damage.
if (total_mod < -99)
total_mod = -99;
total_mod += innate_mod;
return total_mod;
}
int32 Mob::GetSkillDmgTaken(const EQ::skills::SkillType skill_used, ExtraAttackOptions *opts)