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; }
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; }