Пример #1
0
            void Launch()
            {
                if (!GetCaster()->ToCreature() || !GetExplTargetDest())
                    return;

                GetCaster()->ToCreature()->m_Events.AddEvent(new StartLaunchEvent(*GetExplTargetDest(), GetHitPlayer()->GetGUID()), GetCaster()->ToCreature()->m_Events.CalculateTime(2500));
            }
            void HandleFinish()
            {
                if (!GetExplTargetDest())
                    return;

                GetCaster()->CastSpell(GetExplTargetDest()->GetPositionX(), GetExplTargetDest()->GetPositionY(), GetExplTargetDest()->GetPositionZ(), SPELL_RP_GG_TRIGGER_MISSILE, true);
            }
Пример #3
0
        bool Load()
        {
            if (GetCaster()->GetTypeId() != TYPEID_PLAYER)
                return false;

            x = GetExplTargetDest()->GetPositionX();
            y = GetExplTargetDest()->GetPositionY();
            z = GetExplTargetDest()->GetPositionZ();
            return true;
        }
Пример #4
0
            void Launch()
            {
                if (!GetCaster()->ToCreature() || !GetExplTargetDest())
                    return;

                float x, y, z;
                x = GetExplTargetDest()->GetPositionX();
                y = GetExplTargetDest()->GetPositionY();
                z = GetExplTargetDest()->GetPositionZ();
                GetCaster()->ToCreature()->m_Events.AddEvent(new StartLaunchEvent(x, y, z, GetHitPlayer()->GetGUID()), GetCaster()->ToCreature()->m_Events.CalculateTime(2500));
            }
            void RecalculateDamage()
            {
                if (!GetExplTargetDest() || !GetHitUnit())
                    return;

                float maxDistance = GetSpellInfo()->Effects[EFFECT_0].CalcRadius(GetCaster()); // Xinef: always stored in EFFECT_0
                float distance = std::min<float>(GetHitUnit()->GetDistance(*GetExplTargetDest()), maxDistance);

                int32 damage = std::max<int32>(0, int32(GetHitDamage() - floor(GetHitDamage() * (distance / maxDistance))));
                SetHitDamage(damage);
            }
            void CheckTarget(SpellEffIndex effIndex)
            {
                PreventHitDefaultEffect(EFFECT_0);
                if (!GetExplTargetDest())
                    return;

                uint32 triggered_spell_id = GetSpellInfo()->Effects[effIndex].TriggerSpell;

                float x, y, z;
                GetExplTargetDest()->GetPosition(x, y, z);
                if (InstanceScript* script = GetCaster()->GetInstanceScript())
                    if (Creature* rotface = script->instance->GetCreature(script->GetData64(DATA_ROTFACE)))
                        rotface->CastSpell(x, y, z, triggered_spell_id, true, NULL, NULL, GetCaster()->GetGUID());
            }
Пример #7
0
            void CheckTarget(SpellEffIndex effIndex)
            {
                PreventHitDefaultEffect(EFFECT_0);
                if (!GetExplTargetDest())
                    return;

                uint32 triggered_spell_id = GetSpellInfo()->GetEffect(effIndex)->TriggerSpell;

                float x, y, z;
                GetExplTargetDest()->GetPosition(x, y, z);
                // let Rotface handle the cast - caster dies before this executes
                if (InstanceScript* script = GetCaster()->GetInstanceScript())
                    if (Creature* rotface = script->instance->GetCreature(script->GetGuidData(DATA_ROTFACE)))
                        rotface->CastSpell(x, y, z, triggered_spell_id, true, NULL, NULL, GetCaster()->GetGUID());
            }
Пример #8
0
        SpellCastResult CheckElevation()
        {
            if (WorldLocation const* dest = GetExplTargetDest())
            {
                if (GetCaster()->HasUnitMovementFlag(MOVEMENTFLAG_ROOT))
                    return SPELL_FAILED_ROOTED;

                if (GetCaster()->GetMap()->Instanceable())
                {
                    float range = GetSpellInfo()->GetMaxRange(true, GetCaster()) * 1.5f;

                    PathGenerator generatedPath(GetCaster());
                    generatedPath.SetPathLengthLimit(range);

                    bool result = generatedPath.CalculatePath(dest->GetPositionX(), dest->GetPositionY(), dest->GetPositionZ(), false, true);
                    if (generatedPath.GetPathType() & PATHFIND_SHORT)
                        return SPELL_FAILED_OUT_OF_RANGE;
                    else if (!result || generatedPath.GetPathType() & PATHFIND_NOPATH)
                    {
                        result = generatedPath.CalculatePath(dest->GetPositionX(), dest->GetPositionY(), dest->GetPositionZ(), false, false);
                        if (generatedPath.GetPathType() & PATHFIND_SHORT)
                            return SPELL_FAILED_OUT_OF_RANGE;
                        else if (!result || generatedPath.GetPathType() & PATHFIND_NOPATH)
                            return SPELL_FAILED_NOPATH;
                    }
                }
                else if (dest->GetPositionZ() > GetCaster()->GetPositionZ() + 4.0f)
                    return SPELL_FAILED_NOPATH;

                return SPELL_CAST_OK;
            }

            return SPELL_FAILED_NO_VALID_TARGETS;
        }
Пример #9
0
            SpellCastResult CheckCast()
            {
                if (Unit* caster = GetCaster())
                {
                    if (caster->HasUnitState(UNIT_STATE_ROOT))
                    {
                        SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_CANT_DO_WHILE_ROOTED);
                        return SPELL_FAILED_CUSTOM_ERROR;
                    }
                }

                if (Unit* caster = GetCaster())
                {
                    Position const* pos = GetExplTargetDest();
                    MotionMaster* motionMaster = caster->GetMotionMaster();
                    float x, y, z;
                    caster->GetContactPoint(caster, x, y, z, CONTACT_DISTANCE);
                    float dist = ((pos->GetPositionZ()) - z);

                    if(dist > 5.0f || dist < -5.0f)
                        return SPELL_FAILED_NOPATH;
                }

                return SPELL_CAST_OK;
            }
void SpellRimefangIcyBlastSpellScript::HandleTriggerMissile(SpellEffIndex effIndex)
{
    PreventHitDefaultEffect(effIndex);
    if (Position const* pos = GetExplTargetDest())
        if (TempSummon* summon = GetCaster()->SummonCreature(NPC_ICY_BLAST, *pos, TEMPSUMMON_TIMED_DESPAWN, 40000))
            summon->CastSpell(summon, SPELL_ICY_BLAST_AREA, true);
}
            SpellCastResult CheckCast()
            {
                if (Unit* caster = GetCaster())
                {
                    if (caster->HasUnitState(UNIT_STATE_ROOT))
                    {
                        SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_CANT_DO_WHILE_ROOTED);
                        return SPELL_FAILED_CUSTOM_ERROR;
                    }
                }

                if (Unit* caster = GetCaster())
                {
                    Position const* pos = GetExplTargetDest();
                    float x, y, z;
                    caster->GetContactPoint(caster, x, y, z, CONTACT_DISTANCE);
                    float dist = ((pos->GetPositionZ()) - z);
                    float delta = 7.5f;

                    if(caster->ToPlayer()->IsFalling())
                        delta = 40.0f;
                    if(dist > delta)
                        return SPELL_FAILED_NOPATH;
                }
                return SPELL_CAST_OK;
            }
Пример #12
0
void SpellValanarKineticBombSpellScript::ChangeSummonPos(SpellEffIndex /*effIndex*/)
{
    WorldLocation summonPos = *GetExplTargetDest();
    Position offset = {0.0f, 0.0f, 20.0f, 0.0f};
    summonPos.RelocateOffset(offset);
    SetExplTargetDest(summonPos);
    GetHitDest()->RelocateOffset(offset);
}
Пример #13
0
        bool Load()
        {
            if (GetCaster()->GetTypeId() != TYPEID_PLAYER)
                return false;

            GetExplTargetDest()->GetPosition(x, y);
            return true;
        }
Пример #14
0
 void ChangeSummonPos(SpellEffIndex /*effIndex*/)
 {
     WorldLocation summonPos = *GetExplTargetDest();
     Position offset = {0.0f, 0.0f, 15.0f, 0.0f};
     summonPos.RelocateOffset(offset);
     SetExplTargetDest(summonPos);
     GetHitDest()->RelocateOffset(offset);
 }
Пример #15
0
 void TriggerFireBomb(SpellEffIndex /*effIndex*/)
 {
     if (const WorldLocation* pos = GetExplTargetDest())
     {
         if (Unit* caster = GetCaster())
             caster->SummonCreature(NPC_FIRE_BOMB, pos->GetPositionX(), pos->GetPositionY(), pos->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 30*IN_MILLISECONDS);
     }
 }
Пример #16
0
 void HandleDummy(SpellEffIndex /*effIndex*/)
 {
     int32 damage = GetEffectValue();
     Position const* pos = GetExplTargetDest();
     if (Unit* target = GetHitUnit())
     {
         if (!target->HasAuraType(SPELL_AURA_DEFLECT_SPELLS)) // Deterrence
             target->CastSpell(pos->GetPositionX(), pos->GetPositionY(), pos->GetPositionZ(), damage, true);
     }
 }
Пример #17
0
            void HandleSummon(SpellEffIndex effIndex)
            {
                PreventHitDefaultEffect(effIndex);
                Unit* caster = GetCaster();
                uint32 entry = uint32(GetSpellInfo()->Effects[effIndex].MiscValue);
                WorldLocation const* summonLocation = GetExplTargetDest();
                if (!caster || !summonLocation)
                    return;

                caster->SummonCreature(entry, summonLocation->GetPositionX(), summonLocation->GetPositionY(), GROUND_Z, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 20000);
            }
Пример #18
0
 void HandleAfterCast()
 {
     if(!GetCaster())
         return;
     Player* player = GetCaster()->ToPlayer();
     if(!player)
         return;
     const WorldLocation* summonPos = GetExplTargetDest();
     if(summonPos && GOMove_commandscript::SpawnQue.find(player->GetGUID()) != GOMove_commandscript::SpawnQue.end())
         GOMove_commandscript::SpawnObject(player, summonPos->GetPositionX(), summonPos->GetPositionY(), summonPos->GetPositionZ(), player->GetOrientation(), player->GetPhaseMaskForSpawn(), false, GOMove_commandscript::SpawnQue[player->GetGUID()], false, true);
 }
Пример #19
0
            void HandleImprovedFlamestrike()
            {
                if (_targetCount >= 2)
                    if (AuraEffect* aurEff = GetCaster()->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_MAGE, ICON_MAGE_IMPROVED_FLAMESTRIKE, EFFECT_0))
                        if (roll_chance_i(aurEff->GetAmount()))
                        {
                            float x, y, z;
                            WorldLocation const* loc = GetExplTargetDest();
                            if (!loc)
                                return;

                            loc->GetPosition(x, y, z);
                            GetCaster()->CastSpell(x, y, z, SPELL_MAGE_FLAMESTRIKE, true);
                        }
            }
            SpellCastResult CheckElevation()
            {
                Unit* caster = GetCaster();

                WorldLocation* dest = const_cast<WorldLocation*>(GetExplTargetDest());
                if (!dest)
                    return SPELL_FAILED_DONT_REPORT;

                if (dest->GetPositionZ() > caster->GetPositionZ() + 5.0f)
                    return SPELL_FAILED_NOPATH;
                else if (caster->HasAuraType(SPELL_AURA_MOD_ROOT))
                    return SPELL_FAILED_ROOTED;

                return SPELL_CAST_OK;
            }
Пример #21
0
        void SetDestPosition(SpellEffIndex effIndex)
        {
            // Do our own calculations for the destination position.
            /// TODO: Remove this once we find a general rule for WorldObject::MovePosition (this spell shouldn't take the Z change into consideration)
            Unit* caster = GetCaster();
            float angle = float(rand_norm()) * static_cast<float>(2 * M_PI);
            uint32 dist = caster->GetObjectSize() + GetSpellInfo()->GetEffect(effIndex)->CalcRadius(GetCaster()) * (float)rand_norm();

            float x = caster->GetPositionX() + dist * std::cos(angle);
            float y = caster->GetPositionY() + dist * std::sin(angle);
            float z = caster->GetMap()->GetHeight(x, y, caster->GetPositionZ());

            const_cast<WorldLocation*>(GetExplTargetDest())->Relocate(x, y, z);
            GetHitDest()->Relocate(x, y, z);
        }
Пример #22
0
 void ModDestHeight(SpellEffIndex /*effIndex*/)
 {
     // Used to cast visual effect at proper position
     Position offset = { 0.0f, 0.0f, 12.0f, 0.0f };
     const_cast<WorldLocation*>(GetExplTargetDest())->RelocateOffset(offset);
 }
Пример #23
0
 void ModDestHeight(SpellEffIndex /*effIndex*/)
 {
     Position offset = {0.0f, 0.0f, 30.0f, 0.0f};
     const_cast<WorldLocation*>(GetExplTargetDest())->RelocateOffset(offset);
     GetHitDest()->RelocateOffset(offset);
 }
Пример #24
0
            void FilterTargets(std::list<WorldObject*>& targets)
            {
                float outRadius = sSpellMgr->GetSpellInfo(SPELL_MAGE_RING_OF_FROST_SUMMON)->Effects[EFFECT_0].CalcRadius();
                float inRadius  = 4.7f;

                for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end(); ++itr)
                    if (Unit* unit = (*itr)->ToUnit())
                        if (unit->HasAura(SPELL_MAGE_RING_OF_FROST_DUMMY) || unit->HasAura(SPELL_MAGE_RING_OF_FROST_FREEZE) || unit->GetExactDist(GetExplTargetDest()) > outRadius || unit->GetExactDist(GetExplTargetDest()) < inRadius)
                            targets.erase(itr--);
            }
Пример #25
0
 void HandleDummy(SpellEffIndex /*effIndex*/)
 {
     if (GetCaster()->HasAura(SPELL_DK_GLYPH_OF_DEATH_AND_DECAY))
         if (WorldLocation const* pos = GetExplTargetDest())
             GetCaster()->CastSpell(pos->GetPositionX(), pos->GetPositionY(), pos->GetPositionZ(), SPELL_DK_DEATH_AND_DECAY_SLOW, true);
 }