Ejemplo n.º 1
0
        public static bool Mobile_SkillCheckLocation(Mobile from, SkillName skillName, double minSkill, double maxSkill)
        {
            var skill = from.Skills[skillName];

            if (skill == null)
            {
                return(false);
            }

            var value = skill.Value;

            //TODO: Is there any other place this can go?
            if (skillName == SkillName.Fishing && BaseGalleon.FindGalleonAt(from, from.Map) is TokunoGalleon)
            {
                value += 1;
            }

            if (value < minSkill)
            {
                return(false);                // Too difficult
            }
            if (value >= maxSkill)
            {
                return(true);                // No challenge
            }
            var chance = (value - minSkill) / (maxSkill - minSkill);

            CrystalBallOfKnowledge.TellSkillDifficulty(from, skillName, chance);

            var loc = new Point2D(from.Location.X / LocationSize, from.Location.Y / LocationSize);

            return(CheckSkill(from, skill, loc, chance));
        }
Ejemplo n.º 2
0
        public BaseGalleon GetFocusBoat(Mobile focusMob)
        {
            if (focusMob == null || focusMob.Deleted || focusMob.Map == null || focusMob.Map == Map.Internal)
            {
                return(null);
            }

            BaseGalleon g = BaseGalleon.FindGalleonAt(focusMob, focusMob.Map);

            return(g != m_Galleon ? g : null);
        }
Ejemplo n.º 3
0
        public BoardRope()
            : base(5368)
        {
            m_Locked = true;
            Movable  = false;

            m_Galleon = BaseGalleon.FindGalleonAt(new Point2D(X, Y), Map);
            if (m_Galleon != null)
            {
                m_Galleon.Ropes.Add(this);
            }
        }
Ejemplo n.º 4
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                Map map = from.Map;

                if (targeted is IPoint3D)
                {
                    Point3D pnt = new Point3D((IPoint3D)targeted);

                    var galleon = BaseGalleon.FindGalleonAt(new Point2D(pnt.X, pnt.Y), map);

                    if (galleon != null && Galleon == galleon)
                    {
                        galleon.TryAddCannon(from, pnt, Deed);
                    }
                }
            }
Ejemplo n.º 5
0
            public BaseGalleon CheckGalleonPlacement(Mobile from, BaseAddon addon, Point3D p, Map map)
            {
                if (addon.Components.Count > 1)
                {
                    return(null);
                }

                BaseGalleon galleon = BaseGalleon.FindGalleonAt(p, map);

                if (galleon != null && galleon.CanAddAddon(p))
                {
                    return(galleon);
                }

                return(null);
            }
Ejemplo n.º 6
0
        private BaseGalleon FindValidBoatTarget(Point3D newPoint, Map map, AmmoInfo info)
        {
            BaseGalleon galleon = BaseGalleon.FindGalleonAt(newPoint, map);

            if (galleon != null && info.RequiresSurface)
            {
                int d = galleon is BritannianShip ? 3 : 2;
                switch (galleon.Facing)
                {
                case Direction.North:
                case Direction.South:
                    if (newPoint.X <= galleon.X - d || newPoint.X >= galleon.X + d)
                    {
                        return(null);
                    }

                    break;

                case Direction.East:
                case Direction.West:
                    if (newPoint.Y <= galleon.Y - d || newPoint.Y >= galleon.Y + d)
                    {
                        return(null);
                    }

                    break;
                }

                StaticTile[] tiles = map.Tiles.GetStaticTiles(newPoint.X, newPoint.Y, true);

                foreach (StaticTile tile in tiles)
                {
                    ItemData id      = TileData.ItemTable[tile.ID & TileData.MaxItemValue];
                    bool     isWater = (tile.ID >= 0x1796 && tile.ID <= 0x17B2);

                    if (!isWater && id.Surface && !id.Impassable)
                    {
                        return(galleon);
                    }
                }

                return(null);
            }

            return(galleon);
        }
Ejemplo n.º 7
0
        public static bool Mobile_SkillCheckLocation(Mobile from, SkillName skillName, double minSkill, double maxSkill)
        {
            var skill = from.Skills[skillName];

            if (from.Skills[skill.SkillName].Value <= 0.0)
            {
                from.SendMessage("You know nothing about how this is done."); return(false);
            }

            #region Level System Skills
            LevelHandler.DoGainSkillExp(from, skill, skillName);
            #endregion

            if (skill == null)
            {
                return(false);
            }

            var value = skill.Value;

            //TODO: Is there any other place this can go?
            if (skillName == SkillName.Fishing && BaseGalleon.FindGalleonAt(from, from.Map) is TokunoGalleon)
            {
                value += 1;
            }

            if (value < minSkill)
            {
                return(false);                // Too difficult
            }
            if (value >= maxSkill)
            {
                return(true);                // No challenge
            }
            var chance = (value - minSkill) / (maxSkill - minSkill);

            CrystalBallOfKnowledge.TellSkillDifficulty(from, skillName, chance);

            return(CheckSkill(from, skill, new Point2D(from.Location.X / LocationSize, from.Location.Y / LocationSize), chance));
        }
Ejemplo n.º 8
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is IPoint3D)
                {
                    IPoint3D    pnt     = (IPoint3D)targeted;
                    BaseGalleon galleon = BaseGalleon.FindGalleonAt(pnt, from.Map);

                    if (galleon == null || !galleon.Contains(from))
                    {
                        return;
                    }

                    if (galleon.GetSecurityLevel(from) < SecurityLevel.Captain)
                    {
                        from.SendMessage("You must be the captain to paint this ship!");
                    }

                    else if (galleon.Contains(pnt) /*&& boat.X == pnt.X && boat.Y == pnt.Y*/)
                    {
                        if (m_Paint.Permanent)
                        {
                            if (galleon.TryPermanentPaintBoat(from, m_Paint.Hue))
                            {
                                m_Paint.Delete();
                            }
                        }
                        else
                        {
                            if (galleon.TryPaintBoat(from, m_Paint.Hue))
                            {
                                m_Paint.Delete();
                            }
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1116612); //You must target the main mast of the ship you wish to dye.
                    }
                }
            }
Ejemplo n.º 9
0
        public override void OnDoubleClick(Mobile from)
        {
            if (IsChildOf(from.Backpack))
            {
                BaseGalleon galleon = BaseGalleon.FindGalleonAt(from, from.Map);

                if (galleon != null)
                {
                    if (galleon.Owner == from)
                    {
                        from.Target = new InternalTarget(this, galleon);
                    }
                    else
                    {
                        from.SendLocalizedMessage(1116627); // You must be the owner of the ship to do this.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1116625); //You must be on the ship to deploy a weapon.
                }
            }
        }
Ejemplo n.º 10
0
        public void OnTick(Point3DList path, Direction dir, int i)
        {
            if (path.Count > i)
            {
                Point3D point = path[i];
                int     o     = i - 1;

                Server.Effects.PlaySound(point, this.Map, 278);
                Server.Effects.PlaySound(point, this.Map, 279);

                for (int rn = 0; rn < (o * 2) + 1; rn++)
                {
                    int  y = 0, x = 0, y2 = 0, x2 = 0;
                    bool diag = false;
                    switch ((int)dir)
                    {
                    case (int)Direction.Running:
                    case (int)Direction.North: { x = x - o + rn; break; }

                    case 129:
                    case (int)Direction.Right: { x = x - o + rn; y = y - o + rn; break; }

                    case 130:
                    case (int)Direction.East: { y = y - o + rn; break; }

                    case 131:
                    case (int)Direction.Down: { y = y - o + rn; x = x + o - rn; break; }

                    case 132:
                    case (int)Direction.South: { x = x + o - rn; break; }

                    case 133:
                    case (int)Direction.Left: { x = x + o - rn; y = y + o - rn; break; }

                    case 134:
                    case (int)Direction.West: { y = y + o - rn; break; }

                    case (int)Direction.ValueMask:
                    case (int)Direction.Up: { y = y + o - rn; x = x - o + rn; break; }
                    }
                    switch ((int)dir)
                    {
                    case 129:
                    case (int)Direction.Right: { y2++; diag = true; break; }

                    case 131:
                    case (int)Direction.Down: { x2--; diag = true; break; }

                    case 133:
                    case (int)Direction.Left: { y2--; diag = true; break; }

                    case (int)Direction.ValueMask:
                    case (int)Direction.Up: { x2++; diag = true; break; }

                    default: { break; }
                    }

                    Point3D ep  = new Point3D(point.X + x, point.Y + y, point.Z);
                    Point3D ep2 = new Point3D(ep.X + x2, ep.Y + y2, ep.Z);

                    if (diag && i >= ((2 * path.Count) / 3))
                    {
                        return;
                    }

                    Point3D p;
                    if (diag && rn < (o * 2))
                    {
                        p = ep2;
                    }
                    else
                    {
                        p = ep;
                    }

                    if (Spells.SpellHelper.CheckMulti(p, this.Map))
                    {
                        BaseGalleon galleon = BaseGalleon.FindGalleonAt(p, this.Map);
                        if (galleon != null && !m_HasPushed)
                        {
                            int damage = Utility.RandomMinMax(MinBoatDamage, MaxBoatDamage);
                            galleon.OnTakenDamage(this, damage);

                            galleon.StartMove(dir, 1, 0x2, galleon.SlowDriftInterval, true, false);
                            m_HasPushed = true;
                        }
                        continue;
                    }

                    LandTile t = this.Map.Tiles.GetLandTile(x, y);

                    if (IsSeaTile(t))
                    {
                        Mobile spawn = new EffectSpawn();
                        spawn.MoveToWorld(p, this.Map);
                    }
                }
            }
        }
Ejemplo n.º 11
0
        private bool HasTarget(Mobile focus, BaseCannon cannon, bool shootatboat)
        {
            if (cannon == null || cannon.Deleted || cannon.Map == null || cannon.Map == Map.Internal || m_Galleon == null || m_Galleon.Deleted)
            {
                return(false);
            }

            Direction d = cannon.GetFacing();
            int       xOffset = 0; int yOffset = 0;
            int       cannonrange  = cannon.Range;
            int       currentRange = 0;
            Point3D   pnt          = cannon.Location;

            switch (d)
            {
            case Direction.North:
                xOffset = 0; yOffset = -1; break;

            case Direction.South:
                xOffset = 0; yOffset = 1; break;

            case Direction.West:
                xOffset = -1; yOffset = 0; break;

            case Direction.East:
                xOffset = 1; yOffset = 0; break;
            }

            int xo = xOffset;
            int yo = yOffset;

            while (currentRange++ <= cannonrange)
            {
                xOffset = xo;
                yOffset = yo;

                for (int i = -1; i <= 1; i++)
                {
                    Point3D newPoint;

                    if (xOffset == 0)
                    {
                        newPoint = new Point3D(pnt.X + (xOffset + i), pnt.Y + (yOffset * currentRange), pnt.Z);
                    }
                    else
                    {
                        newPoint = new Point3D(pnt.X + (xOffset * currentRange), pnt.Y + (yOffset + i), pnt.Z);
                    }

                    if (shootatboat)
                    {
                        BaseGalleon g = BaseGalleon.FindGalleonAt(newPoint, this.Map);

                        if (g != null && g == m_TargetBoat && g != Galleon)
                        {
                            return(true);
                        }
                    }
                    else
                    {
                        if (focus == null)
                        {
                            return(false);
                        }

                        if (newPoint.X == focus.X && newPoint.Y == focus.Y)
                        {
                            Console.WriteLine("Shooting: {0} at {1} / {2}", focus.Name, newPoint.X, newPoint.Y);
                            return(true);
                        }
                    }
                }
            }

            return(false);
        }