Пример #1
0
        public override void OnThink()
        {
            if (DateTime.Now >= m_NextAbilityTime)
            {
                Mobile combatant = this.Combatant;

                if (combatant != null && combatant.Map == this.Map && combatant.InRange(this, 12) && IsEnemy(combatant) && !UnderEffect(combatant))
                {
                    m_NextAbilityTime = DateTime.Now + TimeSpan.FromSeconds(Utility.RandomMinMax(20, 30));

                    if (combatant is BaseCreature)
                    {
                        BaseCreature bc = (BaseCreature)combatant;

                        if (bc.Controlled && bc.ControlMaster != null && !bc.ControlMaster.Deleted && bc.ControlMaster.Alive)
                        {
                            if (bc.ControlMaster.Map == this.Map && bc.ControlMaster.InRange(this, 12) && !UnderEffect(bc.ControlMaster))
                            {
                                Combatant = combatant = bc.ControlMaster;
                            }
                        }
                    }

                    if (Utility.RandomDouble() < .1)
                    {
                        int[][] coord = 
						{
							new int[]{-4,-6}, new int[]{4,-6}, new int[]{0,-8}, new int[]{-5,5}, new int[]{5,5}
						};

                        BaseCreature rabid;

                        for (int i = 0; i < 5; i++)
                        {
                            int x = combatant.X + coord[i][0];
                            int y = combatant.Y + coord[i][1];

                            Point3D loc = new Point3D(x, y, combatant.Map.GetAverageZ(x, y));

                            if (!combatant.Map.CanSpawnMobile(loc))
                                continue;

                            switch (i)
                            {
                                case 0: rabid = new EnragedRabbit(this); break;
                                case 1: rabid = new EnragedHind(this); break;
                                case 2: rabid = new EnragedHart(this); break;
                                case 3: rabid = new EnragedBlackBear(this); break;
                                default: rabid = new EnragedEagle(this); break;
                            }

                            rabid.FocusMob = combatant;
                            rabid.MoveToWorld(loc, combatant.Map);
                        }
                        this.Say(1071932); //Creatures of the forest, I call to thee!  Aid me in the fight against all that is evil!
                    }
                    else if (combatant.Player)
                    {
                        this.Say(true, "I call a plague of insects to sting your flesh!");
                        m_Table[combatant] = Timer.DelayCall(TimeSpan.FromSeconds(0.5), TimeSpan.FromSeconds(7.0), new TimerStateCallback(DoEffect), new object[] { combatant, 0 });
                    }
                }
            }

            base.OnThink();
        }
Пример #2
0
        public override void OnThink()
        {
            if (DateTime.Now >= m_NextAbilityTime)
            {
                Mobile combatant = this.Combatant;

                if (combatant != null && combatant.Map == this.Map && combatant.InRange(this, 12) && IsEnemy(combatant) && !UnderEffect(combatant))
                {
                    m_NextAbilityTime = DateTime.Now + TimeSpan.FromSeconds(Utility.RandomMinMax(20, 30));

                    if (combatant is BaseCreature)
                    {
                        BaseCreature bc = (BaseCreature)combatant;

                        if (bc.Controlled && bc.ControlMaster != null && !bc.ControlMaster.Deleted && bc.ControlMaster.Alive)
                        {
                            if (bc.ControlMaster.Map == this.Map && bc.ControlMaster.InRange(this, 12) && !UnderEffect(bc.ControlMaster))
                            {
                                combatant = bc.ControlMaster;
                            }
                        }
                    }

                    if (Utility.RandomDouble() < .1)
                    {
                        int[][] coord =
                        {
                            new int[] { -4, -6 }, new int[] { 4, -6 }, new int[] { 0, -8 }, new int[] { -5, 5 }, new int[] { 5, 5 }
                        };

                        BaseCreature rabid;

                        for (int i = 0; i < 5; i++)
                        {
                            switch (i)
                            {
                            case 0: rabid = new EnragedRabbit(this); break;

                            case 1: rabid = new EnragedHind(this); break;

                            case 2: rabid = new EnragedHart(this); break;

                            case 3: rabid = new EnragedBlackBear(this); break;

                            default: rabid = new EnragedEagle(this); break;
                            }

                            rabid.FocusMob = combatant;

                            int x = combatant.X + coord[i][0];
                            int y = combatant.Y + coord[i][1];

                            /*
                             *  Once in a while OSI's dont spawn all 5, and
                             *  I can only attribute this to a bad spawn location
                             *  so I will do this.
                             */

                            Point3D loc = new Point3D(x, y, combatant.Map.GetAverageZ(x, y));
                            if (combatant.Map.CanSpawnMobile(loc))
                            {
                                rabid.MoveToWorld(loc, combatant.Map);
                            }
                            else
                            {
                                rabid.Delete();
                            }
                        }
                        this.Say(1071932); //Creatures of the forest, I call to thee!  Aid me in the fight against all that is evil!
                    }
                    else
                    {
                        this.Say(true, "I call a plague of insects to sting your flesh!");
                        m_Table[combatant] = Timer.DelayCall(TimeSpan.FromSeconds(0.5), TimeSpan.FromSeconds(7.0), new TimerStateCallback(DoEffect), new object[] { combatant, 0 });
                    }
                }
            }

            base.OnThink();
        }
        public override void OnThink()
        {
            if (DateTime.Now >= m_NextAbilityTime)
            {
                Mobile combatant = this.Combatant;

                if (combatant != null && combatant.Map == this.Map && combatant.InRange(this, 12) && IsEnemy(combatant) && !UnderEffect(combatant))
                {
                    m_NextAbilityTime = DateTime.Now + TimeSpan.FromSeconds(Utility.RandomMinMax(10, 15));

                    if (combatant is BaseCreature)
                    {
                        BaseCreature bc = (BaseCreature)combatant;

                        if (bc.Controlled && bc.ControlMaster != null && !bc.ControlMaster.Deleted && bc.ControlMaster.Alive)
                        {
                            if (bc.ControlMaster.Map == this.Map && bc.ControlMaster.InRange(this, 12) && !UnderEffect(bc.ControlMaster))
                            {
                                combatant = bc.ControlMaster;
                            }
                        }
                    }

                    if (Utility.RandomDouble() < .5)
                    {
                        int[][] coord =
                        {
                            new int[] { -4, -6 }, new int[] { 4, -6 }, new int[] { 0, -8 }, new int[] { -5, 5 }, new int[] { 5, 5 }
                        };

                        BaseCreature rabid;

                        for (int i = 0; i < 5; i++)
                        {
                            switch (i)
                            {
                            case 0: rabid = new EnragedRabbit(this); break;

                            case 1: rabid = new EnragedHind(this); break;

                            case 2: rabid = new EnragedHart(this); break;

                            case 3: rabid = new EnragedBlackBear(this); break;

                            default: rabid = new EnragedEagle(this); break;
                            }

                            rabid.FocusMob = combatant;

                            int x = combatant.X + coord[i][0];
                            int y = combatant.Y + coord[i][1];

                            /*
                             *      Once in a while OSI's dont spawn all 5, and
                             *      I can only attribute this to a bad spawn location
                             *      so I will do this.
                             */

                            Point3D loc = new Point3D(x, y, combatant.Map.GetAverageZ(x, y));
                            if (combatant.Map.CanSpawnMobile(loc))
                            {
                                rabid.MoveToWorld(loc, combatant.Map);
                            }
                            else
                            {
                                rabid.Delete();
                            }
                        }
                        this.Say(true, "Arise from your slumber, children of the woodland realm! Aid me and eviserate those whom invoke harm against our home!");
                    }
                    else
                    {
                        this.Say(true, "It is time for my spores to fester upon your mortal flesh!");
                        m_Table[combatant] = Timer.DelayCall(TimeSpan.FromSeconds(5.0), TimeSpan.FromSeconds(10.0), new TimerStateCallback(DoEffect), new object[] { combatant, 0 });
                    }
                }
            }

            base.OnThink();
        }