public void UpdateWalls(BombFighter fighter)
        {
            bool seq = fighter.Fight.SequencesManager.StartSequence(SequenceTypeEnum.SEQUENCE_SPELL);

            foreach (var wall in new List <Wall>(fighter.Walls))
            {
                if (wall.Valid() == false)
                {
                    wall.Destroy();
                }
            }

            foreach (var direction in WallDirections)
            {
                MapPoint current = fighter.Point.GetCellInDirection(direction, 1);

                for (byte i = 0; i < WALL_MAX_DISTANCE; i++)
                {
                    if (current != null)
                    {
                        current = current.GetCellInDirection(direction, 1);

                        if (current != null) // La cell n'existe pas
                        {
                            BombFighter target = fighter.Fight.GetFighter(current.CellId) as BombFighter;

                            if (target != null && target.IsOwner(fighter.Owner) && target.SpellBombRecord.SpellId == fighter.SpellBombRecord.SpellId)
                            {
                                foreach (var targetWall in target.Walls.ToArray())
                                {
                                    if (targetWall.ContainsCell(fighter.CellId))
                                    {
                                        targetWall.Destroy();
                                    }
                                }
                                Wall wall = fighter.Fight.AddWall(fighter.Owner, fighter.WallSpellLevel, fighter.WallSpellLevel.Effects.FirstOrDefault(), fighter, target, i);

                                foreach (var cell in wall.GetCells())
                                {
                                    var wall2 = fighter.Walls.FirstOrDefault(x => x.ContainsCell(cell));

                                    if (wall2 != null)
                                    {
                                        wall2.Destroy();
                                    }
                                }

                                fighter.Walls.Add(wall);
                                target.Walls.Add(wall);
                                break;
                            }
                        }
                    }
                }
            }
            if (seq)
            {
                fighter.Fight.SequencesManager.EndSequence(SequenceTypeEnum.SEQUENCE_SPELL);
            }
        }
Exemple #2
0
        /// <summary>
        /// Tue les joueurs en ligne lorsque le Royalmouth est poussé contre un obstacle
        /// </summary>
        /// <param name="startCellId"></param>
        /// <param name="endCellId"></param>
        private void KillsFightersInLine(short startCellId, DirectionsEnum direction)
        {
            MapPoint startPoint = new MapPoint(startCellId);
            MapPoint point2     = new MapPoint(startCellId);
            short    i          = 1;

            while (point2 != null)
            {
                Fighter target = this.Fighter.Fight.GetFighter(point2);

                if (target != null && this.Fighter.OposedTeam() == target.Team)
                {
                    target.Stats.CurrentLifePoints = 0;
                }

                point2 = startPoint.GetCellInDirection(direction, i);
                i++;
            }

            this.Fighter.Fight.CheckDeads();
        }
Exemple #3
0
        public short[] GetCells(short centerCell, MapRecord map)
        {
            MapPoint     mapPoint = new MapPoint(centerCell);
            List <short> list     = new List <short>();

            list.Add(centerCell);

            for (int i = 1; i < Radius + 1; i++)
            {
                var adj = mapPoint.GetCellInDirection(DirectionsEnum.DIRECTION_EAST, (short)i);
                if (adj != null)
                {
                    list.Add(adj.CellId);

                    MapPoint next = adj;

                    foreach (var cell in next.GetCellsInDirection(DirectionsEnum.DIRECTION_NORTH_WEST, (short)(i * 2)))
                    {
                        if (cell == null)
                        {
                            return(new short[0]);
                        }
                        if (!list.Contains(cell.CellId))
                        {
                            MapPoint.AddCellIfValid(cell.X, cell.Y, map, list);
                            next = cell;
                        }
                    }

                    foreach (var cell in next.GetCellsInDirection(DirectionsEnum.DIRECTION_SOUTH_WEST, (short)(i * 2)))
                    {
                        if (cell == null)
                        {
                            return(new short[0]);
                        }
                        if (!list.Contains(cell.CellId))
                        {
                            MapPoint.AddCellIfValid(cell.X, cell.Y, map, list);
                            next = cell;
                        }
                    }

                    foreach (var cell in next.GetCellsInDirection(DirectionsEnum.DIRECTION_SOUTH_EAST, (short)(i * 2)))
                    {
                        if (cell == null)
                        {
                            return(new short[0]);
                        }
                        if (!list.Contains(cell.CellId))
                        {
                            MapPoint.AddCellIfValid(cell.X, cell.Y, map, list);
                            next = cell;
                        }
                    }

                    foreach (var cell in next.GetCellsInDirection(DirectionsEnum.DIRECTION_NORTH_EAST, (short)(i * 2)))
                    {
                        if (cell == null)
                        {
                            return(new short[0]);
                        }
                        if (!list.Contains(cell.CellId))
                        {
                            MapPoint.AddCellIfValid(cell.X, cell.Y, map, list);
                            next = cell;
                        }
                    }
                }
                else
                {
                    list.Clear();
                }
            }

            return(list.ToArray());
        }