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
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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()) {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -1,18 +1,13 @@
|
|||
package mage.abilities.keyword;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.ActivatedAbilityImpl;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.common.CyclingDiscardCost;
|
||||
import mage.abilities.costs.mana.ManaCost;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCardInLibrary;
|
||||
|
||||
/**
|
||||
|
|
@ -24,7 +19,7 @@ public class CyclingAbility extends ActivatedAbilityImpl {
|
|||
private final String text;
|
||||
|
||||
public CyclingAbility(Cost cost) {
|
||||
super(Zone.HAND, new CyclingDrawEffect(), cost);
|
||||
super(Zone.HAND, new DrawCardSourceControllerEffect(1), cost);
|
||||
this.addCost(new CyclingDiscardCost());
|
||||
this.cost = cost;
|
||||
this.text = "Cycling";
|
||||
|
|
@ -60,37 +55,3 @@ public class CyclingAbility extends ActivatedAbilityImpl {
|
|||
return rule.toString();
|
||||
}
|
||||
}
|
||||
|
||||
class CyclingDrawEffect extends OneShotEffect {
|
||||
|
||||
CyclingDrawEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "draw a card";
|
||||
}
|
||||
|
||||
private CyclingDrawEffect(final CyclingDrawEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CyclingDrawEffect copy() {
|
||||
return new CyclingDrawEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getSourceId());
|
||||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
GameEvent event = GameEvent.getEvent(
|
||||
GameEvent.EventType.CYCLE_DRAW, source.getSourceId(),
|
||||
source.getSourceId(), source.getControllerId()
|
||||
);
|
||||
if (game.replaceEvent(event)) {
|
||||
return true;
|
||||
}
|
||||
player.drawCards(1, game);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue