Magtheridon Cave In.

Issue #1162 new
Selphius created an issue

The spell does work perfect and all, there is just the problem with it hitting the target if player does not move from his location.

Checked Trinity Core script, it's exactly the same as Oregon's, but on Trinity it does kill the player if he won't move, on Oregon it doesn't do anything even if the spell itself is casted by trigger.

Comments (1)

  1. Selphius reporter

    Found a way to solve it, it isn't a proper fix but it will do for now I hope.

    How it works: 1. Trigger gets playerGUID at summon (visual cave in). 2a. After 5seconds if player don't move player will cast it on himself, which will kill him. 2b. If player will move away Trigger will cast it on himself, player won't be harmed.

    REMEMBER IT ISN'T PROPER FIX! When spell/target system will be fixed it should be removed.

    struct mob_abyssalAI : public ScriptedAI
    {
        mob_abyssalAI(Creature* creature) : ScriptedAI(creature) 
        {
            trigger = 0;
            Despawn_Timer = 60000;
        }
    
        uint32 FireBlast_Timer;;
        uint32 Despawn_Timer;;
        uint32 trigger;
    
        uint64 PlayerGUID;
    
        void Reset()
        {
            FireBlast_Timer = 6000;
            PlayerGUID = 0;
        }
    
        void SpellHit(Unit*, const SpellEntry* spell)
        {
            if (trigger == 2 && spell->Id == SPELL_BLAZE_TARGET)
            {
                me->CastSpell(me, SPELL_BLAZE_TRAP, true);
                me->SetVisibility(VISIBILITY_OFF);
                Despawn_Timer = 130000;
            }
        }
    
        void SetTrigger(uint32 _trigger)
        {
            trigger = _trigger;
            me->SetDisplayId(11686);
            if (trigger == 1) //debris
            {
                me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                me->CastSpell(me, SPELL_DEBRIS_VISUAL, true);
                FireBlast_Timer = 5000;
                Despawn_Timer = 10000;
            }
        }
    
        void EnterCombat(Unit*)
        {
            DoZoneInCombat();
        }
        void AttackStart(Unit* who)
        {
            if (!trigger)
                ScriptedAI::AttackStart(who);
        }
        void MoveInLineOfSight(Unit* who)
        {
            if (!trigger)
                ScriptedAI::MoveInLineOfSight(who);
    
            if (Player* plWho = who->GetCharmerOrOwnerPlayerOrPlayerItself())
            {
                if (plWho->GetDistance(me) < 1.0f)
                {
                    switch (me->GetEntry())
                    {
                    case NPC_ABYSSAL:
                        PlayerGUID = plWho->GetGUID();
                        break;
                    }
                }
            }
        }
    
        void UpdateAI(const uint32 diff)
        {
            if (trigger)
            {
                Player* player = Unit::GetPlayer(*me, PlayerGUID);
    
                if (trigger == 1)
                {
                    if (FireBlast_Timer <= diff)
                    {
                        if (player->GetDistance(me) < 1.0f)
                        {
                            player->CastSpell(player, SPELL_DEBRIS_DAMAGE, true);
                        }
                        else
                        {
                            DoCast(me, SPELL_DEBRIS_DAMAGE, true);
                        }
    
                        me->ForcedDespawn(4000);
                        trigger = 3;
                    }
                    else FireBlast_Timer -= diff;
                }
                return;
            }
    
            if (Despawn_Timer <= diff)
            {
                me->ForcedDespawn();
                Despawn_Timer = 10000;
            }
            else
                Despawn_Timer -= diff;
    
            if (!UpdateVictim())
                return;
    
            if (FireBlast_Timer <= diff)
            {
                DoCastVictim(SPELL_FIRE_BLAST);
                FireBlast_Timer = urand(5000, 15000);
            }
            else
                FireBlast_Timer -= diff;
    
            DoMeleeAttackIfReady();
        }
    };
    
  2. Log in to comment