[Spells] Implement PVP resist and duration overrides (#1513)

* Make use of PVP resist field

* Implement PVP duration formulas
This commit is contained in:
Michael Cook (mackal)
2021-09-03 21:19:39 -04:00
committed by GitHub
parent af6d344e12
commit 41352f77ae
9 changed files with 60 additions and 24 deletions
+20 -3
View File
@@ -2816,8 +2816,14 @@ int Mob::CalcBuffDuration(Mob *caster, Mob *target, uint16 spell_id, int32 caste
if(!target)
target = caster;
formula = spells[spell_id].buffdurationformula;
duration = spells[spell_id].buffduration;
// PVP duration
if (IsDetrimentalSpell(spell_id) && target->IsClient() && caster->IsClient()) {
formula = spells[spell_id].pvp_duration;
duration = spells[spell_id].pvp_duration_cap;
} else {
formula = spells[spell_id].buffdurationformula;
duration = spells[spell_id].buffduration;
}
int castlevel = caster->GetCasterLevel(spell_id);
if(caster_level_override > 0)
@@ -4591,7 +4597,18 @@ float Mob::ResistSpell(uint8 resist_type, uint16 spell_id, Mob *caster, bool use
}
//Get resist modifier and adjust it based on focus 2 resist about eq to 1% resist chance
int resist_modifier = (use_resist_override) ? resist_override : spells[spell_id].ResistDiff;
int resist_modifier = 0;
if (use_resist_override) {
resist_modifier = resist_override;
} else {
// PVP, we don't have the normal per_level or cap stuff implemented ... so ahh do that
// and make sure the PVP versions are also handled.
if (IsClient() && caster->IsClient()) {
resist_modifier = spells[spell_id].pvpresistbase;
} else {
resist_modifier = spells[spell_id].ResistDiff;
}
}
if(caster->GetSpecialAbility(CASTING_RESIST_DIFF))
resist_modifier += caster->GetSpecialAbilityParam(CASTING_RESIST_DIFF, 0);