Exemplo n.º 1
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);
                    }
                }
            }
        }
Exemplo n.º 2
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, BaseBoat.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);
                    }
                }
            }
        }