Beispiel #1
0
 @Override
 public void getGift(GameObjectID player) throws BozorgExceptionBase {
   Player p = (Player) objects.get(player.getNumber());
   if (p.getHp() == 0) throw new BozorgExceptionBase();
   if (getMapCellType(p.x, p.y, player) != BONUS_CELL) throw new BozorgExceptionBase();
   for (Player x : Judge.players) {
     if (x.equals(p)) continue;
     if (x.x == p.x && x.y == p.y) throw new BozorgExceptionBase();
   }
   int t = map.getMap()[p.x][p.y].getType();
   if (t == JUMP_CELL) {
     p.setJump(p.getJump() + 2000);
   }
   if (t == SPEEDUP_CELL) {
     p.setSpeed(p.getSpeed() + 5000);
   }
   if (t == STONE_CELL) {
     p.setStun(p.getStun() + 3000);
   }
   if (t == FAN_CELL) {
     p.setFans(p.getFans() + 3);
   }
   if (t == RADAR_CELL) {
     p.setVision(p.getVision() + 3000);
   }
   if (t == HOSPITAL_CELL) {
     p.setHp(Math.min(p.getHp() + 20, 100));
   }
   map.getMap()[p.x][p.y].setType(0);
 }