Ejemplo n.º 1
0
        public static TextDefinition GetAmmoName(IShipCannon cannon)
        {
            AmmoInfo info = Infos.Values.FirstOrDefault(i => i.AmmoType == cannon.AmmoType);

            if (info == null)
            {
                return(1116033); // None
            }

            return(info.Name);
        }
Ejemplo n.º 2
0
            protected override void OnTarget(Mobile from, object obj)
            {
                if (obj is IShipCannon)
                {
                    IShipCannon cannon = (IShipCannon)obj;

                    if (cannon.CanLight)
                    {
                        cannon.LightFuse(from);
                    }
                    else
                    {
                        from.SendLocalizedMessage(1116078); //There is no fuse to light! Prime the cannon first.
                    }
                }
            }
Ejemplo n.º 3
0
        public static TextDefinition GetAmmoName(IShipCannon cannon)
        {
            AmmoInfo info = null;

            foreach (var i in Infos.Values)
            {
                if (i.AmmoType == cannon.AmmoType)
                {
                    info = i;
                    break;
                }
            }

            if (info == null)
            {
                return(1116033); // None
            }

            return(info.Name);
        }
Ejemplo n.º 4
0
 public virtual void OnHitByCannon(IShipCannon cannon, int damage)
 {
 }
Ejemplo n.º 5
0
        private bool HasTarget(Mobile focus, IShipCannon 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, 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)
                        {
                            return(true);
                        }
                    }
                }
            }

            return(false);
        }