Exemplo n.º 1
0
            public override void OnCast()
            {
                IPooledEnumerable <Corpse> eable = Caster.GetItemsInRange <Corpse>(3);
                Corpse toChannel = eable.FirstOrDefault(corpse => !corpse.Channeled);

                eable.Free();

                int min = 1 + (int)(Caster.Skills.SpiritSpeak.Value * 0.25);
                int max = min + 4;

                int mana, number;

                if (toChannel != null)
                {
                    mana   = 0;
                    number = 1061287; // You channel energy from a nearby corpse to heal your wounds.
                }
                else
                {
                    mana   = 10;
                    number = 1061286; // You channel your own spiritual energy to heal your wounds.
                }

                if (Caster.Mana < mana)
                {
                    Caster.SendLocalizedMessage(1061285); // You lack the mana required to use this skill.
                }
                else
                {
                    Caster.CheckSkill(SkillName.SpiritSpeak, 0.0, 120.0);

                    if (Utility.RandomDouble() > Caster.Skills.SpiritSpeak.Value / 100.0)
                    {
                        Caster.SendLocalizedMessage(502443); // You fail your attempt at contacting the netherworld.
                    }
                    else
                    {
                        if (toChannel != null)
                        {
                            toChannel.Channeled = true;
                            toChannel.Hue       = 0x835;
                        }

                        Caster.Mana -= mana;
                        Caster.SendLocalizedMessage(number);

                        if (min > max)
                        {
                            min = max;
                        }

                        Caster.Hits += Utility.RandomMinMax(min, max);

                        Caster.FixedParticles(0x375A, 1, 15, 9501, 2100, 4, EffectLayer.Waist);
                    }
                }

                FinishSequence();
            }
Exemplo n.º 2
0
        public static T TryCreateItem <T>(int x, int y, int z, T srcItem) where T : Item
        {
            IPooledEnumerable <T> eable = Map.Felucca.GetItemsInBounds <T>(new Rectangle2D(x, y, 1, 1));
            T t = eable.FirstOrDefault(item => item.GetType() == srcItem.GetType());

            eable.Free();
            if (t != null)
            {
                srcItem.Delete();
                return(t);
            }

            srcItem.MoveToWorld(new Point3D(x, y, z), Map.Felucca);
            m_Count++;

            return(srcItem);
        }