Core/Spells: Added spell value duration to modify aura duration of a specific spell cast

This commit is contained in:
Matan Shukry
2021-04-21 22:05:03 +02:00
committed by Shauren
parent 90a47188af
commit 2e2dc1afc9
3 changed files with 11 additions and 1 deletions

View File

@@ -503,6 +503,7 @@ SpellValue::SpellValue(SpellInfo const* proto, Unit const* caster)
MaxAffectedTargets = proto->MaxAffectedTargets;
RadiusMod = 1.0f;
AuraStackAmount = 1;
DurationMul = 1;
}
class TC_GAME_API SpellEvent : public BasicEvent
@@ -2717,6 +2718,8 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask)
if (duration > 0)
{
duration *= m_spellValue->DurationMul;
// Haste modifies duration of channeled spells
if (m_spellInfo->IsChanneled())
m_originalCaster->ModSpellDurationTime(m_spellInfo, duration, this);
@@ -3433,6 +3436,8 @@ void Spell::handle_immediate()
if (Player* modOwner = m_caster->GetSpellModOwner())
modOwner->ApplySpellMod(m_spellInfo, SpellModOp::Duration, duration);
duration *= m_spellValue->DurationMul;
// Apply haste mods
m_caster->ModSpellDurationTime(m_spellInfo, duration, this);
@@ -7555,6 +7560,9 @@ void Spell::SetSpellValue(SpellValueMod mod, int32 value)
case SPELLVALUE_AURA_STACK:
m_spellValue->AuraStackAmount = uint8(value);
break;
case SPELLVALUE_DURATION_PCT:
m_spellValue->DurationMul = float(value) / 100.0f;
break;
default:
break;
}

View File

@@ -305,6 +305,7 @@ struct SpellValue
uint32 MaxAffectedTargets;
float RadiusMod;
int32 AuraStackAmount;
float DurationMul;
};
enum SpellState

View File

@@ -211,7 +211,8 @@ enum SpellValueMod : uint8
SPELLVALUE_BASE_POINT_END,
SPELLVALUE_RADIUS_MOD,
SPELLVALUE_MAX_TARGETS,
SPELLVALUE_AURA_STACK
SPELLVALUE_AURA_STACK,
SPELLVALUE_DURATION_PCT
};
enum SpellFacingFlags