Exemple #1
0
            SpellCastResult CheckCast()
            {
                Unit* caster = GetCaster();
                if (caster->GetTypeId() != TYPEID_PLAYER)
                    return SPELL_FAILED_DONT_REPORT;

                if (!GetExplTargetUnit())
                    return SPELL_FAILED_BAD_IMPLICIT_TARGETS;

                if (Creature* target = GetExplTargetUnit()->ToCreature())
                {
                    if (target->getLevel() > caster->getLevel())
                        return SPELL_FAILED_HIGHLEVEL;

                    // use SMSG_PET_TAME_FAILURE?
                    if (!target->GetCreatureTemplate()->IsTameable(caster->ToPlayer()->CanTameExoticPets()))
                        return SPELL_FAILED_BAD_TARGETS;

                    if (caster->GetPetGUID())
                        return SPELL_FAILED_ALREADY_HAVE_SUMMON;

                    if (caster->GetCharmGUID())
                        return SPELL_FAILED_ALREADY_HAVE_CHARM;
                }
                else
                    return SPELL_FAILED_BAD_IMPLICIT_TARGETS;

                return SPELL_CAST_OK;
            }
Exemple #2
0
 void HandleScript(SpellEffIndex /*effIndex*/)
 {
     if (Unit* caster = GetCaster())
         if (Unit* target = GetExplTargetUnit())
             if (caster->HasAura(SPELL_SHAMAN_PATH_OF_FLAMES_TALENT))
                 caster->CastSpell(target, SPELL_SHAMAN_PATH_OF_FLAMES_SPREAD, true);
 }
Exemple #3
0
		SpellCastResult CheckCast()
		{
			if (GetCaster() == GetExplTargetUnit())
				return SPELL_FAILED_BAD_TARGETS;

			return SPELL_CAST_OK;
		}
Exemple #4
0
            void FilterTargets(std::list<WorldObject*>& targets)
            {
                if (!GetCaster()->ToPlayer()->GetGroup())
                {
                    targets.clear();
                    targets.push_back(GetCaster());
                }
                else
                {
                    targets.remove(GetExplTargetUnit());
                    std::list<Unit*> tempTargets;
                    for (std::list<WorldObject*>::const_iterator itr = targets.begin(); itr != targets.end(); ++itr)
                        if ((*itr)->GetTypeId() == TYPEID_PLAYER && GetCaster()->IsInRaidWith((*itr)->ToUnit()))
                            tempTargets.push_back((*itr)->ToUnit());

                    if (tempTargets.empty())
                    {
                        targets.clear();
                        FinishCast(SPELL_FAILED_DONT_REPORT);
                        return;
                    }

                    Unit* target = Trinity::Containers::SelectRandomContainerElement(tempTargets);
                    targets.clear();
                    targets.push_back(target);
                }
            }
Exemple #5
0
            void HandleBeforeCast()
            {
                Unit* caster = GetCaster();
                Unit* target = GetExplTargetUnit();
                
                if(caster && target)
                {
                    int32 basepoints0 = 0;

                    if(AuraEffect* aurEff = caster->GetAuraEffect(SPELL_AURA_PROC_TRIGGER_SPELL, SPELLFAMILY_WARRIOR, 243, EFFECT_0))
                    {
                        basepoints0 = CalculatePct(caster->CalculateDamage(BASE_ATTACK, true, true), aurEff->GetAmount());

                        // Check for IconId duplicate
                        if(aurEff->GetBase() && aurEff->GetBase()->GetId() != 84919)
                        {
                            // * 6 because I need the total remaind periodic amount
                            basepoints0 += (target->GetRemainingPeriodicAmount(caster->GetGUID(), SPELL_WARRIOR_DEEP_WOUNDS_RANK_PERIODIC, SPELL_AURA_PERIODIC_DAMAGE) * 6);
                        }
                    }

                    // Per tick damage
                    if(basepoints0)
                    {
                        deepWoundsAmount = basepoints0 / 6;
                    }
                }
            }
Exemple #6
0
            void FilterTargets(std::list<Unit*>& unitList)
            {
                if (!GetCaster()->ToPlayer()->GetGroup())
                {
                    unitList.clear();
                    unitList.push_back(GetCaster());
                }
                else
                {
                    unitList.remove(GetExplTargetUnit());
                    std::list<Unit*> tempTargets;
                    for (std::list<Unit*>::const_iterator itr = unitList.begin(); itr != unitList.end(); ++itr)
                        if ((*itr)->GetTypeId() == TYPE_ID_PLAYER && GetCaster()->IsInRaidWith(*itr))
                            tempTargets.push_back(*itr);

                    if (tempTargets.empty())
                    {
                        unitList.clear();
                        FinishCast(SPELL_FAILED_DONT_REPORT);
                        return;
                    }

                    Unit* target = Quantum::DataPackets::SelectRandomContainerElement(tempTargets);
                    unitList.clear();
                    unitList.push_back(target);
                }
            }
Exemple #7
0
 void HandleDummy(SpellEffIndex /*effIndex*/)
 {
     if (Unit* target = GetExplTargetUnit())
         if (target->GetTypeId() == TYPEID_UNIT && target->HasAura(SPELL_FORCE_SHIELD_ARCANE_PURPLE_X3))
             // Make sure nobody else is channeling the same target
             if (!target->HasAura(SPELL_SCOURGING_CRYSTAL_CONTROLLER))
                 GetCaster()->CastSpell(target, SPELL_SCOURGING_CRYSTAL_CONTROLLER, true, GetCastItem());
 }
Exemple #8
0
 void FilterTargets(std::list<WorldObject*>& targets)
 {
     targets.remove(GetExplTargetUnit());
     Trinity::Containers::RandomResize(targets, [this](WorldObject* target)
     {
         return target->GetTypeId() == TYPEID_UNIT && !target->ToUnit()->HasAura(SPELL_SHAMAN_FLAME_SHOCK_MAELSTROM, GetCaster()->GetGUID());
     }, 1);
 }
 SpellCastResult CheckCast()
 {
     Player* caster = GetCaster()->ToPlayer();
     if (Unit* target = GetExplTargetUnit())
         if (!caster->IsFriendlyTo(target) && !caster->IsValidAttackTarget(target))
             return SPELL_FAILED_BAD_TARGETS;
     return SPELL_CAST_OK;
 }
        SpellCastResult CheckCast()
        {
            if (Unit* target = GetExplTargetUnit())
                if (target->GetEntry() == NPC_LUCKY_WILHELM)
                    return SPELL_CAST_OK;

            SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_MUST_TARGET_WILHELM);
            return SPELL_FAILED_CUSTOM_ERROR;
        }
        SpellCastResult CheckCast()
        {
            Unit* caster = GetCaster();
            Unit* target = GetExplTargetUnit();

            if (!target || (!caster->HasAura(SPELL_PRIEST_ABSOLUTION) && caster != target && target->IsFriendlyTo(caster)))
                return SPELL_FAILED_BAD_TARGETS;
            return SPELL_CAST_OK;
        }
 SpellCastResult CheckCast()
 {
     if (Battlefield* wg = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG))
         if (Player* target = GetExplTargetUnit()->ToPlayer())
             // check if we are in Wintergrasp at all, SotA uses same teleport spells
             if ((target->GetZoneId() == 4197 && target->GetTeamId() != wg->GetDefenderTeam()) || target->HasAura(SPELL_WINTERGRASP_TELEPORT_TRIGGER))
                 return SPELL_FAILED_BAD_TARGETS;
     return SPELL_CAST_OK;
 }
Exemple #13
0
		SpellCastResult CheckCast()
		{
			Unit* caster = GetCaster();
			if (Unit* target = GetExplTargetUnit())
				if (caster->IsFriendlyTo(target) && caster != target)
					if (!caster->HasAura(33167))
						return SPELL_FAILED_BAD_TARGETS;

			return SPELL_CAST_OK;
		}
            SpellCastResult CheckCast()
            {
                Unit* caster = GetCaster();
                if (Unit* target = GetExplTargetUnit())
                    if (caster == target)
                        if (target->HasAura(SPELL_PALADIN_FORBEARANCE) || target->HasAura(SPELL_PALADIN_IMMUNE_SHIELD_MARKER))
                            return SPELL_FAILED_TARGET_AURASTATE;

                return SPELL_CAST_OK;
            }
            SpellCastResult CheckTarget()
            {
                if (IsVampire(GetExplTargetUnit()))
                {
                    SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_CANT_TARGET_VAMPIRES);
                    return SPELL_FAILED_CUSTOM_ERROR;
                }

                return SPELL_CAST_OK;
            }
 SpellCastResult CheckCast()
 {
     Player* caster = GetCaster()->ToPlayer();
     if (!caster && GetCaster()->GetTypeId() == TYPEID_UNIT && GetCaster()->ToCreature()->GetIAmABot())
         caster = (Player*)GetCaster();
     if (Unit* target = GetExplTargetUnit())
         if (!caster->IsFriendlyTo(target) && !caster->IsValidAttackTarget(target))
             return SPELL_FAILED_BAD_TARGETS;
     return SPELL_CAST_OK;
 }
            SpellCastResult CheckRequirement()
            {
                if (!GetCaster()->HasAura(GetSpellInfo()->Effects[EFFECT_1].CalcValue()))
                    return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; // This is actually correct

                if (!GetExplTargetUnit())
                    return SPELL_FAILED_BAD_TARGETS;

                return SPELL_CAST_OK;
            }
Exemple #18
0
 SpellCastResult CheckCast()
 {
     Player* caster = GetCaster()->ToPlayer();
     if (Unit* target = GetExplTargetUnit())
         if (!caster->IsFriendlyTo(target))
         {
             if (!caster->IsValidAttackTarget(target))
                 return SPELL_FAILED_BAD_TARGETS;
             if (!caster->isInFront(target))
                 return SPELL_FAILED_UNIT_NOT_INFRONT;
         }
     return SPELL_CAST_OK;
 }
Exemple #19
0
 void HandleScript(SpellEffIndex /*effIndex*/)
 {
     if (Unit* mainTarget = GetExplTargetUnit())
     {
         if (Aura* flameShock = mainTarget->GetAura(SPELL_SHAMAN_FLAME_SHOCK_MAELSTROM, GetCaster()->GetGUID()))
         {
             if (Aura* newAura = GetCaster()->AddAura(SPELL_SHAMAN_FLAME_SHOCK_MAELSTROM, GetHitUnit()))
             {
                 newAura->SetDuration(flameShock->GetDuration());
                 newAura->SetMaxDuration(flameShock->GetDuration());
             }
         }
     }
 }
Exemple #20
0
 void HandleScriptEffect(SpellEffIndex /*effIndex*/)
 {
     if (Unit* target = GetHitUnit())
     {
         // Cannot be processed while pet is dead
         TriggerCastFlags castMask = TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_IGNORE_CASTER_AURASTATE);
         target->CastSpell(target, GetEffectValue(), castMask);
         target->CastSpell(target, HUNTER_SPELL_MASTERS_CALL_TRIGGERED, castMask);
         if (Unit* ally = GetExplTargetUnit())
         {
             target->CastSpell(ally, GetEffectValue(), castMask);
             target->CastSpell(ally, GetSpellInfo()->Effects[EFFECT_0].CalcValue(), castMask);
         }
     }
 }
Exemple #21
0
        SpellCastResult CheckCast()
        {
            Unit* caster = GetCaster();
            // Death Grip should not be castable while jumping/falling
            if (caster->HasUnitState(UNIT_STATE_JUMPING) || caster->HasUnitMovementFlag(MOVEMENTFLAG_FALLING))
                return SPELL_FAILED_MOVING;

            // Patch 3.3.3 (2010-03-23): Minimum range has been changed to 8 yards in PvP.
            Unit* target = GetExplTargetUnit();
            if (target && target->GetTypeId() == TYPEID_PLAYER)
                if (caster->GetDistance(target) < 8.f)
                    return SPELL_FAILED_TOO_CLOSE;

            return SPELL_CAST_OK;
        }
Exemple #22
0
            SpellCastResult CheckCast()
            {
                Unit* caster = GetCaster();
                if (Unit* target = GetExplTargetUnit())
                {
                    if (!caster->IsFriendlyTo(target) && !caster->isInFront(target))
                        return SPELL_FAILED_UNIT_NOT_INFRONT;

                    if (target->IsFriendlyTo(caster) && target->GetCreatureType() != CREATURE_TYPE_UNDEAD)
                        return SPELL_FAILED_BAD_TARGETS;
                }
                else
                    return SPELL_FAILED_BAD_TARGETS;

                return SPELL_CAST_OK;
            }
Exemple #23
0
            SpellCastResult CheckCast()
            {
                Unit* caster = GetCaster();
                if (caster->GetTypeId() != TYPEID_PLAYER)
                    return SPELL_FAILED_DONT_REPORT;

                if (Unit* target = GetExplTargetUnit())
                {
                    if (!target->IsFriendlyTo(caster) || target->getAttackers().empty())
                        return SPELL_FAILED_BAD_TARGETS;
                }
                else
                    return SPELL_FAILED_BAD_TARGETS;

                return SPELL_CAST_OK;
            }
void HammerOfRighteousScript::HandleBeforeHit()
{
    Unit* caster = GetCaster();
    Unit* target = GetExplTargetUnit();

    if (!caster || !target)
        return;

    Aura* hammerJustice = target->GetAura(SPELL_HAMMER_JUSTICE_STUN);

    // Target isn't affected by HoJ so is able to pickup the Hammer
    if (!hammerJustice)
    {
        caster->CastSpell(target, SPELL_HAMMER_RIGHTEOUS_P);
        PreventHitDamage();
    }
}
Exemple #25
0
            void FilterTargets(std::list<Unit*>& unitList)
            {
                totalTargets = NULL;
                for (std::list<Unit*>::iterator itr = unitList.begin() ; itr != unitList.end(); ++itr)
                {
                    Unit *target = (*itr);
                    if (!target)
                        continue;

                    if (!target->IsWithinDist(GetExplTargetUnit(), 10.0f))
                    {
                        unitList.remove(target);
                        continue;
                    }
                    
                    totalTargets++;
                }
            }
Exemple #26
0
 void FilterTargets(std::list<WorldObject*>& targets)
 {
     targets.remove(GetExplTargetUnit());
 }
 void FilterTargets(std::list<WorldObject*>& targets)
 {
     targets.remove(GetExplTargetUnit()); // The target of this spell should _not_ be in this list
 }
Exemple #28
0
 void HandleScriptEffect(SpellEffIndex /*effIndex*/)
 {
     if (Unit* target = GetExplTargetUnit())
         if (urand(0, 99) < 15)
             target->CastSpell(target, spellId, true);
 }
 void FilterTargets(std::list<WorldObject*>& unitList)
 {
     unitList.remove(GetExplTargetUnit());
 }