コード例 #1
0
            void HandleSpikes(uint effIndex)
            {
                PreventHitDefaultEffect(effIndex);
                Creature marrowgar = GetCaster().ToCreature();

                if (marrowgar)
                {
                    CreatureAI marrowgarAI    = marrowgar.GetAI();
                    byte       boneSpikeCount = (byte)(Convert.ToBoolean((int)GetCaster().GetMap().GetSpawnMode() & 1) ? 3 : 1);

                    List <Unit> targets = marrowgarAI.SelectTargetList(new BoneSpikeTargetSelector(marrowgarAI), boneSpikeCount, SelectAggroTarget.Random);
                    if (targets.Empty())
                    {
                        return;
                    }

                    uint i = 0;
                    foreach (var target in targets)
                    {
                        target.CastSpell(target, Misc.BoneSpikeSummonId[i], true);
                        i++;
                    }

                    marrowgarAI.Talk(Texts.SayBonespike);
                }
            }
コード例 #2
0
            void HandleSpikes(uint effIndex)
            {
                PreventHitDefaultEffect(effIndex);
                Creature marrowgar = GetCaster().ToCreature();

                if (marrowgar)
                {
                    CreatureAI marrowgarAI    = marrowgar.GetAI();
                    byte       boneSpikeCount = (byte)(Convert.ToBoolean((int)GetCaster().GetMap().GetDifficultyID() & 1) ? 3 : 1);

                    List <Unit> targets = marrowgarAI.SelectTargetList(boneSpikeCount, SelectAggroTarget.Random, 1, new BoneSpikeTargetSelector(marrowgarAI));
                    if (targets.Empty())
                    {
                        return;
                    }

                    uint i = 0;
                    foreach (var target in targets)
                    {
                        target.CastSpell(target, Misc.BoneSpikeSummonId[i], true);
                        if (!target.IsAlive()) // make sure we don't get any stuck spikes on dead targets
                        {
                            Aura aura = target.GetAura(SpellIds.Impaled);
                            if (aura != null)
                            {
                                Creature spike = ObjectAccessor.GetCreature(target, aura.GetCasterGUID());
                                if (spike != null)
                                {
                                    spike.DespawnOrUnsummon();
                                }
                                aura.Remove();
                            }
                        }
                        i++;
                    }

                    marrowgarAI.Talk(Texts.SayBonespike);
                }
            }