Core/Spells: Allow overriding aura stack amount from CastCustomSpell

This commit is contained in:
Shauren
2011-05-21 21:36:37 +02:00
parent 1e783cc446
commit 78ea0075e1
4 changed files with 12 additions and 24 deletions
+1
View File
@@ -131,6 +131,7 @@ enum SpellValueMod
SPELLVALUE_BASE_POINT2, SPELLVALUE_BASE_POINT2,
SPELLVALUE_RADIUS_MOD, SPELLVALUE_RADIUS_MOD,
SPELLVALUE_MAX_TARGETS, SPELLVALUE_MAX_TARGETS,
SPELLVALUE_AURA_STACK,
}; };
typedef std::pair<SpellValueMod, int32> CustomSpellValueMod; typedef std::pair<SpellValueMod, int32> CustomSpellValueMod;
+7 -1
View File
@@ -1483,6 +1483,9 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask, bool
m_originalCaster, (aurSpellInfo == m_spellInfo)? &m_spellValue->EffectBasePoints[0] : &basePoints[0], m_CastItem); m_originalCaster, (aurSpellInfo == m_spellInfo)? &m_spellValue->EffectBasePoints[0] : &basePoints[0], m_CastItem);
if (m_spellAura) if (m_spellAura)
{ {
// Set aura stack amount to desired value
m_spellAura->SetStackAmount(m_spellValue->AuraStackAmount);
// Now Reduce spell duration using data received at spell hit // Now Reduce spell duration using data received at spell hit
int32 duration = m_spellAura->GetMaxDuration(); int32 duration = m_spellAura->GetMaxDuration();
int32 limitduration = GetDiminishingReturnsLimitDuration(m_diminishGroup, aurSpellInfo); int32 limitduration = GetDiminishingReturnsLimitDuration(m_diminishGroup, aurSpellInfo);
@@ -7034,7 +7037,7 @@ SpellCastResult Spell::CanOpenLock(uint32 effIndex, uint32 lockId, SkillType& sk
void Spell::SetSpellValue(SpellValueMod mod, int32 value) void Spell::SetSpellValue(SpellValueMod mod, int32 value)
{ {
switch(mod) switch (mod)
{ {
case SPELLVALUE_BASE_POINT0: case SPELLVALUE_BASE_POINT0:
m_spellValue->EffectBasePoints[0] = SpellMgr::CalculateSpellEffectBaseAmount(value, m_spellInfo, 0); m_spellValue->EffectBasePoints[0] = SpellMgr::CalculateSpellEffectBaseAmount(value, m_spellInfo, 0);
@@ -7051,6 +7054,9 @@ void Spell::SetSpellValue(SpellValueMod mod, int32 value)
case SPELLVALUE_MAX_TARGETS: case SPELLVALUE_MAX_TARGETS:
m_spellValue->MaxAffectedTargets = (uint32)value; m_spellValue->MaxAffectedTargets = (uint32)value;
break; break;
case SPELLVALUE_AURA_STACK:
m_spellValue->AuraStackAmount = uint8(value);
break;
} }
} }
+3 -1
View File
@@ -239,16 +239,18 @@ class SpellCastTargets
struct SpellValue struct SpellValue
{ {
explicit SpellValue(SpellEntry const *proto) explicit SpellValue(SpellEntry const* proto)
{ {
for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i) for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
EffectBasePoints[i] = proto->EffectBasePoints[i]; EffectBasePoints[i] = proto->EffectBasePoints[i];
MaxAffectedTargets = proto->MaxAffectedTargets; MaxAffectedTargets = proto->MaxAffectedTargets;
RadiusMod = 1.0f; RadiusMod = 1.0f;
AuraStackAmount = 1;
} }
int32 EffectBasePoints[3]; int32 EffectBasePoints[3];
uint32 MaxAffectedTargets; uint32 MaxAffectedTargets;
float RadiusMod; float RadiusMod;
uint8 AuraStackAmount;
}; };
enum SpellState enum SpellState
@@ -257,7 +257,7 @@ class boss_professor_putricide : public CreatureScript
// no possible aura seen in sniff adding the aurastate // no possible aura seen in sniff adding the aurastate
summon->SetFlag(UNIT_FIELD_AURASTATE, 1 << (AURA_STATE_UNKNOWN22 - 1)); summon->SetFlag(UNIT_FIELD_AURASTATE, 1 << (AURA_STATE_UNKNOWN22 - 1));
summon->CastSpell(summon, SPELL_GASEOUS_BLOAT_PROC, true); summon->CastSpell(summon, SPELL_GASEOUS_BLOAT_PROC, true);
summon->CastSpell(summon, SPELL_GASEOUS_BLOAT, false); summon->CastCustomSpell(SPELL_GASEOUS_BLOAT, SPELLVALUE_AURA_STACK, 10, summon, false);
summon->SetReactState(REACT_PASSIVE); summon->SetReactState(REACT_PASSIVE);
return; return;
case NPC_VOLATILE_OOZE: case NPC_VOLATILE_OOZE:
@@ -710,22 +710,6 @@ class spell_putricide_gaseous_bloat : public SpellScriptLoader
public: public:
spell_putricide_gaseous_bloat() : SpellScriptLoader("spell_putricide_gaseous_bloat") { } spell_putricide_gaseous_bloat() : SpellScriptLoader("spell_putricide_gaseous_bloat") { }
class spell_putricide_gaseous_bloat_SpellScript : public SpellScript
{
PrepareSpellScript(spell_putricide_gaseous_bloat_SpellScript);
void ModAuraStack()
{
if (Aura* aur = GetHitAura())
aur->SetStackAmount(10);
}
void Register()
{
AfterHit += SpellHitFn(spell_putricide_gaseous_bloat_SpellScript::ModAuraStack);
}
};
class spell_putricide_gaseous_bloat_AuraScript : public AuraScript class spell_putricide_gaseous_bloat_AuraScript : public AuraScript
{ {
PrepareAuraScript(spell_putricide_gaseous_bloat_AuraScript); PrepareAuraScript(spell_putricide_gaseous_bloat_AuraScript);
@@ -745,11 +729,6 @@ class spell_putricide_gaseous_bloat : public SpellScriptLoader
} }
}; };
SpellScript* GetSpellScript() const
{
return new spell_putricide_gaseous_bloat_SpellScript();
}
AuraScript* GetAuraScript() const AuraScript* GetAuraScript() const
{ {
return new spell_putricide_gaseous_bloat_AuraScript(); return new spell_putricide_gaseous_bloat_AuraScript();