return captureAction;
}
@Override
public void takePrisoner(Position p, Location loc, Class<? extends Meeple> meepleType, Integer meepleOwner) {
Follower m = (Follower) game.getMeeple(p, loc, meepleType, game.getPlayer(meepleOwner));
m.undeploy();
//undeploy returns figure to owner -> we must handle capture / prisoner exchange
Player me = getActivePlayer();
if (m.getPlayer() != me) {
TowerCapability towerCap = game.getCapability(TowerCapability.class);
List<Follower> prisoners = towerCap.getPrisoners().get(m.getPlayer());
List<Follower> myCapturedFollowers = new ArrayList<>();
for (Follower f : prisoners) {
if (f.getPlayer() == me) {
myCapturedFollowers.add(f);
}
}
if (myCapturedFollowers.isEmpty()) {
towerCap.inprison(m, me);
} else {
//opponent has my prisoner - figure exchange
Follower exchanged = myCapturedFollowers.get(0); //TODO same type?
boolean removeOk = prisoners.remove(exchanged);
assert removeOk;
exchanged.clearDeployment();
game.post(new MeeplePrisonEvent(exchanged, m.getPlayer(), null));
}
}
next();
}