Exemplo n.º 1
0
        public override void Damage(Mobile m)
        {
            base.Damage(m);

            if (m.Alive)
            {
                Item item = m.FindItemOnLayer(Layer.OuterTorso);

                if (item is GMRobe)
                {
                    AOS.Damage(m, 0, 0, 0, 0, 0, 0);
                }
                else
                {
                    // Wind
                    if (Utility.RandomDouble() < 0.01)
                    {
                        m.PlaySound(Utility.RandomList(0x014, 0x15, 0x016, 0x5C7));
                        AOS.Damage(m, 0, 0, 0, 0, 0, 0);
                    }

                    // sfx noises
                    if (Utility.RandomDouble() < 0.02)
                    {
                        m.PlaySound(Utility.RandomList(0x0F5, 0x0F7, 0x0F8, 0x0FB));
                        AOS.Damage(m, 0, 0, 0, 0, 0, 0);
                    }

                    // jungle sfx noises
                    if (Utility.RandomDouble() < 0.02)
                    {
                        m.PlaySound(Utility.RandomList(0x003, 0x004, 0x005, 0x00C, 0x00D, 0x00E, 0x00F));
                        AOS.Damage(m, 0, 0, 0, 0, 0, 0);
                    }

                    // water drips
                    if (Utility.RandomDouble() < 0.01)
                    {
                        m.PlaySound(Utility.RandomList(0x022, 0x023, 0x024));
                        AOS.Damage(m, 0, 0, 0, 0, 0, 0);
                    }

                    // Random Encounter 1
                    if (Utility.RandomDouble() < 0.0001)
                    {
                        if (m.Map == Map.Tokuno)
                        {
                            int x1 = m.X + 10;
                            int y1 = m.Y + 10;
                            int z1 = Map.Tokuno.GetAverageZ(x1, y1);

                            if (Map.Tokuno.CanSpawnMobile(x1, y1, z1))
                            {
                                BaseCreature encountera;
                                switch (Utility.Random(8))
                                {
                                default:
                                case 0: encountera = new BullFrog(); break;

                                case 1: encountera = new GiantSerpent(); break;

                                case 2: encountera = new Lizardman(); break;

                                case 3: encountera = new LizardmanGuardian(); break;

                                case 4: encountera = new LizardmanRanger(); break;

                                case 5: encountera = new LizardmanWizard(); break;

                                case 6: encountera = new Myconid(); break;

                                case 7: encountera = new WaterLizardScout(); break;
                                }
                                encountera.MoveToWorld(new Point3D(x1, y1, z1), Map.Tokuno);

                                AOS.Damage(m, 0, 0, 0, 0, 0, 0);
                                Timer.DelayCall(TimeSpan.FromMinutes(10.0), new TimerStateCallback(DeleteEncounterA), encountera);
                            }
                        }
                    }

                    // Random Encounter 2
                    if (Utility.RandomDouble() < 0.0001)
                    {
                        if (m.Map == Map.Tokuno)
                        {
                            int x2 = m.X - 10;
                            int y2 = m.Y - 10;
                            int z2 = Map.Tokuno.GetAverageZ(x2, y2);

                            if (Map.Tokuno.CanSpawnMobile(x2, y2, z2))
                            {
                                BaseCreature encountera;
                                switch (Utility.Random(8))
                                {
                                default:
                                case 0: encountera = new BullFrog(); break;

                                case 1: encountera = new GiantSerpent(); break;

                                case 2: encountera = new Lizardman(); break;

                                case 3: encountera = new LizardmanGuardian(); break;

                                case 4: encountera = new LizardmanRanger(); break;

                                case 5: encountera = new LizardmanWizard(); break;

                                case 6: encountera = new Myconid(); break;

                                case 7: encountera = new WaterLizardScout(); break;
                                }
                                encountera.MoveToWorld(new Point3D(x2, y2, z2), Map.Tokuno);

                                AOS.Damage(m, 0, 0, 0, 0, 0, 0);
                                Timer.DelayCall(TimeSpan.FromMinutes(10.0), new TimerStateCallback(DeleteEncounterA), encountera);
                            }
                        }
                    }
                }
            }
        }
        public virtual void Fill_OnTarget(Mobile from, object targ)
        {
            if (!IsEmpty || !Fillable || !ValidateUse(from, false))
            {
                return;
            }

            if (targ is BaseBeverage)
            {
                BaseBeverage bev = (BaseBeverage)targ;

                if (bev.IsEmpty || !bev.ValidateUse(from, true))
                {
                    return;
                }

                this.Content  = bev.Content;
                this.Poison   = bev.Poison;
                this.Poisoner = bev.Poisoner;

                if (bev.Quantity > this.MaxQuantity)
                {
                    this.Quantity = this.MaxQuantity;
                    bev.Quantity -= this.MaxQuantity;
                }
                else
                {
                    this.Quantity += bev.Quantity;
                    bev.Quantity   = 0;
                }
            }
            else if (targ is BaseWaterContainer)
            {
                BaseWaterContainer bwc = targ as BaseWaterContainer;

                if (Quantity == 0 || (this.Content == BeverageType.Water && !this.IsFull))
                {
                    int I_Need = Math.Min((MaxQuantity - Quantity), bwc.Quantity);

                    if ((I_Need > 0) && !bwc.IsEmpty && !IsFull)
                    {
                        bwc.Quantity -= I_Need;
                        Quantity     += I_Need;
                        Content       = BeverageType.Water;

                        from.PlaySound(0x4E);
                    }
                }
            }
            else if (targ is Item)
            {
                Item         item = (Item)targ;
                IWaterSource src;

                src = (item as IWaterSource);

                if (src == null && item is AddonComponent)
                {
                    src = (((AddonComponent)item).Addon as IWaterSource);
                }

                if (src == null || src.Quantity <= 0)
                {
                    return;
                }

                if (from.Map != item.Map || !from.InRange(item.GetWorldLocation(), 2) || !from.InLOS(item))
                {
                    from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045);                       // I can't reach that.
                    return;
                }

                this.Content  = BeverageType.Water;
                this.Poison   = null;
                this.Poisoner = null;

                if (src.Quantity > this.MaxQuantity)
                {
                    this.Quantity = this.MaxQuantity;
                    src.Quantity -= this.MaxQuantity;
                }
                else
                {
                    this.Quantity += src.Quantity;
                    src.Quantity   = 0;
                }

                from.SendLocalizedMessage(1010089);                   // You fill the container with water.
            }
            else if (targ is Cow)
            {
                Cow cow = (Cow)targ;

                if (cow.TryMilk(from))
                {
                    Content  = BeverageType.Milk;
                    Quantity = MaxQuantity;
                    from.SendLocalizedMessage(1080197);                       // You fill the container with milk.
                }
            }
            else if (targ is WaterBeetle)
            {
                WaterBeetle waterbeetle = (WaterBeetle)targ;

                if (waterbeetle.TryMilkingWater(from))
                {
                    Content  = BeverageType.Water;
                    Quantity = MaxQuantity;
                    from.SendMessage("You fill the container with water.");
                }
            }
            else if (targ is WaterLizard)
            {
                WaterLizard waterlizard = (WaterLizard)targ;

                if (waterlizard.TryMilkingWater(from))
                {
                    Content  = BeverageType.Water;
                    Quantity = MaxQuantity;
                    from.SendMessage("You fill the container with water.");
                }
            }
            else if (targ is WaterLizardScout)
            {
                WaterLizardScout waterlizardscout = (WaterLizardScout)targ;

                if (waterlizardscout.TryMilkingWater(from))
                {
                    Content  = BeverageType.Water;
                    Quantity = MaxQuantity;
                    from.SendMessage("You fill the container with water.");
                }
            }
            else if (targ is InteriorCrocodileAlligator)
            {
                InteriorCrocodileAlligator interiorcrocodilealligator = (InteriorCrocodileAlligator)targ;

                if (interiorcrocodilealligator.TryMilkingCider(from))
                {
                    Content  = BeverageType.Cider;
                    Quantity = MaxQuantity;
                    from.SendMessage("You fill the container with cider.");
                }
            }
            else if (targ is LandTarget)
            {
                int tileID = ((LandTarget)targ).TileID;

                PlayerMobile player = from as PlayerMobile;

                if (player != null)
                {
                    QuestSystem qs = player.Quest;

                    if (qs is WitchApprenticeQuest)
                    {
                        FindIngredientObjective obj = qs.FindObjective(typeof(FindIngredientObjective)) as FindIngredientObjective;

                        if (obj != null && !obj.Completed && obj.Ingredient == Ingredient.SwampWater)
                        {
                            bool contains = false;

                            for (int i = 0; !contains && i < m_SwampTiles.Length; i += 2)
                            {
                                contains = (tileID >= m_SwampTiles[i] && tileID <= m_SwampTiles[i + 1]);
                            }

                            if (contains)
                            {
                                Delete();

                                player.SendLocalizedMessage(1055035);                                   // You dip the container into the disgusting swamp water, collecting enough for the Hag's vile stew.
                                obj.Complete();
                            }
                        }
                    }
                }
            }
        }