Implemented Unpredictable Cyclone

This commit is contained in:
Evan Kranzler 2020-04-13 22:15:18 -04:00
parent a5fb946fb3
commit a689646735
4 changed files with 151 additions and 6 deletions

View file

@ -1,18 +1,21 @@
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.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.OneShotEffect;
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;
/**
*
* @author BetaSteward_at_googlemail.com
*/
public class CyclingAbility extends ActivatedAbilityImpl {
@ -21,7 +24,7 @@ public class CyclingAbility extends ActivatedAbilityImpl {
private final String text;
public CyclingAbility(Cost cost) {
super(Zone.HAND, new DrawCardSourceControllerEffect(1), cost);
super(Zone.HAND, new CyclingDrawEffect(), cost);
this.addCost(new CyclingDiscardCost());
this.cost = cost;
this.text = "Cycling";
@ -56,5 +59,38 @@ public class CyclingAbility extends ActivatedAbilityImpl {
rule.append(cost.getText()).append(" <i>(").append(super.getRule(true)).append(")</i>");
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;
}
}

View file

@ -85,7 +85,7 @@ public class GameEvent implements Serializable {
CONVOKED,
DISCARD_CARD,
DISCARDED_CARD,
CYCLE_CARD, CYCLED_CARD,
CYCLE_CARD, CYCLED_CARD, CYCLE_DRAW,
CLASH, CLASHED,
DAMAGE_PLAYER,
/* DAMAGED_PLAYER