Пример #1
0
 @Override
 public GameObjectID throwFan(GameObjectID player) throws BozorgExceptionBase {
   Player p = (Player) objects.get(player.getNumber());
   if (p.getHp() == 0) throw new BozorgExceptionBase();
   if (p.getFans() == 0) throw new BozorgExceptionBase();
   Fan f = new Fan(p.x, p.y, (Player) objects.get(player.getNumber()));
   objects.add(f);
   GameObjectID g = GameObjectID.create(f.getClass());
   f.id = g;
   objectsId.add(g);
   p.setFans(p.getFans() - 1);
   return g;
 }
Пример #2
0
 @Override
 public ArrayList<GameObjectID> loadMap(int[][] cellsType, int[][] wallsType, int[] players) {
   Player[] p = new Player[players.length];
   ArrayList<GameObjectID> ret = new ArrayList<GameObjectID>();
   for (int i = 0; i < p.length; i++) {
     p[i] = new Player(players[i]);
     ret.add(GameObjectID.create(p[i].getClass()));
     p[i].id = ret.get(i);
     objects.add(p[i]);
     objectsId.add(ret.get(i));
     this.players.add(p[i]);
   }
   map = new Map(cellsType, wallsType, p);
   return ret;
 }