Updated implementation of Unpredictable Cyclone (#6423)

* updated implementation of Unpredictable Cyclone, refactored drawCard method

* fixed another small implementation error

* added test for Unpredictable Cyclone

* updated Unpredictable Cyclone test
This commit is contained in:
Evan Kranzler 2020-04-16 08:04:21 -04:00 committed by GitHub
parent 80b7f8493b
commit 378dfbf89a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
279 changed files with 465 additions and 378 deletions

View file

@ -29,7 +29,7 @@ public class BrainstormEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
player.drawCards(3, game);
player.drawCards(3, source.getSourceId(), game);
putOnLibrary(player, source, game);
putOnLibrary(player, source, game);
return true;

View file

@ -59,7 +59,7 @@ public class DrawCardAllEffect extends OneShotEffect {
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
Player player = game.getPlayer(playerId);
if (player != null) {
player.drawCards(amount.calculate(game, source, this), game);
player.drawCards(amount.calculate(game, source, this), source.getSourceId(), game);
}
}
break;
@ -67,7 +67,7 @@ public class DrawCardAllEffect extends OneShotEffect {
for (UUID playerId : game.getOpponents(controller.getId())) {
Player player = game.getPlayer(playerId);
if (player != null) {
player.drawCards(amount.calculate(game, source, this), game);
player.drawCards(amount.calculate(game, source, this), source.getSourceId(), game);
}
}
break;

View file

@ -54,7 +54,7 @@ public class DrawCardSourceControllerEffect extends OneShotEffect {
Player player = game.getPlayer(source.getControllerId());
if (player != null
&& player.canRespond()) {
player.drawCards(amount.calculate(game, source, this), game);
player.drawCards(amount.calculate(game, source, this), source.getSourceId(), game);
return true;
}
return false;

View file

@ -70,7 +70,7 @@ public class DrawCardTargetEffect extends OneShotEffect {
}
if (!optional
|| player.chooseUse(outcome, "Use draw effect?", source, game)) {
player.drawCards(cardsToDraw, game);
player.drawCards(cardsToDraw, source.getSourceId(), game);
}
}
}

View file

@ -58,7 +58,7 @@ public class DrawDiscardControllerEffect extends OneShotEffect {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
if (!optional || player.chooseUse(outcome, "Use draw, then discard effect?", source, game)) {
player.drawCards(cardsToDraw, game);
player.drawCards(cardsToDraw, source.getSourceId(), game);
player.discard(cardsToDiscard, false, source, game);
}
return true;

View file

@ -46,7 +46,7 @@ public class DrawDiscardOneOfThemEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Cards initialHand = controller.getHand().copy();
controller.drawCards(cardsToDraw, game);
controller.drawCards(cardsToDraw, source.getSourceId(), game);
Cards drawnCards = new CardsImpl(controller.getHand().copy());
drawnCards.removeAll(initialHand);
if (!drawnCards.isEmpty()) {

View file

@ -49,7 +49,7 @@ public class DrawDiscardTargetEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
if (player != null) {
player.drawCards(cardsToDraw, game);
player.drawCards(cardsToDraw, source.getSourceId(), game);
player.discard(cardsToDiscard, false, source, game);
return true;
}

View file

@ -37,7 +37,7 @@ public class ShuffleHandIntoLibraryDrawThatManySourceEffect extends OneShotEffec
controller.moveCards(controller.getHand(), Zone.LIBRARY, source, game);
controller.shuffleLibrary(source, game);
game.applyEffects(); // then
controller.drawCards(cardsHand, game);
controller.drawCards(cardsHand, source.getSourceId(), game);
}
return true;
}

View file

@ -28,7 +28,7 @@ public class DiscardHandDrawSameNumberSourceEffect extends OneShotEffect {
if (player != null) {
int amount = player.getHand().getCards(game).size();
player.discard(amount, false, source, game);
player.drawCards(amount, game);
player.drawCards(amount, source.getSourceId(), game);
return true;
}
return false;