aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGreymane <rubenmussi@hotmail.com>2012-08-16 19:55:01 +0100
committerNay <dnpd.dd@gmail.com>2012-08-16 19:55:01 +0100
commit759e73c78f138094a28068286d2f44c9e1162bb6 (patch)
tree1540e61f92117ccb40999a3e99ce866802523125 /src
parent43bae31ff835fb0e880ff168acb0de716244d881 (diff)
Core/Spells:
* Implemented aura 328 SPELL_AURA_PROC_ON_POWER_AMOUNT. * Added eclipse power energize handling. Closes #7417
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Entities/Player/Player.cpp16
-rwxr-xr-xsrc/server/game/Entities/Unit/Unit.cpp159
-rwxr-xr-xsrc/server/game/Entities/Unit/Unit.h4
-rwxr-xr-xsrc/server/game/Spells/Auras/SpellAuraDefines.h2
-rw-r--r--src/server/game/Spells/Auras/SpellAuraEffects.cpp2
-rwxr-xr-xsrc/server/game/Spells/Auras/SpellAuras.cpp4
-rw-r--r--src/server/game/Spells/SpellMgr.cpp6
-rw-r--r--src/server/scripts/Spells/spell_druid.cpp125
8 files changed, 291 insertions, 27 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 3d204eaec6a..5fad57c3b0d 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -2391,6 +2391,7 @@ void Player::ProcessDelayedOperations()
SetPower(POWER_RAGE, 0);
SetPower(POWER_ENERGY, GetMaxPower(POWER_ENERGY));
+ SetPower(POWER_ECLIPSE, 0);
SpawnCorpseBones();
}
@@ -2741,6 +2742,9 @@ void Player::ResetAllPowers()
case POWER_RUNIC_POWER:
SetPower(POWER_RUNIC_POWER, 0);
break;
+ case POWER_ECLIPSE:
+ SetPower(POWER_ECLIPSE, 0);
+ break;
default:
break;
}
@@ -5147,6 +5151,7 @@ void Player::ResurrectPlayer(float restore_percent, bool applySickness)
SetPower(POWER_RAGE, 0);
SetPower(POWER_ENERGY, uint32(GetMaxPower(POWER_ENERGY)*restore_percent));
SetPower(POWER_FOCUS, uint32(GetMaxPower(POWER_FOCUS)*restore_percent));
+ SetPower(POWER_ECLIPSE, 0);
}
// trigger update zone for alive state zone updates
@@ -18652,7 +18657,12 @@ void Player::SaveToDB(bool create /*=false*/)
{
if (GetPowerIndexByClass(Powers(i), getClass()) != MAX_POWERS)
{
+ // Eclipse Power isnt saved.
+ if (i == POWER_ECLIPSE)
+ continue;
+
stmt->setUInt32(index++, GetUInt32Value(UNIT_FIELD_POWER1 + storedPowers));
+
if (++storedPowers >= MAX_STORED_POWERS)
break;
}
@@ -18774,7 +18784,12 @@ void Player::SaveToDB(bool create /*=false*/)
{
if (GetPowerIndexByClass(Powers(i), getClass()) != MAX_POWERS)
{
+ // Eclipse Power isnt saved.
+ if (i == POWER_ECLIPSE)
+ continue;
+
stmt->setUInt32(index++, GetUInt32Value(UNIT_FIELD_POWER1 + storedPowers));
+
if (++storedPowers >= MAX_STORED_POWERS)
break;
}
@@ -23175,6 +23190,7 @@ void Player::ResurectUsingRequestData()
SetPower(POWER_RAGE, 0);
SetPower(POWER_ENERGY, GetMaxPower(POWER_ENERGY));
SetPower(POWER_FOCUS, GetMaxPower(POWER_FOCUS));
+ SetPower(POWER_ECLIPSE, 0);
SpawnCorpseBones();
}
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 5ce424738b2..5a4cba9d58b 100755
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -4978,6 +4978,127 @@ bool Unit::HandleSpellCritChanceAuraProc(Unit* victim, uint32 /*damage*/, AuraEf
return true;
}
+bool Unit::HandleAuraProcOnPowerAmount(Unit* victim, uint32 damage, AuraEffect* triggeredByAura, SpellInfo const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown)
+{
+ // Get triggered aura spell info
+ SpellInfo const* auraSpellInfo = triggeredByAura->GetSpellInfo();
+
+ // Get effect index used for the proc
+ uint32 effIndex = triggeredByAura->GetEffIndex();
+
+ // Power amount required to proc the spell
+ int32 powerAmountRequired = triggeredByAura->GetAmount();
+ // Power type required to proc
+ Powers powerRequired = Powers(auraSpellInfo->Effects[triggeredByAura->GetEffIndex()].MiscValue);
+
+ // Set trigger spell id, target, custom basepoints
+ uint32 trigger_spell_id = auraSpellInfo->Effects[triggeredByAura->GetEffIndex()].TriggerSpell;
+
+ Unit* target = NULL;
+ int32 basepoints0 = 0;
+
+ Item* castItem = triggeredByAura->GetBase()->GetCastItemGUID() && GetTypeId() == TYPEID_PLAYER
+ ? ToPlayer()->GetItemByGuid(triggeredByAura->GetBase()->GetCastItemGUID()) : NULL;
+
+ /* Try handle unknown trigger spells or with invalid power amount or misc value
+ if (sSpellMgr->GetSpellInfo(trigger_spell_id) == NULL || powerAmountRequired == NULL || powerRequired >= MAX_POWER)
+ {
+ switch (auraSpellInfo->SpellFamilyName)
+ {
+ case SPELLFAMILY_GENERIC:
+ {
+ break;
+ }
+ }
+ }*/
+
+ // All ok. Check current trigger spell
+ SpellInfo const* triggerEntry = sSpellMgr->GetSpellInfo(trigger_spell_id);
+ if (triggerEntry == NULL)
+ {
+ // Not cast unknown spell
+ // sLog->outError("Unit::HandleAuraProcOnPowerAmount: Spell %u have 0 in EffectTriggered[%d], not handled custom case?", auraSpellInfo->Id, triggeredByAura->GetEffIndex());
+ return false;
+ }
+
+ // not allow proc extra attack spell at extra attack
+ if (m_extraAttacks && triggerEntry->HasEffect(SPELL_EFFECT_ADD_EXTRA_ATTACKS))
+ return false;
+
+ if (powerRequired == NULL || powerAmountRequired == NULL)
+ {
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Unit::HandleAuraProcOnPowerAmount: Spell %u have 0 powerAmountRequired in EffectAmount[%d] or 0 powerRequired in EffectMiscValue, not handled custom case?", auraSpellInfo->Id, triggeredByAura->GetEffIndex());
+ return false;
+ }
+
+ if (GetPower(powerRequired) != powerAmountRequired)
+ return false;
+
+ // Custom requirements (not listed in procEx) Warning! damage dealing after this
+ // Custom triggered spells
+ switch (auraSpellInfo->SpellFamilyName)
+ {
+ case SPELLFAMILY_DRUID:
+ {
+ // Eclipse Mastery Driver Passive
+ if (auraSpellInfo->Id == 79577)
+ {
+ uint32 solarEclipseMarker = 67483;
+ uint32 lunarEclipseMarker = 67484;
+
+ switch(effIndex)
+ {
+ case 0:
+ {
+ // Do not proc if proc spell isnt starfire and starsurge
+ if (procSpell->Id != 2912 && procSpell->Id != 78674)
+ return false;
+
+ if (HasAura(solarEclipseMarker))
+ {
+ RemoveAurasDueToSpell(solarEclipseMarker);
+ CastSpell(this,lunarEclipseMarker,true);
+ }
+ break;
+ }
+ case 1:
+ {
+ // Do not proc if proc spell isnt wrath and starsurge
+ if (procSpell->Id != 5176 && procSpell->Id != 78674)
+ return false;
+
+ if (HasAura(lunarEclipseMarker))
+ {
+ RemoveAurasDueToSpell(lunarEclipseMarker);
+ CastSpell(this,solarEclipseMarker,true);
+ }
+
+ break;
+ }
+ }
+ }
+ break;
+ }
+ }
+
+ if (cooldown && GetTypeId() == TYPEID_PLAYER && ToPlayer()->HasSpellCooldown(trigger_spell_id))
+ return false;
+
+ // try detect target manually if not set
+ if (target == NULL)
+ target = !(procFlag & (PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS | PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_POS)) && triggerEntry && triggerEntry->IsPositive() ? this : victim;
+
+ if (basepoints0)
+ CastCustomSpell(target, trigger_spell_id, &basepoints0, NULL, NULL, true, castItem, triggeredByAura);
+ else
+ CastSpell(target, trigger_spell_id, true, castItem, triggeredByAura);
+
+ if (cooldown && GetTypeId() == TYPEID_PLAYER)
+ ToPlayer()->AddSpellCooldown(trigger_spell_id, 0, time(NULL) + cooldown);
+
+ return true;
+}
+
//victim may be NULL
bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggeredByAura, SpellInfo const* procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown)
{
@@ -6218,26 +6339,8 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
return true;
}
}
- // Eclipse
- if (dummySpell->SpellIconID == 2856 && GetTypeId() == TYPEID_PLAYER)
- {
- if (!procSpell || effIndex != 0)
- return false;
-
- bool isWrathSpell = (procSpell->SpellFamilyFlags[0] & 1);
-
- if (!roll_chance_f(dummySpell->ProcChance * (isWrathSpell ? 0.6f : 1.0f)))
- return false;
-
- target = this;
- if (target->HasAura(isWrathSpell ? 48517 : 48518))
- return false;
-
- triggered_spell_id = isWrathSpell ? 48518 : 48517;
- break;
- }
// Living Seed
- else if (dummySpell->SpellIconID == 2860)
+ if (dummySpell->SpellIconID == 2860)
{
triggered_spell_id = 48504;
basepoints0 = CalculatePctN(int32(damage), triggerAmount);
@@ -9639,7 +9742,7 @@ void Unit::SendEnergizeSpellLog(Unit* victim, uint32 spellID, uint32 damage, Pow
SendMessageToSet(&data, true);
}
-void Unit::EnergizeBySpell(Unit* victim, uint32 spellID, uint32 damage, Powers powerType)
+void Unit::EnergizeBySpell(Unit* victim, uint32 spellID, int32 damage, Powers powerType)
{
SendEnergizeSpellLog(victim, spellID, damage, powerType);
// needs to be called after sending spell log
@@ -11732,9 +11835,9 @@ int32 Unit::ModifyPower(Powers power, int32 dVal)
int32 curPower = (int32)GetPower(power);
int32 val = dVal + curPower;
- if (val <= 0)
+ if (val <= GetMinPower(power))
{
- SetPower(power, 0);
+ SetPower(power, GetMinPower(power));
return -curPower;
}
@@ -13315,7 +13418,7 @@ void Unit::SetPower(Powers power, int32 val)
if (maxPower < val)
val = maxPower;
- SetStatInt32Value(UNIT_FIELD_POWER1 + powerIndex, val);
+ SetInt32Value(UNIT_FIELD_POWER1 + powerIndex, val);
if (IsInWorld())
{
@@ -13351,7 +13454,7 @@ void Unit::SetMaxPower(Powers power, int32 val)
return;
int32 cur_power = GetPower(power);
- SetStatInt32Value(UNIT_FIELD_MAXPOWER1 + powerIndex, val);
+ SetInt32Value(UNIT_FIELD_MAXPOWER1 + powerIndex, val);
// group update
if (GetTypeId() == TYPEID_PLAYER)
@@ -13808,6 +13911,7 @@ bool InitTriggerAuraData()
isNonTriggerAura[i] = false;
isAlwaysTriggeredAura[i] = false;
}
+ isTriggerAura[SPELL_AURA_PROC_ON_POWER_AMOUNT] = true;
isTriggerAura[SPELL_AURA_DUMMY] = true;
isTriggerAura[SPELL_AURA_MOD_CONFUSE] = true;
isTriggerAura[SPELL_AURA_MOD_THREAT] = true;
@@ -14095,6 +14199,13 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u
takeCharges = true;
break;
}
+ case SPELL_AURA_PROC_ON_POWER_AMOUNT:
+ {
+ sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "ProcDamageAndSpell: casting spell id %u (triggered by %s aura of spell %u)", spellInfo->Id, (isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId());
+ if (HandleAuraProcOnPowerAmount(target, damage, triggeredByAura, procSpell, procFlag, procExtra, cooldown))
+ takeCharges = true;
+ break;
+ }
case SPELL_AURA_OBS_MOD_POWER:
sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "ProcDamageAndSpell: casting spell id %u (triggered by %s aura of spell %u)", spellInfo->Id, (isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId());
if (HandleObsModEnergyAuraProc(target, damage, triggeredByAura, procSpell, procFlag, procExtra, cooldown))
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index addf99a03ac..cafbfaac5b1 100755
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -1344,6 +1344,7 @@ class Unit : public WorldObject
Powers getPowerType() const { return Powers(GetByteValue(UNIT_FIELD_BYTES_0, 3)); }
void setPowerType(Powers power);
int32 GetPower(Powers power) const;
+ int32 GetMinPower(Powers power) const { return power == POWER_ECLIPSE ? -100 : 0; }
uint32 GetMaxPower(Powers power) const;
void SetPower(Powers power, int32 val);
void SetMaxPower(Powers power, int32 val);
@@ -1555,7 +1556,7 @@ class Unit : public WorldObject
void SendHealSpellLog(Unit* victim, uint32 SpellID, uint32 Damage, uint32 OverHeal, uint32 Absorb, bool critical = false);
int32 HealBySpell(Unit* victim, SpellInfo const* spellInfo, uint32 addHealth, bool critical = false);
void SendEnergizeSpellLog(Unit* victim, uint32 SpellID, uint32 Damage, Powers powertype);
- void EnergizeBySpell(Unit* victim, uint32 SpellID, uint32 Damage, Powers powertype);
+ void EnergizeBySpell(Unit* victim, uint32 SpellID, int32 Damage, Powers powertype);
uint32 SpellNonMeleeDamageLog(Unit* victim, uint32 spellID, uint32 damage);
void CastSpell(SpellCastTargets const& targets, SpellInfo const* spellInfo, CustomSpellValues const* value, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
@@ -2306,6 +2307,7 @@ class Unit : public WorldObject
void DisableSpline();
private:
bool IsTriggeredAtSpellProcEvent(Unit* victim, Aura* aura, SpellInfo const* procSpell, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, bool isVictim, bool active, SpellProcEventEntry const* & spellProcEvent);
+ bool HandleAuraProcOnPowerAmount(Unit* victim, uint32 damage, AuraEffect* triggeredByAura, SpellInfo const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown);
bool HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggeredByAura, SpellInfo const* procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown);
bool HandleHasteAuraProc(Unit* victim, uint32 damage, AuraEffect* triggeredByAura, SpellInfo const* procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown);
bool HandleSpellCritChanceAuraProc(Unit* victim, uint32 damage, AuraEffect* triggredByAura, SpellInfo const* procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown);
diff --git a/src/server/game/Spells/Auras/SpellAuraDefines.h b/src/server/game/Spells/Auras/SpellAuraDefines.h
index 04809277eb4..c261636e5b6 100755
--- a/src/server/game/Spells/Auras/SpellAuraDefines.h
+++ b/src/server/game/Spells/Auras/SpellAuraDefines.h
@@ -387,7 +387,7 @@ enum AuraType
SPELL_AURA_325 = 325,
SPELL_AURA_326 = 326, // phase related
SPELL_AURA_327 = 327,
- SPELL_AURA_328 = 328,
+ SPELL_AURA_PROC_ON_POWER_AMOUNT = 328,
SPELL_AURA_MOD_RUNE_REGEN_SPEED = 329, // NYI
SPELL_AURA_CAST_WHILE_WALKING = 330, // NYI
SPELL_AURA_331 = 331,
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index e1b152735b9..edfc55dec44 100644
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -381,7 +381,7 @@ pAuraEffectHandler AuraEffectHandler[TOTAL_AURAS]=
&AuraEffect::HandleNULL, //325 SPELL_AURA_325
&AuraEffect::HandleNULL, //326 SPELL_AURA_326
&AuraEffect::HandleNULL, //327 SPELL_AURA_327
- &AuraEffect::HandleNULL, //328 SPELL_AURA_328
+ &AuraEffect::HandleNoImmediateEffect, //328 SPELL_AURA_PROC_ON_POWER_AMOUNT implemented in Unit::HandleAuraProcOnPowerAmount
&AuraEffect::HandleNULL, //329 SPELL_AURA_MOD_RUNE_REGEN_SPEED
&AuraEffect::HandleNULL, //330 SPELL_AURA_CAST_WHILE_WALKING
&AuraEffect::HandleNULL, //331 SPELL_AURA_331
diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp
index f5b9c5b2cf2..3409d135849 100755
--- a/src/server/game/Spells/Auras/SpellAuras.cpp
+++ b/src/server/game/Spells/Auras/SpellAuras.cpp
@@ -921,6 +921,10 @@ bool Aura::CanBeSaved() const
if (GetId() == 44413)
return false;
+ // When a druid logins, he doesnt have either eclipse power, nor the marker auras, nor the eclipse buffs. Dont save them.
+ if (GetId() == 67483 || GetId() == 67484 || GetId() == 48517 || GetId() == 48518)
+ return false;
+
// don't save auras removed by proc system
if (IsUsingCharges() && !GetCharges())
return false;
diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp
index fda59f27e0e..9f8e0943b1e 100644
--- a/src/server/game/Spells/SpellMgr.cpp
+++ b/src/server/game/Spells/SpellMgr.cpp
@@ -3226,6 +3226,12 @@ void SpellMgr::LoadDbcDataCorrections()
case 53246: // Marked for Death (Rank 5)
spellInfo->EffectSpellClassMask[0] = flag96(0x00067801, 0x10820001, 0x00000801);
break;
+ case 5176: // Wrath
+ case 2912: // Starfire
+ case 78674: // Starsurge
+ spellInfo->Effects[1].Effect = SPELL_EFFECT_DUMMY;
+ spellInfo->Effects[1].TargetA = TARGET_UNIT_CASTER;
+ break;
case 70728: // Exploit Weakness (needs target selection script)
case 70840: // Devious Minds (needs target selection script)
spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_CASTER;
diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp
index 0bd7397f1d4..cdfb62bd55c 100644
--- a/src/server/scripts/Spells/spell_druid.cpp
+++ b/src/server/scripts/Spells/spell_druid.cpp
@@ -644,6 +644,130 @@ class spell_dru_insect_swarm : public SpellScriptLoader
}
};
+enum EclipseSpells
+{
+ SPELL_DRUID_WRATH = 5176,
+ SPELL_DRUID_STARFIRE = 2912,
+ SPELL_DRUID_STARSURGE = 78674,
+ SPELL_DRUID_ECLIPSE_GENERAL_ENERGIZE = 89265,
+ SPELL_DRUID_STARSURGE_ENERGIZE = 86605,
+ SPELL_DRUID_LUNAR_ECLIPSE_MARKER = 67484, // Will make the yellow arrow on eclipse bar point to the blue side (lunar)
+ SPELL_DRUID_SOLAR_ECLIPSE_MARKER = 67483, // Will make the yellow arrow on eclipse bar point to the yellow side (solar)
+ SPELL_DRUID_SOLAR_ECLIPSE = 48517,
+ SPELL_DRUID_LUNAR_ECLIPSE = 48518,
+ TALENT_TREE_BALANCE = 752,
+};
+
+// Wrath, Starfire, and Starsurge
+class spell_dru_eclipse_energize : public SpellScriptLoader
+{
+public:
+ spell_dru_eclipse_energize() : SpellScriptLoader("spell_dru_eclipse_energize") { }
+
+ class spell_dru_eclipse_energize_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_dru_eclipse_energize_SpellScript);
+
+ int32 energizeAmount;
+
+ bool Load()
+ {
+ if (GetCaster()->GetTypeId() != TYPEID_PLAYER)
+ return false;
+
+ if (GetCaster()->ToPlayer()->getClass() != CLASS_DRUID)
+ return false;
+
+ energizeAmount = 0;
+
+ return true;
+ }
+
+ void HandleEnergize(SpellEffIndex effIndex)
+ {
+ Player* caster = GetCaster()->ToPlayer();
+
+ // No boomy, no deal.
+ if (caster->GetPrimaryTalentTree(caster->GetActiveSpec()) != TALENT_TREE_BALANCE)
+ return;
+
+ switch(GetSpellInfo()->Id)
+ {
+ case SPELL_DRUID_WRATH:
+ {
+ energizeAmount = -GetSpellInfo()->Effects[effIndex].BasePoints; // -13
+ // If we are set to fill the lunar side or we've just logged in with 0 power..
+ if ((!caster->HasAura(SPELL_DRUID_SOLAR_ECLIPSE_MARKER) && caster->HasAura(SPELL_DRUID_LUNAR_ECLIPSE_MARKER))
+ || caster->GetPower(POWER_ECLIPSE) == 0)
+ {
+ caster->CastCustomSpell(caster,SPELL_DRUID_ECLIPSE_GENERAL_ENERGIZE,&energizeAmount,0,0,true);
+ // If the energize was due to 0 power, cast the eclipse marker aura
+ if (!caster->HasAura(SPELL_DRUID_LUNAR_ECLIPSE_MARKER))
+ caster->CastSpell(caster,SPELL_DRUID_LUNAR_ECLIPSE_MARKER,true);
+ }
+ // The energizing effect brought us out of the solar eclipse, remove the aura
+ if (caster->HasAura(SPELL_DRUID_SOLAR_ECLIPSE) && caster->GetPower(POWER_ECLIPSE) <= 0)
+ caster->RemoveAurasDueToSpell(SPELL_DRUID_SOLAR_ECLIPSE);
+ break;
+ }
+ case SPELL_DRUID_STARFIRE:
+ {
+ energizeAmount = GetSpellInfo()->Effects[effIndex].BasePoints; // 20
+ // If we are set to fill the solar side or we've just logged in with 0 power..
+ if ((!caster->HasAura(SPELL_DRUID_LUNAR_ECLIPSE_MARKER) && caster->HasAura(SPELL_DRUID_SOLAR_ECLIPSE_MARKER))
+ || caster->GetPower(POWER_ECLIPSE) == 0)
+ {
+ caster->CastCustomSpell(caster,SPELL_DRUID_ECLIPSE_GENERAL_ENERGIZE,&energizeAmount,0,0,true);
+ // If the energize was due to 0 power, cast the eclipse marker aura
+ if (!caster->HasAura(SPELL_DRUID_SOLAR_ECLIPSE_MARKER))
+ caster->CastSpell(caster,SPELL_DRUID_SOLAR_ECLIPSE_MARKER,true);
+ }
+ // The energizing effect brought us out of the lunar eclipse, remove the aura
+ if (caster->HasAura(SPELL_DRUID_LUNAR_ECLIPSE) && caster->GetPower(POWER_ECLIPSE) >= 0)
+ caster->RemoveAura(SPELL_DRUID_LUNAR_ECLIPSE);
+ break;
+ }
+ case SPELL_DRUID_STARSURGE:
+ {
+ // If we are set to fill the solar side or we've just logged in with 0 power (confirmed with sniffs)
+ if ((!caster->HasAura(SPELL_DRUID_LUNAR_ECLIPSE_MARKER) && caster->HasAura(SPELL_DRUID_SOLAR_ECLIPSE_MARKER))
+ || caster->GetPower(POWER_ECLIPSE) == 0)
+ {
+ energizeAmount = GetSpellInfo()->Effects[effIndex].BasePoints; // 15
+ caster->CastCustomSpell(caster,SPELL_DRUID_STARSURGE_ENERGIZE,&energizeAmount,0,0,true);
+
+ // If the energize was due to 0 power, cast the eclipse marker aura
+ if (!caster->HasAura(SPELL_DRUID_SOLAR_ECLIPSE_MARKER))
+ caster->CastSpell(caster,SPELL_DRUID_SOLAR_ECLIPSE_MARKER,true);
+ }
+ else if (!caster->HasAura(SPELL_DRUID_SOLAR_ECLIPSE_MARKER) && caster->HasAura(SPELL_DRUID_LUNAR_ECLIPSE_MARKER))
+ {
+ energizeAmount = -GetSpellInfo()->Effects[effIndex].BasePoints; // -15
+ caster->CastCustomSpell(caster,SPELL_DRUID_STARSURGE_ENERGIZE,&energizeAmount,0,0,true);
+ }
+ // The energizing effect brought us out of the lunar eclipse, remove the aura
+ if (caster->HasAura(SPELL_DRUID_LUNAR_ECLIPSE) && caster->GetPower(POWER_ECLIPSE) >= 0)
+ caster->RemoveAura(SPELL_DRUID_LUNAR_ECLIPSE);
+ // The energizing effect brought us out of the solar eclipse, remove the aura
+ else if (caster->HasAura(SPELL_DRUID_SOLAR_ECLIPSE) && caster->GetPower(POWER_ECLIPSE) <= 0)
+ caster->RemoveAura(SPELL_DRUID_SOLAR_ECLIPSE);
+ break;
+ }
+ }
+ }
+
+ void Register()
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_dru_eclipse_energize_SpellScript::HandleEnergize, EFFECT_1, SPELL_EFFECT_DUMMY);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_dru_eclipse_energize_SpellScript;
+ }
+};
+
void AddSC_druid_spell_scripts()
{
new spell_dru_glyph_of_starfire();
@@ -659,4 +783,5 @@ void AddSC_druid_spell_scripts()
new spell_dru_savage_roar();
new spell_dru_survival_instincts();
new spell_dru_insect_swarm();
+ new spell_dru_eclipse_energize();
}