diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/HanabiBlast.java b/Mage.Sets/src/mage/sets/championsofkamigawa/HanabiBlast.java index 95747a3579..4ab02c39f9 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/HanabiBlast.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/HanabiBlast.java @@ -30,16 +30,12 @@ package mage.sets.championsofkamigawa; import java.util.UUID; -import mage.Constants; import mage.Constants.CardType; import mage.Constants.Rarity; -import mage.abilities.Ability; -import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.DamageTargetEffect; +import mage.abilities.effects.common.DiscardControllerEffect; import mage.abilities.effects.common.ReturnToHandSpellEffect; import mage.cards.CardImpl; -import mage.game.Game; -import mage.players.Player; import mage.target.common.TargetCreatureOrPlayer; /** @@ -55,7 +51,7 @@ public class HanabiBlast extends CardImpl { this.getSpellAbility().addEffect(new DamageTargetEffect(2)); this.getSpellAbility().addTarget(new TargetCreatureOrPlayer()); this.getSpellAbility().addEffect(ReturnToHandSpellEffect.getInstance()); - this.getSpellAbility().addEffect(new HanabiBlastDiscardEffect()); + this.getSpellAbility().addEffect(new DiscardControllerEffect(1, true)); } public HanabiBlast (final HanabiBlast card) { @@ -68,34 +64,3 @@ public class HanabiBlast extends CardImpl { } } - -class HanabiBlastDiscardEffect extends OneShotEffect { - - private static final String effectText = "discard a card at random"; - - HanabiBlastDiscardEffect () { - super(Constants.Outcome.Discard); - staticText = effectText; - } - - HanabiBlastDiscardEffect(HanabiBlastDiscardEffect effect) { - super(effect); - } - - @Override - public boolean apply(Game game, Ability source) { - Player player = game.getPlayer(source.getControllerId()); - if (player != null) { - player.discard(player.getHand().getRandom(game), source, game); - return true; - } - return false; - } - - @Override - public HanabiBlastDiscardEffect copy() { - return new HanabiBlastDiscardEffect(this); - } - -} - diff --git a/Mage/src/mage/abilities/effects/common/DiscardControllerEffect.java b/Mage/src/mage/abilities/effects/common/DiscardControllerEffect.java index d27a18382a..205c0023ee 100644 --- a/Mage/src/mage/abilities/effects/common/DiscardControllerEffect.java +++ b/Mage/src/mage/abilities/effects/common/DiscardControllerEffect.java @@ -32,6 +32,7 @@ import mage.abilities.Ability; import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.common.StaticValue; import mage.abilities.effects.OneShotEffect; +import mage.cards.Card; import mage.game.Game; import mage.players.Player; @@ -42,20 +43,31 @@ import mage.players.Player; public class DiscardControllerEffect extends OneShotEffect { protected DynamicValue amount; - - public DiscardControllerEffect(DynamicValue amount) { - super(Outcome.Discard); - this.amount = amount; - setText(); - } + protected boolean randomDiscard; public DiscardControllerEffect(int amount) { this(new StaticValue(amount)); } + public DiscardControllerEffect(int amount, boolean randomDiscard) { + this(new StaticValue(amount), randomDiscard); + } + + public DiscardControllerEffect(DynamicValue amount) { + this(amount, false); + } + + public DiscardControllerEffect(DynamicValue amount, boolean randomDiscard) { + super(Outcome.Discard); + this.amount = amount; + this.randomDiscard = randomDiscard; + setText(); + } + public DiscardControllerEffect(final DiscardControllerEffect effect) { super(effect); this.amount = effect.amount.copy(); + this.randomDiscard = effect.randomDiscard; } @Override @@ -65,17 +77,33 @@ public class DiscardControllerEffect extends OneShotEffect 1) { sb.append("s"); @@ -83,6 +111,9 @@ public class DiscardControllerEffect extends OneShotEffect 0) { sb.append(" for each ");