Example #1
0
 void HandleOnHit()
 {
     if (Player* _player = GetCaster()->ToPlayer())
         if (_player->HasAuraState(AURA_STATE_ENRAGE))
             _player->EnergizeBySpell(_player, GetSpellInfo()->Id, 600, POWER_RAGE);
 }
Example #2
0
 bool Load()
 {
     healPct = GetSpellInfo()->Effects[EFFECT_1].CalcValue();
     return true;
 }
Example #3
0
 bool Load()
 {
     // Max absorb stored in 1 dummy effect
     limit = GetSpellInfo()->Effects[EFFECT_1].CalcValue();
     return true;
 }
Example #4
0
 bool Load()
 {
     healPct = GetSpellInfo()->Effects[EFFECT_1].CalcValue();
     absorbPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue();
     return GetUnitOwner()->GetTypeId() == TYPEID_PLAYER;
 }
Example #5
0
 bool Load()
 {
     absorbChance = GetSpellInfo()->Effects[EFFECT_0].CalcValue();
     return GetUnitOwner()->ToPlayer();
 }
Example #6
0
 void HandleDummyLaunch(SpellEffIndex /*effIndex*/)
 {
     sLog->outString("Spell %u with SPELL_EFFECT_DUMMY is just launched!", GetSpellInfo()->Id);
 }
Example #7
0
 void HandleDummyHit(SpellEffIndex /*effIndex*/)
 {
     sLog->outString("Spell %u with SPELL_EFFECT_DUMMY has hit!", GetSpellInfo()->Id);
 }
Example #8
0
 void HandleDummy(SpellEffIndex /*effIndex*/)
 {
     if (Unit* unitTarget = GetHitUnit())
     {
         int32 bp0 = 0;
         int32 bp1 = 0;
         // Living ghoul as a target
         if (unitTarget->isAlive())
         {
             bp0 = int32(unitTarget->CountPctFromMaxHealth(25));
             bp1 = int32(unitTarget->CountPctFromMaxHealth(200));
             unitTarget->CastCustomSpell(unitTarget, DK_SPELL_PET_EXPLODE, &bp0, &bp1, NULL, false);
         }
         // Some corpse
         else
         {
             bp0 = GetEffectValue();
             GetCaster()->CastCustomSpell(unitTarget, SpellMgr::CalculateSpellEffectAmount(GetSpellInfo(), 1), &bp0, NULL, NULL, true);
             // Set corpse look
             unitTarget->SetDisplayId(DISPLAY_GHOUL_CORPSE + urand(0, 3));
         }
     }
 }
Example #9
0
 void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
 {
     if (Player* player = GetTarget()->ToPlayer())
         if (AuraEffect const* glyph = player->GetAuraEffect(SPELL_DK_GLYPH_OF_REGENERATIVE_MAGIC, EFFECT_0)) // reduce cooldown of AMS if player has glyph
         {
             // Cannot reduce cooldown by more than 50%
             int32 val = std::min(glyph->GetAmount(), int32(absorbedAmount) * 100 / maxHealth);
             player->GetSpellHistory()->ModifyCooldown(GetId(), -int32(player->GetSpellHistory()->GetRemainingCooldown(GetSpellInfo()) * val / 100));
         }
 }
Example #10
0
 SpellCastResult CheckCast()
 {
     if (int32(GetCaster()->GetHealth()) > int32(GetCaster()->CountPctFromMaxHealth(GetSpellInfo()->Effects[EFFECT_2].CalcValue())))
         return SPELL_CAST_OK;
     return SPELL_FAILED_FIZZLE;
 }
 void CalculateAmount(AuraEffect const* /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/)
 {
     if (AuraEffect* aurEff = GetUnitOwner()->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_PET, GetSpellInfo()->SpellIconID, EFFECT_0))
         AddPct(amount, aurEff->GetAmount());
 }
Example #12
0
 void HandleHit(SpellEffIndex /*effIndex*/)
 {
     if (AuraEffect const* aurEff = GetHitUnit()->GetAuraEffect(SPELL_WARLOCK_IMMOLATE, EFFECT_2, GetCaster()->GetGUID()))
         SetHitDamage(CalculatePct(aurEff->GetAmount(), GetSpellInfo()->Effects[EFFECT_1].CalcValue(GetCaster())));
 }
Example #13
0
 SpellCastResult CheckCast()
 {
     if ((int32(GetCaster()->GetHealth()) > int32(GetSpellInfo()->Effects[EFFECT_0].CalcValue() + (6.3875 * GetSpellInfo()->BaseLevel))))
         return SPELL_CAST_OK;
     return SPELL_FAILED_FIZZLE;
 }
Example #14
0
            void HandleEffectBearProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
            {
                PreventDefaultAction();
                if (GetTarget()->GetShapeshiftForm() != FORM_BEAR || eventInfo.GetDamageInfo()->GetSpellInfo()->Id != SPELL_DRUID_FERAL_CHARGE_BEAR)
                    return;

                GetTarget()->CastSpell(GetTarget(), sSpellMgr->GetSpellWithRank(SPELL_DRUID_STAMPEDE_BAER_RANK_1, GetSpellInfo()->GetRank()), true, NULL, aurEff);
            }
Example #15
0
        void HandleEnergize(SpellEffIndex effIndex)
        {
            Player* caster = GetCaster()->ToPlayer();

            // No boomy, no deal.
            if (caster->GetPrimaryTalentTree(caster->GetActiveSpec()) != TALENT_TREE_DRUID_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;
                }
            }
        }
Example #16
0
 void HandlePeriodic(AuraEffect const* aurEff)
 {
     PreventDefaultAction();
     if (aurEff->GetAmount() <= 0)
     {
         Unit* target = GetTarget();
         uint32 spellId = SPELL_HUNTER_SNIPER_TRAINING_BUFF_R1 + GetId() - SPELL_HUNTER_SNIPER_TRAINING_R1;
         target->CastSpell(target, spellId, true, 0, aurEff);
         if (Player* playerTarget = GetUnitOwner()->ToPlayer())
         {
             int32 baseAmount = aurEff->GetBaseAmount();
             int32 amount = playerTarget->CalculateSpellDamage(playerTarget, GetSpellInfo(), aurEff->GetEffIndex(), &baseAmount);
             GetEffect(EFFECT_0)->SetAmount(amount);
         }
     }
 }
 bool Load() override
 {
     absorbChance = GetSpellInfo()->Effects[EFFECT_0].CalcValue();
     return GetUnitOwner()->GetTypeId() == TYPEID_PLAYER;
 }
Example #18
0
 bool Load()
 {
     chance = GetSpellInfo()->Effects[EFFECT_1].CalcValue(GetCaster());
     return true;
 }
Example #19
0
 void HandleDummyLaunchTarget(SpellEffIndex /*effIndex*/)
 {
     uint64 targetGUID = 0;
     if (Unit* unitTarget = GetHitUnit())
         targetGUID = unitTarget->GetGUID();
     // we're handling SPELL_EFFECT_DUMMY in effIndex 0 here
     sLog->outString("Spell %u with SPELL_EFFECT_DUMMY is just launched at it's target: " UI64FMTD "!", GetSpellInfo()->Id, targetGUID);
 }
Example #20
0
 void CountTargets(std::list<WorldObject*>& targets)
 {
     _targetCount = std::min<uint32>(targets.size(), GetSpellInfo()->MaxAffectedTargets);
 }
Example #21
0
 void HandleForceCast(SpellEffIndex effIndex)
 {
     PreventHitDefaultEffect(effIndex);
     GetCaster()->CastSpell(GetCaster(), GetSpellInfo()->GetEffect(effIndex)->TriggerSpell, true);
 }
 void FilterTargets(std::list<WorldObject*>& targets)
 {
     for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end();)
     {
         if ((*itr)->GetTypeId() == TYPEID_PLAYER && (*itr)->ToPlayer()->GetQuestStatus(GetSpellInfo()->GetEffect(EFFECT_1)->CalcValue()) == QUEST_STATUS_INCOMPLETE)
             ++itr;
         else
             targets.erase(itr++);
     }
     targets.push_back(GetCaster());
 }
Example #23
0
 bool Load()
 {
     absorbPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue(GetCaster());
     return true;
 }
Example #24
0
		void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
		{
			if (GetStackAmount() == GetSpellInfo()->StackAmount)
				GetTarget()->CastSpell(GetTarget(), 93683, true);
		}
Example #25
0
 void HandleExtraEffect()
 {
     if (GetSpellInfo()->Id == PRIEST_SPELL_SANCTUARY_8YD_DUMMY)
         GetCaster()->CastSpell(x, y, z, PRIEST_SPELL_SANCTUARY_4YD_DUMMY, true);
 }
Example #26
0
 bool Load()
 {
     healPct = GetSpellInfo()->Effects[EFFECT_1].CalcValue();
     absorbPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue();
     return GetUnitOwner()->ToPlayer();
 }
Example #27
0
 bool Load() override
 {
     healPct = GetSpellInfo()->Effects[EFFECT_1].CalcValue(GetCaster());
     return true;
 }
            void HandleSendEvent(SpellEffIndex effIndex)
            {
                // If only one player in threat list fail spell

                Creature* Summoned = NULL;
                Creature* caster = GetCaster()->ToCreature();

                int8 pos_to_summon = 0;
                int8 phase_to_set = 0;
                int32 gate_to_close = 0;

                switch (GetSpellInfo()->Effects[effIndex].MiscValue)
                {
                    case SPELL_EVENT_HALLOFSECRETS:
                        pos_to_summon = 0; // Not yet spawned
                        phase_to_set = 1;
                        gate_to_close = GO_GATE_RAVENIAN;
                        break;
                    case SPELL_EVENT_HALLOFTHEDAMNED:
                        pos_to_summon = 0;
                        phase_to_set = 2;
                        gate_to_close = GO_GATE_THEOLEN;
                        break;
                    case SPELL_EVENT_THECOVEN:
                        pos_to_summon = 3;
                        phase_to_set = 3;
                        gate_to_close = GO_GATE_MALICIA;
                        break;
                    case SPELL_EVENT_THESHADOWVAULT:
                        pos_to_summon = 6;
                        phase_to_set = 4;
                        gate_to_close = GO_GATE_ILLUCIA;
                        break;
                    case SPELL_EVENT_BAROVFAMILYVAULT:
                        pos_to_summon = 9;
                        phase_to_set = 5;
                        gate_to_close = GO_GATE_BAROV;
                        break;
                    case SPELL_EVENT_VAULTOFTHERAVENIAN:
                        pos_to_summon = 0; // Not yet spawned
                        phase_to_set = 6;
                        gate_to_close = GO_GATE_POLKELT;
                        break;
                    default:
                        break;
                }

                if (gate_to_close && (GetCaster()->GetMap()->GetId() == 289))
                {
                    for (uint8 i = 0; i < 3; ++i)
                    {
                        Summoned = GetCaster()->SummonCreature(NPC_RISEN_GUARDIAN, SummonPos[pos_to_summon++], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000);
                        if (Summoned)
                        {
                            Summoned->GetMotionMaster()->MoveRandom(5);
                            Summoned->AI()->SetData(0,phase_to_set);
                        }
                    }

                    if (InstanceScript* instance = GetCaster()->GetInstanceScript())
                        if (GameObject* gate = GameObject::GetGameObject(*caster, instance->GetData64(gate_to_close)))
                            gate->SetGoState(GO_STATE_READY);
                }
            }
Example #29
0
        void HandleDummy(SpellEffIndex /*effIndex*/)
        {
			Player* player = GetCaster()->GetCharmerOrOwnerPlayerOrPlayerItself();
			if (!player)
				return;

			uint32 spellId = 0;
			switch (GetSpellInfo()->Id)
			{
				case SPELL_FEAST_ON_TURKEY:
					spellId = SPELL_PLAYER_TURKEY;
					break;
				case SPELL_FEAST_ON_STUFFING:
					spellId = SPELL_PLAYER_STUFFING;
					break;
				case SPELL_FEAST_ON_PIE:
					spellId = SPELL_PLAYER_PIE;
					break;
				case SPELL_FEAST_ON_CRANBERRY:
					spellId = SPELL_PLAYER_CRANBERRY;
					break;
				case SPELL_FEAST_ON_SWEET_POTATOES:
					spellId = SPELL_PLAYER_SWEET_POTATOES;
					break;
			}

			if (spellId)
			{
				player->CastSpell(player, spellId, true);
				if (AuraEffect* aur = player->GetAuraEffectDummy(spellId))
				{
					if (aur->GetBase()->GetStackAmount() >= 5)
					{
						switch (spellId)
						{
							case SPELL_PLAYER_TURKEY:
								player->CastSpell(player, SPELL_WELL_FED_TURKEY, true);
								break;
							case SPELL_PLAYER_STUFFING:
								player->CastSpell(player, SPELL_WELL_FED_STUFFING, true);
								break;
							case SPELL_PLAYER_PIE:
								player->CastSpell(player, SPELL_WELL_FED_PIE, true);
								break;
							case SPELL_PLAYER_CRANBERRY:
								player->CastSpell(player, SPELL_WELL_FED_CRANBERRY, true);
								break;
							case SPELL_PLAYER_SWEET_POTATOES:
								player->CastSpell(player, SPELL_WELL_FED_SWEET_POTATOES, true);
								break;
						}

						uint8 count = 0;
						Unit::AuraEffectList const& dummyAuras = player->GetAuraEffectsByType(SPELL_AURA_DUMMY);
						for (Unit::AuraEffectList::const_iterator i = dummyAuras.begin(); i != dummyAuras.end(); ++i)
						{
							if ((*i)->GetId() >= SPELL_PLAYER_CRANBERRY && (*i)->GetId() <= SPELL_PLAYER_PIE)
								if ((*i)->GetBase()->GetStackAmount() >= 5)
									++count;
						}

						// Cast spirit of sharing
						if (count >= 5)
							player->CastSpell(player, SPELL_SPIRIT_OF_SHARING, true);
					}
				}
			}
        }
Example #30
0
 bool Load() override
 {
     absorbPct = GetSpellInfo()->GetEffect(EFFECT_0)->CalcValue(GetCaster());
     return true;
 }