forked from External/mage
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:
parent
80b7f8493b
commit
378dfbf89a
279 changed files with 465 additions and 378 deletions
|
|
@ -1,8 +1,5 @@
|
|||
package mage.actions;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.actions.impl.MageAction;
|
||||
import mage.actions.score.ArtificialScoringSystem;
|
||||
import mage.cards.Card;
|
||||
|
|
@ -12,6 +9,10 @@ import mage.game.events.GameEvent;
|
|||
import mage.players.Player;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Action for drawing cards.
|
||||
*
|
||||
|
|
@ -37,11 +38,12 @@ public class MageDrawAction extends MageAction {
|
|||
/**
|
||||
* Draw and set action score.
|
||||
*
|
||||
* @param game Game context.
|
||||
* @param sourceId
|
||||
* @param game Game context.
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int doAction(Game game) {
|
||||
public int doAction(UUID sourceId, Game game) {
|
||||
int numDrawn = 0;
|
||||
int score = 0;
|
||||
GameEvent event = GameEvent.getEvent(GameEvent.EventType.DRAW_CARDS, player.getId(), null, player.getId(), null, amount);
|
||||
|
|
@ -49,7 +51,7 @@ public class MageDrawAction extends MageAction {
|
|||
if (amount < 2 || !game.replaceEvent(event)) {
|
||||
amount = event.getAmount();
|
||||
for (int i = 0; i < amount; i++) {
|
||||
int value = drawCard(game);
|
||||
int value = drawCard(sourceId, game);
|
||||
if (value == NEGATIVE_VALUE) {
|
||||
continue;
|
||||
}
|
||||
|
|
@ -62,7 +64,7 @@ public class MageDrawAction extends MageAction {
|
|||
if (player.isEmptyDraw()) {
|
||||
event = GameEvent.getEvent(GameEvent.EventType.EMPTY_DRAW, player.getId(), player.getId());
|
||||
if (!game.replaceEvent(event)) {
|
||||
game.doAction(new MageLoseGameAction(player, MageLoseGameAction.DRAW_REASON));
|
||||
game.doAction(new MageLoseGameAction(player, MageLoseGameAction.DRAW_REASON), sourceId);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -76,11 +78,12 @@ public class MageDrawAction extends MageAction {
|
|||
* Draw a card if possible (there is no replacement effect that prevent us
|
||||
* from drawing). Fire event about card drawn.
|
||||
*
|
||||
* @param sourceId
|
||||
* @param game
|
||||
* @return
|
||||
*/
|
||||
protected int drawCard(Game game) {
|
||||
GameEvent event = GameEvent.getEvent(GameEvent.EventType.DRAW_CARD, player.getId(), player.getId());
|
||||
protected int drawCard(UUID sourceId, Game game) {
|
||||
GameEvent event = GameEvent.getEvent(GameEvent.EventType.DRAW_CARD, player.getId(), sourceId, player.getId());
|
||||
event.addAppliedEffects(appliedEffects);
|
||||
if (!game.replaceEvent(event)) {
|
||||
Card card = player.getLibrary().removeFromTop(game);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue