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,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