コード例 #1
0
ファイル: spell_hunter.cpp プロジェクト: AwkwardDev/RE
            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;
            }
コード例 #2
0
ファイル: spell_shaman.cpp プロジェクト: Lyill/TrinityCore
 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);
 }
コード例 #3
0
ファイル: spell_priest.cpp プロジェクト: Tithand/TER-Server
		SpellCastResult CheckCast()
		{
			if (GetCaster() == GetExplTargetUnit())
				return SPELL_FAILED_BAD_TARGETS;

			return SPELL_CAST_OK;
		}
コード例 #4
0
ファイル: spell_druid.cpp プロジェクト: Hlkz2/ACoreOld
            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);
                }
            }
コード例 #5
0
ファイル: spell_warrior.cpp プロジェクト: Faydz/TrinityCore
            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;
                    }
                }
            }
コード例 #6
0
ファイル: spell_druid.cpp プロジェクト: boom8866/new
            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);
                }
            }
コード例 #7
0
ファイル: spell_quest.cpp プロジェクト: S-proyect/Emu-S
 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());
 }
コード例 #8
0
ファイル: spell_shaman.cpp プロジェクト: Lyill/TrinityCore
 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);
 }
コード例 #9
0
ファイル: spell_priest.cpp プロジェクト: Stylerdk/TrinityCore
 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;
 }
コード例 #10
0
        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;
        }
コード例 #11
0
        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;
        }
コード例 #12
0
 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;
 }
コード例 #13
0
ファイル: spell_priest.cpp プロジェクト: Tithand/TER-Server
		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;
		}
コード例 #14
0
            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;
            }
コード例 #15
0
            SpellCastResult CheckTarget()
            {
                if (IsVampire(GetExplTargetUnit()))
                {
                    SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_CANT_TARGET_VAMPIRES);
                    return SPELL_FAILED_CUSTOM_ERROR;
                }

                return SPELL_CAST_OK;
            }
コード例 #16
0
 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;
 }
コード例 #17
0
            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;
            }
コード例 #18
0
ファイル: spell_priest.cpp プロジェクト: AwkwardDev/RE
 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;
 }
コード例 #19
0
ファイル: spell_shaman.cpp プロジェクト: Lyill/TrinityCore
 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());
             }
         }
     }
 }
コード例 #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);
         }
     }
 }
コード例 #21
0
ファイル: spell_dk.cpp プロジェクト: DSlayerMan/DraenorCore
        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;
        }
コード例 #22
0
ファイル: spell_dk.cpp プロジェクト: AlucardVoss/Patchs
            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;
            }
コード例 #23
0
ファイル: spell_paladin.cpp プロジェクト: Diyvol/TrinityCore
            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;
            }
コード例 #24
0
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();
    }
}
コード例 #25
0
ファイル: boss_koralon.cpp プロジェクト: Blackn7g/Voodoo
            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++;
                }
            }
コード例 #26
0
ファイル: spell_druid.cpp プロジェクト: Hlkz2/ACoreOld
 void FilterTargets(std::list<WorldObject*>& targets)
 {
     targets.remove(GetExplTargetUnit());
 }
コード例 #27
0
 void FilterTargets(std::list<WorldObject*>& targets)
 {
     targets.remove(GetExplTargetUnit()); // The target of this spell should _not_ be in this list
 }
コード例 #28
0
 void HandleScriptEffect(SpellEffIndex /*effIndex*/)
 {
     if (Unit* target = GetExplTargetUnit())
         if (urand(0, 99) < 15)
             target->CastSpell(target, spellId, true);
 }
コード例 #29
0
 void FilterTargets(std::list<WorldObject*>& unitList)
 {
     unitList.remove(GetExplTargetUnit());
 }