Пример #1
0
 public boolean useSpecialAbility(int row, int col) {
   if (canUseSpecialAbility(row, col)) {
     BombObstacle bomb = (BombObstacle) game.getGameSquareAt(row, col).getOccupant();
     bomb.defuse();
     return true;
   }
   return false;
 }
Пример #2
0
 public boolean canUseSpecialAbility(int row, int col) {
   if (game.getGameSquareAt(row, col) != null) {
     if (game.getGameSquareAt(row, col).hasOccupant()
         && game.getGameSquareAt(row, col).getOccupant() instanceof BombObstacle) {
       BombObstacle bomb = (BombObstacle) game.getGameSquareAt(row, col).getOccupant();
       if (bomb.getSource() == team) return false;
       else return true;
     }
     return false;
   }
   return false;
 }