Merge pull request #7282 from weirddan455/court-of-ambition-fix

Fixed Court of Ambition incorrectly causing you to discard cards (fixes #7263)
This commit is contained in:
Oleg Agafonov 2020-12-25 18:52:47 +01:00 committed by GitHub
commit a1c82f91d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -70,7 +70,7 @@ class CourtOfAmbitionEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
int discardCount = source.isControlledBy(game.getMonarchId()) ? 2 : 1; int discardCount = source.isControlledBy(game.getMonarchId()) ? 2 : 1;
String message = "Discard " + CardUtil.numberToText(discardCount, "a") String message = "Discard " + CardUtil.numberToText(discardCount, "a")
+ "card" + (discardCount > 1 ? 's' : "") + "? If not you lose " + (discardCount * 3) + " life"; + " card" + (discardCount > 1 ? 's' : "") + "? If not you lose " + (discardCount * 3) + " life";
Map<UUID, Cards> discardMap = new HashMap<>(); Map<UUID, Cards> discardMap = new HashMap<>();
for (UUID playerId : game.getOpponents(source.getControllerId())) { for (UUID playerId : game.getOpponents(source.getControllerId())) {
Player player = game.getPlayer(playerId); Player player = game.getPlayer(playerId);
@ -79,6 +79,7 @@ class CourtOfAmbitionEffect extends OneShotEffect {
} }
if (player.getHand().size() < discardCount || !player.chooseUse(outcome, message, source, game)) { if (player.getHand().size() < discardCount || !player.chooseUse(outcome, message, source, game)) {
player.loseLife(discardCount * 3, game, source, false); player.loseLife(discardCount * 3, game, source, false);
continue;
} }
TargetDiscard target = new TargetDiscard(discardCount, StaticFilters.FILTER_CARD, playerId); TargetDiscard target = new TargetDiscard(discardCount, StaticFilters.FILTER_CARD, playerId);
player.choose(outcome, target, source.getSourceId(), game); player.choose(outcome, target, source.getSourceId(), game);