Exemplo n.º 1
0
        public void FindCreature(Mobile from, int creatureLevel)
        {
            if (from == null)
            {
                return;
            }

            PlayerMobile player = from as PlayerMobile;

            if (player == null)
            {
                return;
            }

            int waterLocationChecks = 20;

            int minSpawnRadius = 3;
            int maxSpawnRadius = 6;

            bool foundWaterSpot   = false;
            bool spawnedCreatures = false;

            Point3D spawnLocation = Location;
            Point3D newLocation   = new Point3D();

            for (int a = 0; a < waterLocationChecks; a++)
            {
                int x = X;

                int xOffset = Utility.RandomMinMax(minSpawnRadius, maxSpawnRadius);
                if (Utility.RandomDouble() >= .5)
                {
                    xOffset *= -1;
                }

                x += xOffset;

                int y = Y;

                int yOffset = Utility.RandomMinMax(minSpawnRadius, maxSpawnRadius);
                if (Utility.RandomDouble() >= .5)
                {
                    yOffset *= -1;
                }

                y += yOffset;

                newLocation.X = x;
                newLocation.Y = y;
                newLocation.Z = -5;

                bool waterTile = BaseBoat.IsWaterTile(newLocation, Map);

                if (waterTile)
                {
                    if (BaseBoat.FindBoatAt(newLocation, Map) != null)
                    {
                        continue;
                    }

                    SpellHelper.AdjustField(ref spawnLocation, Map, 12, false);

                    foundWaterSpot = true;
                    break;
                }
            }

            if (!foundWaterSpot)
            {
                return;
            }

            int count = 0;

            switch (creatureLevel)
            {
            case 1:
                count = Utility.RandomMinMax(1, 2);

                for (int a = 0; a < count; a++)
                {
                    BaseCreature bc_Creature = new Puddle();

                    bc_Creature.m_WasFishedUp = true;
                    bc_Creature.MoveToWorld(spawnLocation, from.Map);
                    spawnedCreatures = true;
                }

                if (spawnedCreatures)
                {
                    from.PublicOverheadMessage(MessageType.Regular, 0, false, "*something rises from the water*");
                }
                break;

            case 2:
                count = Utility.RandomMinMax(1, 2);

                for (int a = 0; a < count; a++)
                {
                    BaseCreature bc_Creature = new WaterElemental();

                    bc_Creature.m_WasFishedUp = true;
                    bc_Creature.MoveToWorld(spawnLocation, from.Map);
                    spawnedCreatures = true;
                }

                if (spawnedCreatures)
                {
                    from.PublicOverheadMessage(MessageType.Regular, 0, false, "*something rises from the water*");
                }
                break;

            case 3:
                count = Utility.RandomMinMax(1, 2);

                for (int a = 0; a < count; a++)
                {
                    BaseCreature bc_Creature = new DeepSeaSerpent();

                    bc_Creature.m_WasFishedUp = true;
                    bc_Creature.MoveToWorld(spawnLocation, from.Map);
                    spawnedCreatures = true;
                }

                if (spawnedCreatures)
                {
                    from.PublicOverheadMessage(MessageType.Regular, 0, false, "*something rises from the water*");
                }
                break;

            case 4:
                count = Utility.RandomMinMax(1, 2);

                for (int a = 0; a < count; a++)
                {
                    BaseCreature bc_Creature = new Kraken();

                    bc_Creature.m_WasFishedUp = true;
                    bc_Creature.MoveToWorld(spawnLocation, from.Map);
                    spawnedCreatures = true;
                }

                if (spawnedCreatures)
                {
                    from.PublicOverheadMessage(MessageType.Regular, 0, false, "*something rises from the water*");
                }
                break;
            }
        }
Exemplo n.º 2
0
        public void RetrievalAttempt(Mobile from, bool fishing)
        {
            if (m_CurrentItem >= m_MaxItems)
            {
                return;
            }

            PlayerMobile pm_From = from as PlayerMobile;

            if (pm_From == null)
            {
                return;
            }

            if (!from.InRange(Location, 2) && from.AccessLevel == AccessLevel.Player)
            {
                from.SendMessage("You are too far from the fountain to continue searching.");
                return;
            }

            pm_From.RevealingAction();

            double baseChance = .10;

            if (fishing)
            {
                baseChance *= 1.25 + (.25 * (from.Skills.Fishing.Value / 120));
            }

            if (Utility.RandomDouble() <= baseChance)
            {
                m_CurrentItem++;

                Item item = null;

                switch (m_CurrentItem)
                {
                case 1:
                    Bag bag = new Bag();

                    for (int a = 0; a < 10; a++)
                    {
                        bag.DropItem(CraftingComponent.GetRandomCraftingComponent(1));
                    }

                    item = bag;
                    break;

                case 2: item = new MiniatureHouse(); break;

                case 3:                        switch (m_TreasurePileLevel)
                    {
                    case 1: item = new TreasurePileSmallAddonDeed(); break;

                    case 2: item = new TreasurePileMediumAddonDeed(); break;

                    case 3: item = new TreasurePileLargeAddonDeed(); break;

                    case 4: item = new TreasurePileHugeAddonDeed(); break;
                    }
                    break;

                case 4: item = new MiniatureTree(); break;

                //case 5: item = DungeonArmor.CreateDungeonArmor(DungeonEnum.None, DungeonArmor.ArmorTierEnum.Tier1, DungeonArmor.ArmorLocation.Unspecified); break;
                case 6: item = new MiniatureFountain(); break;
                    //case 7: item = new DungeonArmorUpgradeHammer(); break;


                    break;
                }

                if (item != null)
                {
                    if (pm_From.AddToBackpack(item))
                    {
                        pm_From.SendMessage("You retrieve an item from the fountain!");
                        pm_From.PlaySound(0x025);

                        return;
                    }

                    else
                    {
                        item.MoveToWorld(from.Location, from.Map);

                        pm_From.PlaySound(0x025);
                        pm_From.SendMessage("You retrieve an item from the fountain! Your pack, however, was full and the item has been placed at your feet.");

                        return;
                    }
                }

                int waterCount = Utility.RandomMinMax(1, 2);
                for (int a = 0; a < waterCount; a++)
                {
                    TimedStatic water = new TimedStatic(Utility.RandomList(4650, 4651, 4653, 4654, 4655), 10);
                    water.Name = "foul water";
                    water.Hue  = 1107;

                    Point3D waterLocation = new Point3D(Location.X + Utility.RandomMinMax(-1, 1), Location.Y + Utility.RandomMinMax(-1, 1), Location.Z);

                    SpellHelper.AdjustField(ref waterLocation, Map, 12, false);
                    water.MoveToWorld(waterLocation, Map);
                }
            }

            else
            {
                if (Utility.RandomDouble() <= .25)
                {
                    PublicOverheadMessage(MessageType.Regular, 0, false, "something ancient stirs from within the fountain!");

                    int waterCount = Utility.RandomMinMax(3, 5);
                    for (int a = 0; a < waterCount; a++)
                    {
                        TimedStatic water = new TimedStatic(Utility.RandomList(4650, 4651, 4653, 4654, 4655), 10);
                        water.Name = "foul water";
                        water.Hue  = 1107;

                        Point3D waterLocation = new Point3D(Location.X + Utility.RandomMinMax(-2, 2), Location.Y + Utility.RandomMinMax(-2, 2), Location.Z);

                        SpellHelper.AdjustField(ref waterLocation, Map, 12, false);
                        water.MoveToWorld(waterLocation, Map);
                    }

                    int creatureCount = 0;

                    double result = Utility.RandomDouble();

                    if (result < .10)
                    {
                        creatureCount = 1;

                        for (int a = 0; a < creatureCount; a++)
                        {
                            new FountainOfEvil().MoveToWorld(from.Location, from.Map);
                        }
                    }

                    else if (result < .15)
                    {
                        creatureCount = Utility.RandomMinMax(1, 2);

                        for (int a = 0; a < creatureCount; a++)
                        {
                            new ElderWaterElemental().MoveToWorld(from.Location, from.Map);
                        }
                    }

                    else if (result < .20)
                    {
                        creatureCount = Utility.RandomMinMax(1, 2);

                        for (int a = 0; a < creatureCount; a++)
                        {
                            new ElderToxicElemental().MoveToWorld(from.Location, from.Map);
                        }
                    }

                    else if (result < .25)
                    {
                        creatureCount = Utility.RandomMinMax(1, 2);

                        for (int a = 0; a < creatureCount; a++)
                        {
                            new ElderPoisonElemental().MoveToWorld(from.Location, from.Map);
                        }
                    }

                    else if (result < .50)
                    {
                        creatureCount = Utility.RandomMinMax(2, 4);

                        for (int a = 0; a < creatureCount; a++)
                        {
                            WaterElemental waterElemental = new WaterElemental();
                            waterElemental.Hue  = 1107;
                            waterElemental.Name = "foul water";
                            waterElemental.MoveToWorld(from.Location, from.Map);
                        }
                    }

                    else if (result < .75)
                    {
                        creatureCount = Utility.RandomMinMax(2, 4);

                        for (int a = 0; a < creatureCount; a++)
                        {
                            new VoidSlime().MoveToWorld(from.Location, from.Map);
                        }
                    }

                    else
                    {
                        creatureCount = Utility.RandomMinMax(3, 5);

                        for (int a = 0; a < creatureCount; a++)
                        {
                            Puddle foulPuddle = new Puddle();
                            foulPuddle.Hue  = 1107;
                            foulPuddle.Name = "foul puddle";
                            foulPuddle.MoveToWorld(from.Location, from.Map);
                        }
                    }

                    return;
                }

                else
                {
                    pm_From.SendMessage("You search the fountain but are unable to locate anything of value.");
                    return;
                }
            }
        }