Merge branch 'guiChoiceFixGameCache' into 'master'

Player Human: fix chooseSingleEntityForEffect

See merge request core-developers/forge!2839
This commit is contained in:
Michael Kamensky
2020-05-29 07:19:44 +00:00
2 changed files with 12 additions and 2 deletions

View File

@@ -545,6 +545,16 @@ public class Game {
}
}
public Card findByView(CardView view) {
CardIdVisitor visit = new CardIdVisitor(view.getId());
if (ZoneType.Stack.equals(view.getZone())) {
visit.visitAll(getStackZone());
} else {
visit.visitAll(getPlayer(view.getController()).getZone(view.getZone()));
}
return visit.getFound();
}
public Card findById(int id) {
CardIdVisitor visit = new CardIdVisitor(id);
this.forEachCardInGame(visit);

View File

@@ -465,7 +465,7 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
gameCacheChoose.getTrackableKeys(), delayedReveal, isOptional);
endTempShowCards();
if (result != null || !gameCacheChoose.containsKey(result)) {
if (result == null || !gameCacheChoose.containsKey(result)) {
return null;
}
return gameCacheChoose.get(result);
@@ -3014,7 +3014,7 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
}
public Card getCard(final CardView cardView) {
return getGame().findById(cardView.getId());
return getGame().findByView(cardView);
}
public CardCollection getCardList(Iterable<CardView> cardViews) {