package y3.players;
import java.util.List;
import y3.fight.Fight;
import y3.playground.Board;
import y3.playground.Tile;
import y3.threadViz.ThreadViz;
/**
* Koletise klass.
* M�ngija abstraktse klassi Player alamklass.
*
* @author Jaak Laanpere
*
*/
public class Monster extends Player {
/**
* Konstruktor.
*
* @param name
* @param board
*/
public Monster(String name, Board board) {
super(name, board);
}
/**
* Punasele m�nguv�ljale sisenemise meetod.
* Kontrollib, kas m�nguv�ljal on m�ngijaid, kes ei ole koletised.
* Kui on, siis tuleb lahing.
*/
@Override
public void enterRedTile(Tile t) {
List<Player> players = t.getPlayers();
if(players.isEmpty()){
ThreadViz.addMessage(this, " hyppab kannatamatult yhelt jalalt teisele.");
} else {
for(Player p : players){
if(p instanceof Monster){
players.remove(p);
}
}
if (!players.isEmpty()) {
Player opponent = players.get(0);
Fight fight = new Fight(opponent, this, t);
}
}
}
/**
* Valgele m�nguv�ljale sisenemise meetod.
* Koletis magab valgel m�nguv�ljal ja ei saa k�rgemat level'it.
*/
@Override
public void enterWhiteTile(Tile t) {
ThreadViz.addMessage(this, " magab norinal.");
}
}