public BattleState(List<int> entitiesList)
        {
            entityIdSequence = 0;
            actionId = 0;
            turns = new List<BattleEntity>();
            players = new List<int>();
            spectators = new List<int>();
            entities = entitiesList;
            arena = new BattleArena(defaultsize);
            currentTurn = 0;
            WaitingPokemonGo = true;

            foreach (int entityId in entitiesList)
            {
                var entity = World.Instance.VisibleEntities[entityId];
                if (entity.Type == EntityType.Pokemon)
                {
                    BattleEntity battleEntity = new BattleEntity(entityIdSequence++, (entity as Pokemon).PokedexId, -1, entityId);
                    battleEntity.CurrentPos = GetRandomStartPosition(Direction.Left);//TODO
                    turns.Add(battleEntity);
                }
                else if (entity.Type == EntityType.Player)
                {
                    //TODO bord
                    var player = entity as Player;
                    players.Add(player.Id);
                    foreach(BattleEntity pokemon in player.Team)
                    {
                        pokemon.CurrentPos = null;
                    }
                }
            }
        }
Пример #2
0
        public List<Position> AoeTiles(BattleEntity self, Position target, Direction dir, BattleArena arena)
        {
            var result = new List<Position>();
            if (AreaOfEffect == null)
            {
                result.Add(target);
                return result;
            }

            int startX = Position.NormalizedPos(target.X - AreaOfEffect.MaxArea, arena.ArenaSize);
            int endX = Position.NormalizedPos(target.X + AreaOfEffect.MaxArea, arena.ArenaSize);
            int startY = Position.NormalizedPos(target.Y - AreaOfEffect.MaxArea, arena.ArenaSize);
            int endY = Position.NormalizedPos(target.Y + AreaOfEffect.MaxArea, arena.ArenaSize);

            for (int x = startX; x <= endX; x++)
            {
                for (int y = startY; y <= endY; y++)
                {
                    Position origin = target;
                    Position aoe = new Position(x, y);
                    bool inArea = false;

                    if (TargetType == TargetType.Position)
                    {

                        if (AreaOfEffect.InArea(origin, aoe))
                        {
                            inArea = true;
                        }
                    }

                    if (TargetType == TargetType.Directional)
                    {
                        if (AreaOfEffect.InArea(origin, aoe, dir))
                        {
                            inArea = true;
                        }
                    }

                    if (inArea)
                    {
                        result.Add(aoe);
                    }
                }
            }
            return result;
        }
Пример #3
0
 public List<Position> InRangeTiles(BattleEntity self, BattleArena arena)
 {
     return InRangeTiles(self, Direction.None, arena);
 }
Пример #4
0
 public List<Position> InRangeTiles(BattleEntity self, Direction dir, BattleArena arena)
 {
     return Range.InRangeTiles(self, dir, arena);
 }
Пример #5
0
 public List<Position> InRange2Tiles(BattleEntity self, Direction dir, BattleArena arena)
 {
     if (Range2 == null)
     {
         return new List<Position>();
     }
     return Range2.InRangeTiles(self, dir, arena).Except(Range.InRangeTiles(self, dir, arena)).ToList();
 }