void HandleSummon(SpellEffIndex effIndex)
            {
                PreventHitEffect(effIndex);

                uint32 entry = GetSpellInfo()->Effects[effIndex].MiscValue;
                SummonPropertiesEntry const* properties = sSummonPropertiesStore.LookupEntry(GetSpellInfo()->Effects[effIndex].MiscValueB);
                int32 duration = GetSpellInfo()->GetDuration();
                if (!GetOriginalCaster() || !properties)
                    return;

                if (TempSummon* summon = GetCaster()->GetMap()->SummonCreature(entry, *GetHitDest(), properties, duration, GetOriginalCaster(), GetSpellInfo()->Id))
                {
                    summon->SetCreatorGUID(GetOriginalCaster()->GetGUID());
                    summon->HandleSpellClick(GetCaster());
                }
            }
Example #2
0
            void HandleDummy(SpellEffIndex effIndex)
            {
                Unit* caster = GetCaster();
                if (Unit* target = GetHitUnit())
                {
                    SpellInfo const* spellInfo = GetSpellInfo();
                    int32 rageUsed = std::min<int32>(300 - spellInfo->CalcPowerCost(caster, SpellSchoolMask(spellInfo->SchoolMask)), caster->GetPower(POWER_RAGE));
                    int32 newRage = std::max<int32>(0, caster->GetPower(POWER_RAGE) - rageUsed);

                    // Sudden Death rage save
                    if (AuraEffect* aurEff = caster->GetAuraEffect(SPELL_AURA_PROC_TRIGGER_SPELL, SPELLFAMILY_GENERIC, ICON_ID_SUDDEN_DEATH, EFFECT_0))
                    {
                        int32 ragesave = aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue() * 10;
                        newRage = std::max(newRage, ragesave);
                    }

                    caster->SetPower(POWER_RAGE, uint32(newRage));
                    // Glyph of Execution bonus
                    if (AuraEffect* aurEff = caster->GetAuraEffect(SPELL_GLYPH_OF_EXECUTION, EFFECT_0))
                        rageUsed += aurEff->GetAmount() * 10;


                    int32 bp = GetEffectValue() + int32(rageUsed * spellInfo->Effects[effIndex].DamageMultiplier + caster->GetTotalAttackPowerValue(BASE_ATTACK) * 0.2f);
                    caster->CastCustomSpell(target,SPELL_EXECUTE,&bp,0,0,true,0,0,GetOriginalCaster()->GetGUID());
                }
            }
Example #3
0
 void HandleDummy(SpellEffIndex /*effIndex*/)
 {
     if(GetHitCreature())
     {
         GetOriginalCaster()->GetVehicleKit()->GetPassenger(0)->ToPlayer()->KilledMonsterCredit(NPC_WYRMREST_TEMPLE_CREDIT, 0);
     }
 }
 void CheckDistance()
 {
     if (Unit* caster = GetOriginalCaster())
     {
         if (Unit* target = GetHitUnit())
             target->CastSpell(caster, SPELL_SIPHONED_MIGHT, true);
     }
 }
Example #5
0
		void HandleHeal(SpellEffIndex /*effIndex*/)
		{
			if (Unit* caster = GetOriginalCaster())
				if (GetHitUnit()->GetGUID() == caster->GetGUID())
				{
				int32 heal = GetHitHeal() / 2.0f;
				SetHitHeal(heal);
				}
		}
 void CheckDistance()
 {
     if (Unit* caster = GetOriginalCaster())
         if (Unit* target = GetHitUnit())
             if (target == GetCaster() 
                 // the spell has an unlimited range, so we need this check
                 && target->GetDistance2d(caster) <= 12.0f)
                 target->CastSpell(caster, SPELL_SIPHONED_MIGHT, true);
 }
        void FilterTargets(std::list<WorldObject*>& targets)
        {
            targets.clear();

            Unit* target = GetOriginalCaster();
            if (!target)
                return;

            targets.push_back(target);
        }
Example #8
0
            void Hit()
            {
                if (!GetHitUnit())
                    return;

                if (!GetCaster())
                    return;               

                if (!GetOriginalCaster())
                    return;

                if (Aura* debuff = GetOriginalCaster()->AddAura(89421, GetHitUnit()))
                {
                    if (!GetSpellValue())
                        return;

                    int32 duration = GetSpellValue()->EffectBasePoints[1];
                    debuff->SetDuration(duration, false);
                }
            }
Example #9
0
 void HandleHeal(SpellEffIndex /*effIndex*/)
 {
     if (Unit* caster = GetOriginalCaster())
     {
         if (AuraEffect* aurEff = caster->GetAuraEffect(SPELL_PRIEST_T9_HEALING_2P, EFFECT_0))
         {
             int32 heal = GetHitHeal();
             AddPct(heal, aurEff->GetAmount());
             SetHitHeal(heal);
         }
     }
 }
Example #10
0
            void SelectTargets(std::list<WorldObject*>& targets)
            {
                targets.remove_if([](WorldObject* target)
                {
                    return !target->ToUnit() || target->ToUnit()->IsFullHealth();
                });

                Trinity::Containers::RandomResize(targets, 1);

                if (targets.empty())
                    targets.push_back(GetOriginalCaster());
            }
Example #11
0
 void HandleHeal(SpellEffIndex /*effIndex*/)
 {
     if (Unit* caster = GetOriginalCaster())
     {
         if (Aura* aur = caster->GetAura(SPELL_T9_HEALING_2_PIECE))
         {
             int32 heal = GetHitHeal();
             AddPctN(heal, aur->GetSpellInfo()->Effects[0].CalcValue());
             SetHitHeal(heal);
         }
     }
 }
Example #12
0
            void HandleAchievementCredit(SpellEffIndex /*effIndex*/)
            {
                uint32 _creditSpell = 0;
                Unit* caster = GetOriginalCaster();
                if (!caster)
                    return;

                if (GetSpellInfo()->Id == SPELL_SEAFORIUM_BLAST)
                    _creditSpell = SPELL_A_BOMB_INABLE_CREDIT;
                else if (GetSpellInfo()->Id == SPELL_HUGE_SEAFORIUM_BLAST)
                    _creditSpell = SPELL_A_BOMB_INATION_CREDIT;

                if (GetHitGObj() && GetHitGObj()->IsDestructibleBuilding())
                    caster->CastSpell(caster, _creditSpell, true);
            }
            void HandleScript(SpellEffIndex effIndex)
            {
                PreventHitDefaultEffect(effIndex);
                Unit* target = GetHitUnit();
                Unit* caster = GetOriginalCaster();
                if (target && caster && caster->GetMap())
                {
                    for (uint32 i = 0; i < 3; ++i)
                    {
                        caster->CastSpell(target, 58689, true);
                        caster->CastSpell(target, 58692, true);
                    }

                    caster->CastSpell(target, caster->GetMap()->Is25ManRaid() ? 60883 : 58695, true); 
                }
            }
Example #14
0
            void HandleDamage(SpellEffIndex /*effIndex*/)
            {
                if (!GetTriggeringSpell())
                    return;

                Unit* target = GetHitUnit();
                Unit* caster = GetOriginalCaster();

                if (target->HasAura(GetTriggeringSpell()->Id))
                    SetHitDamage(0);
                else
                {
                    if (target->GetTypeId() == TYPEID_PLAYER && caster->IsAIEnabled)
                        caster->ToCreature()->AI()->SetData(DATA_POLARITY_SWITCH, 1);
                }
            }
            void HandleDummy(SpellEffIndex /* effIndex */)
            {
                if (Unit* caster = GetOriginalCaster())
                    if (Unit* target = GetHitUnit())
                    {
                        if (!target->isAlive() || !_targetCount)
                            return;

                        int32 damage = 10000 / _targetCount;

                        SpellNonMeleeDamage damageInfo(caster, target, GetSpellInfo()->Id, GetSpellInfo()->SchoolMask);
                        damageInfo.damage = damage;

                        caster->CalcAbsorbResist(target, GetSpellInfo()->GetSchoolMask(), DOT, damage, &damageInfo.absorb, &damageInfo.resist, GetSpellInfo());
                        caster->DealDamageMods(target, damageInfo.damage, &damageInfo.absorb);
                        caster->SendSpellNonMeleeDamageLog(&damageInfo);
                        caster->DealSpellDamage(&damageInfo, false);
                    }
            }
Example #16
0
        void HandleScriptEffect(SpellEffIndex /*effIndex*/)
        {
            Unit* caster = GetOriginalCaster();
            Unit* target = GetHitUnit();
            if (!target)
                return;

            if (GetSpellInfo()->Id == SPELL_AIR_RIFLE_HIT_TRIGGER)
            {
                if (!caster->IsFriendlyTo(target))
                    caster->CastSpell(target, SPELL_AIR_RIFLE_PELTED_DAMAGE, true, NULL, NULL, caster->GetGUID());
            }
            else
            {
                uint8 rand = urand(0, 99);
                if (rand < 15)
                    caster->CastSpell(caster, SPELL_AIR_RIFLE_RIGHT_IN_THE_EYE, true, NULL, NULL, caster->GetGUID());
                else if (rand < 35)
                    caster->CastSpell(target, SPELL_AIR_RIFLE_STARLED, true, NULL, NULL, caster->GetGUID());
                else
                    caster->CastSpell(target, SPELL_AIR_RIFLE_HIT, true, NULL, NULL, caster->GetGUID());
            }
        }
Example #17
0
		void HandleHeal(SpellEffIndex /*effIndex*/)
		{
			if (Unit* caster = GetOriginalCaster())
			{
				if (Aura* prayer = GetHitUnit()->GetAura(41635, caster->GetGUID()))
					if (prayer->GetCharges() == prayer->CalcMaxCharges())
					{
					// Glyph of prayer of mending
					if (AuraEffect* glyph = caster->GetDummyAuraEffect(SPELLFAMILY_PRIEST, 2219, EFFECT_0))
					{
						int32 heal = GetHitHeal();
						AddPct(heal, glyph->GetAmount());
						SetHitHeal(heal);
					}
					}

				if (AuraEffect* aurEff = caster->GetAuraEffect(SPELL_PRIEST_T9_HEALING_2P, EFFECT_0))
				{
					int32 heal = GetHitHeal();
					AddPct(heal, aurEff->GetAmount());
					SetHitHeal(heal);
				}
			}
		}
            void HandleDummy(SpellEffIndex /* effIndex */)
            {
                int32 damage = GetEffectValue();
                SpellInfo const* triggeringSpell = GetTriggeringSpell();
                if (Unit* target = GetHitUnit())
                    if (Unit* caster = GetCaster())
                    {
                        if (Unit* owner = caster->GetOwner())
                        {
                            if (triggeringSpell)
                                damage = int32(owner->SpellHealingBonus(target, triggeringSpell, damage, HEAL));

                            // Restorative Totems
                            if (AuraEffect* dummy = owner->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_SHAMAN, ICON_ID_RESTORATIVE_TOTEMS, 1))
                                AddPctN(damage, dummy->GetAmount());

                            // Glyph of Healing Stream Totem
                            if (AuraEffect const* aurEff = owner->GetAuraEffect(SPELL_GLYPH_OF_HEALING_STREAM_TOTEM, EFFECT_0))
                                AddPctN(damage, aurEff->GetAmount());
                        }
                        caster->CastCustomSpell(target, SPELL_HEALING_STREAM_TOTEM_HEAL, &damage, 0, 0, true, 0, 0, GetOriginalCaster()->GetGUID());
                    }
            }
Example #19
0
 bool Load() override
 {
     return GetOriginalCaster()->GetTypeId() == TYPEID_UNIT;
 }
Example #20
0
            void HandleDummy(SpellEffIndex /* effIndex */)
            {
                int32 damage = GetEffectValue();
                SpellInfo const* triggeringSpell = GetTriggeringSpell();
                if (Unit* target = GetHitUnit())
                    if (Unit* caster = GetCaster())
                    {
                        if (Unit* owner = caster->GetOwner())
                        {
                            if (triggeringSpell)
                                damage = int32(owner->SpellHealingBonusDone(target, triggeringSpell, damage, HEAL));

                            // Soothing Rains
                            if (AuraEffect* dummy = owner->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_SHAMAN, ICON_ID_SOOTHING_RAIN, EFFECT_0))
                                AddPct(damage, dummy->GetAmount());

                            damage = int32(target->SpellHealingBonusTaken(owner, triggeringSpell, damage, HEAL));
                        }
                        caster->CastCustomSpell(target, SPELL_HEALING_STREAM_TOTEM_HEAL, &damage, 0, 0, true, 0, 0, GetOriginalCaster()->GetGUID());
                    }
            }
Example #21
0
            void HandleScript(SpellEffIndex /*effIndex*/)
            {
                if (!GetHitUnit())
                    return;

                std::list<Creature*> triggers;
                GetHitUnit()->GetCreatureListWithEntryInGrid(triggers, GetHitUnit()->GetEntry(), 12.5f);
                triggers.sort(Trillium::ObjectDistanceOrderPred(GetHitUnit()));
                GetHitUnit()->CastSpell(triggers.back(), uint32(GetEffectValue()), false, NULL, NULL, GetOriginalCaster() ? GetOriginalCaster()->GetGUID() : 0);
            }
 void HandleDummy(SpellEffIndex /*effIndex*/)
 {
     if (Unit* caster = GetCaster())
         if (Unit* unitTarget = GetHitUnit())
         {
             if (unitTarget->getPowerType() == POWER_MANA)
             {
                 int32 effValue = GetEffectValue();
                 // Glyph of Mana Tide
                 if (Unit* owner = caster->GetOwner())
                     if (AuraEffect* dummy = owner->GetAuraEffect(SHAMAN_SPELL_GLYPH_OF_MANA_TIDE, 0))
                         effValue += dummy->GetAmount();
                 // Regenerate 6% of Total Mana Every 3 secs
                 int32 effBasePoints0 = int32(CalculatePctN(unitTarget->GetMaxPower(POWER_MANA), effValue));
                 caster->CastCustomSpell(unitTarget, SHAMAN_SPELL_MANA_TIDE_TOTEM, &effBasePoints0, NULL, NULL, true, NULL, NULL, GetOriginalCaster()->GetGUID());
             }
         }
 }
 void HandleDummy(SpellEffIndex /* effIndex */)
 {
     int32 damage = GetEffectValue();
     if (Unit* target = GetHitUnit())
         if (Unit* caster = GetCaster())
             if (target->getPowerType() == POWER_MANA)
                 caster->CastCustomSpell(target, SPELL_MANA_SPRING_TOTEM_ENERGIZE, &damage, 0, 0, true, 0, 0, GetOriginalCaster()->GetGUID());
 }
 void HandleDummy(SpellEffIndex /* effIndex */)
 {
     int32 bp = 1;
     if (GetCaster() && GetHitUnit() && GetOriginalCaster())
         GetCaster()->CastCustomSpell(GetHitUnit(), SPELL_CLEANSING_TOTEM_EFFECT, NULL, &bp, NULL, true, NULL, NULL, GetOriginalCaster()->GetGUID());
 }