Hledáme nové posily do ITnetwork týmu. Podívej se na volné pozice a přidej se do nejagilnější firmy na trhu - Více informací.
Pouze tento týden sleva až 80 % na e-learning týkající se C a C++. Zároveň využij akce až 80 % zdarma při nákupu e-learningu - více informací.
discount week 80 + hiring

Kouzelná hůlka

Skript na kouzelnou hůlku

java

using System;
using Server;
using Server.Network;
using Server.Items;
using Server.Spells.Glacial;
using Server.Mobiles;
using Server.Targeting;
using Server.Targets;

namespace Server.Items
{
    public class Hulka : BlackStaff
    {
        private string drevo;
        private int delka;
        private string jadro;
        private Mobile majitel;
        [CommandProperty(AccessLevel.GameMaster)]
        public string Drevo
        {
            get { return drevo; }
            set { drevo = value; InvalidateProperties(); }
        }
        [CommandProperty(AccessLevel.GameMaster)]
        public int Delka
        {
            get { return delka; }
            set { delka = value; InvalidateProperties(); }
        }
        [CommandProperty(AccessLevel.GameMaster)]
        public string Jadro
        {
            get { return jadro; }
            set { jadro = value; InvalidateProperties(); }
        }
        [CommandProperty(AccessLevel.GameMaster)]
        public Mobile MajitelHulky
        {
            get { return majitel; }
            set { majitel = value; }
        }

        public int Iceballact = 0;
        public int Freezeact = 0;
        public int IceStrikeact = 0;

        [Constructable]
        public Hulka()
        {
	    Name = "Hůlka";
	    Delka = Utility.RandomMinMax(10, 15);
            Layer = Layer.OneHanded;

            Iceballact = 1;
            Freezeact = 1;
            IceStrikeact = 1;

            switch (Utility.Random(3))
            {
                case 0: WeaponAttributes.HitHarm = 25; break;
                case 1: WeaponAttributes.HitHarm = 35; break;
                case 2: WeaponAttributes.HitHarm = 45; break;
            }
            switch (Utility.Random(3))
            {
                case 0: Attributes.WeaponDamage = 25; break;
                case 1: Attributes.WeaponDamage = 35; break;
                case 2: Attributes.WeaponDamage = 45; break;
            }
        }
		
        public override void GetProperties(ObjectPropertyList list)
        {
            base.GetProperties(list);
            list.Add(1060659, "{0}", drevo);
            list.Add(1060658, "{0}", delka);
			list.Add(1060657, "{0}", Jadro);
        }

        public Hulka(Serial serial)
        //public Hulka( Serial serial )
            : base(serial)
        {
        }

        public override bool HandlesOnSpeech { get { return true; } }

        public override void OnSpeech(SpeechEventArgs e)
        {
            if (!e.Handled)
            {
                Mobile m = e.Mobile;
                int m_Keyword = 1;
                if (this.Parent == m)
                {
                    switch (2)
                    {
                        case 2:
                            {
                                //Iceball ---------------------------------------
                                if (Iceballact == 0)
                                {
                                    goto case 1;
                                }

                                bool isMatch = false;
                                string m_Substring = "Des Corp Del";

                                if (m_Keyword >= 0 && e.HasKeyword(m_Keyword))
                                    isMatch = true;
                                else if (m_Substring != null && e.Speech.ToLower().IndexOf(m_Substring.ToLower()) >= 0)
                                    isMatch = true;

                                if (!isMatch)
                                    goto case 1;
                                //if (m.BeginAction(typeof(Hulka)))
                                if (m.BeginAction(typeof(Hulka)))
                                {

                                    GlacialSpell iceball = new IceBallSpell(m, this);
                                    iceball.Cast();
                                }
                                else
                                {
                                    m.SendMessage("The Staff is too Cold to use");
                                }
                                Timer.DelayCall(TimeSpan.FromSeconds(4.0), new TimerStateCallback(ReleasecastLock), m);

                                break;

                            }
                        case 1:
                            {
                                //Freezeparalyze ---------------------------------
                                if (Freezeact == 0)
                                {
                                    goto case 0;
                                }

                                bool isMatch = false;
                                string m_Substring = "An Ex Del";

                                if (m_Keyword >= 0 && e.HasKeyword(m_Keyword))
                                    isMatch = true;
                                else if (m_Substring != null && e.Speech.ToLower().IndexOf(m_Substring.ToLower()) >= 0)
                                    isMatch = true;

                                if (!isMatch)
                                    goto case 0;
                                //if (m.BeginAction(typeof(Hulka)))
                                if (m.BeginAction(typeof(Hulka)))
                                {
                                    GlacialSpell FreezeParalyze = new FreezeParalyzeSpell(m, this);
                                    FreezeParalyze.Cast();
                                }
                                else
                                {
                                    m.SendMessage("The Staff is too Cold to use");
                                }
                                Timer.DelayCall(TimeSpan.FromSeconds(15.0), new TimerStateCallback(ReleasecastLock), m);
                                break;
                            }
                        case 0:
                            {
                                //Ice Strike -------------------------------------
                                if (IceStrikeact == 0)
                                {
                                    break;
                                }

                                bool isMatch = false;
                                string m_Substring = "In Corp Del";

                                if (m_Keyword >= 0 && e.HasKeyword(m_Keyword))
                                    isMatch = true;
                                else if (m_Substring != null && e.Speech.ToLower().IndexOf(m_Substring.ToLower()) >= 0)
                                    isMatch = true;

                                if (!isMatch)
                                    break;
                                //if (m.BeginAction(typeof(Hulka)))
                                if (m.BeginAction(typeof(Hulka)))
                                {
                                    GlacialSpell IceStrike = new IceStrikeSpell(m, this);
                                    IceStrike.Cast();
                                }
                                else
                                {
                                    m.SendMessage("The Staff is too Cold to use");
                                }
                                Timer.DelayCall(TimeSpan.FromSeconds(15.0), new TimerStateCallback(ReleasecastLock), m);
                                break;
                            }
                    }
                }
            }
        }

        public override void OnDoubleClick(Mobile from)
        {
            from.Target = new HulkovyTarget();
        }
		
		public class HulkovyTarget : Target
        {
            public HulkovyTarget() : base(-1, false, TargetFlags.None)
            {
            }
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Hulka)
                {
                    int nahoda = Utility.RandomMinMax(1, 2);
                if (nahoda == 1)
                {
                    from.Emote("*máchl(a) hůlkou*");
                    Effects.SendLocationEffect(new Point3D(from.X, from.Y, from.Z + 2), from.Map, Utility.RandomList(14662, 14678, 14695, 14284, 14154, 14170, 14186), 50, 5);
                }
                }
                if (targeted is PlayerMobile)
                {
                    Mobile cil = targeted as Mobile;
                    cil.Damage(1, from);
                    from.Emote("*píchnul(a) ho hůlkou*");
                    cil.Say("Jauvajs!!");
                }
                if (targeted is BaseCreature)
                {
                    Mobile cil = targeted as Mobile;
                    cil.Damage(1, from);
                    from.Emote("*píchnul(a) zvíře hůlkou*");
                }
			}
        }

        private static void ReleasecastLock(object state)
        {
            //((Mobile)state).EndAction(typeof(Hulka));
            ((Mobile)state).EndAction(typeof(Hulka));
        }

        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);
            writer.Write((int)1);
            writer.Write(drevo);
            writer.Write(delka);
            writer.Write(jadro);
            writer.Write(majitel);
        }
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();
            drevo = reader.ReadString();
            delka = reader.ReadInt();
            jadro = reader.ReadString();
            majitel = reader.ReadMobile();
        }
    }
}

Neformátovaný

Přidáno: 29.12.2014
Expirace: Neuvedeno

Avatar
Autor: michalxl99
Aktivity