Some more fixes to cards looping through players.

This commit is contained in:
LevelX2 2015-01-31 00:17:28 +01:00
parent 5597b412bf
commit 44f3ac8117
5 changed files with 20 additions and 16 deletions

View file

@ -101,7 +101,7 @@ class WhimsOfTheFateEffect extends OneShotEffect {
// Map of players and their piles (1,2,3) with values of UUID of the permanents
Map<UUID, Map<Integer, Set<UUID>>> playerPermanents = new LinkedHashMap<>();
PlayerList playerList = game.getState().getPlayerList();
PlayerList playerList = game.getState().getPlayerList().copy();
while (!playerList.get().equals(source.getControllerId()) && controller.isInGame()) {
playerList.getNext();
}
@ -117,6 +117,9 @@ class WhimsOfTheFateEffect extends OneShotEffect {
if (firstNextPlayer == null) {
firstNextPlayer = nextPlayer.getId();
}
if (!nextPlayer.isInGame()) {
continue;
}
// if player is in range of controller he chooses 3 piles with all its permanents
if (currentPlayer != null && controller.getInRange().contains(currentPlayer.getId())) {
Map<Integer, Set<UUID>> playerPiles = new HashMap<>();

View file

@ -93,7 +93,7 @@ class PlagueOfVerminEffect extends OneShotEffect {
int currentLifePaid;
int totalPaidLife;
if (controller != null) {
PlayerList playerList = game.getState().getPlayerList();
PlayerList playerList = game.getState().getPlayerList().copy();
while (!playerList.get().equals(source.getControllerId()) && controller.isInGame()) {
playerList.getNext();
}
@ -101,10 +101,10 @@ class PlagueOfVerminEffect extends OneShotEffect {
UUID firstInactivePlayer = null;
while (controller.isInGame()) {
if (currentPlayer != null && controller.getInRange().contains(currentPlayer.getId())) {
if (firstInactivePlayer == null) {
firstInactivePlayer = currentPlayer.getId();
}
if (firstInactivePlayer == null) {
firstInactivePlayer = currentPlayer.getId();
}
if (currentPlayer != null && currentPlayer.isInGame() && controller.getInRange().contains(currentPlayer.getId())) {
currentLifePaid = 0;
totalPaidLife = 0;
if (currentPlayer.chooseUse(Outcome.AIDontUseIt, "Pay life?", game)) {

View file

@ -101,7 +101,7 @@ class HypergenesisEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
PlayerList playerList = game.getState().getPlayerList();
PlayerList playerList = game.getState().getPlayerList().copy();
while (!playerList.get().equals(source.getControllerId()) && controller.isInGame()) {
playerList.getNext();
}
@ -109,8 +109,8 @@ class HypergenesisEffect extends OneShotEffect {
UUID firstInactivePlayer = null;
Target target = new TargetCardInHand(filter);
while (controller.isInGame()) {
if (currentPlayer != null && controller.getInRange().contains(currentPlayer.getId())) {
while (controller.isInGame()) {
if (currentPlayer != null && currentPlayer.isInGame() && controller.getInRange().contains(currentPlayer.getId())) {
if (firstInactivePlayer == null) {
firstInactivePlayer = currentPlayer.getId();
}

View file

@ -99,13 +99,13 @@ class CouncilsJudgmentEffect extends OneShotEffect {
FilterNonlandPermanent filter = new FilterNonlandPermanent("a nonland permanent " + controller.getName() + " doesn't control");
filter.add(Predicates.not(new ControllerIdPredicate(controller.getId())));
//Players each choose a legal permanent
PlayerList playerList = game.getState().getPlayerList();
PlayerList playerList = game.getState().getPlayerList().copy();
while (!playerList.get().equals(controller.getId()) && controller.isInGame()) {
playerList.getNext();
}
do {
Player player = game.getPlayer(playerList.get());
if (player != null) {
if (player != null && player.isInGame()) {
Target target = new TargetNonlandPermanent(filter);
target.setNotTarget(true);
if (player.choose(Outcome.Exile, target, source.getSourceId(), game)) {

View file

@ -89,7 +89,7 @@ class EurekaEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
PlayerList playerList = game.getState().getPlayerList();
PlayerList playerList = game.getState().getPlayerList().copy();
while (!playerList.get().equals(source.getControllerId()) && controller.isInGame()) {
playerList.getNext();
}
@ -98,10 +98,11 @@ class EurekaEffect extends OneShotEffect {
Target target = new TargetCardInHand(new FilterPermanentCard());
while (controller.isInGame()) {
if (currentPlayer != null && controller.getInRange().contains(currentPlayer.getId())) {
if (firstInactivePlayer == null) {
firstInactivePlayer = currentPlayer.getId();
}
if (firstInactivePlayer == null) {
firstInactivePlayer = currentPlayer.getId();
}
if (currentPlayer != null && currentPlayer.isInGame() && controller.getInRange().contains(currentPlayer.getId())) {
target.clearChosen();
if (target.canChoose(source.getSourceId(), currentPlayer.getId(), game)
&& currentPlayer.chooseUse(outcome, "Put permanent from your hand to play?", game)) {