mirror of
https://github.com/correl/mage.git
synced 2025-01-13 11:01:58 +00:00
fixed Emergency Powers addendum not working
This commit is contained in:
parent
0c3174ccda
commit
5cffe367ee
1 changed files with 38 additions and 17 deletions
|
@ -1,7 +1,8 @@
|
||||||
package mage.cards.e;
|
package mage.cards.e;
|
||||||
|
|
||||||
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.condition.common.AddendumCondition;
|
import mage.abilities.condition.common.AddendumCondition;
|
||||||
import mage.abilities.decorator.ConditionalOneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.abilities.effects.common.DrawCardAllEffect;
|
import mage.abilities.effects.common.DrawCardAllEffect;
|
||||||
import mage.abilities.effects.common.ExileSpellEffect;
|
import mage.abilities.effects.common.ExileSpellEffect;
|
||||||
import mage.abilities.effects.common.PutCardFromHandOntoBattlefieldEffect;
|
import mage.abilities.effects.common.PutCardFromHandOntoBattlefieldEffect;
|
||||||
|
@ -10,8 +11,10 @@ import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.ComparisonType;
|
import mage.constants.ComparisonType;
|
||||||
|
import mage.constants.Outcome;
|
||||||
import mage.filter.common.FilterPermanentCard;
|
import mage.filter.common.FilterPermanentCard;
|
||||||
import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
|
import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
|
||||||
|
import mage.game.Game;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@ -20,30 +23,15 @@ import java.util.UUID;
|
||||||
*/
|
*/
|
||||||
public final class EmergencyPowers extends CardImpl {
|
public final class EmergencyPowers extends CardImpl {
|
||||||
|
|
||||||
public static final FilterPermanentCard filter
|
|
||||||
= new FilterPermanentCard("a permanent card with converted mana cost 7 or less");
|
|
||||||
|
|
||||||
static {
|
|
||||||
filter.add(new ConvertedManaCostPredicate(ComparisonType.FEWER_THAN, 8));
|
|
||||||
}
|
|
||||||
|
|
||||||
public EmergencyPowers(UUID ownerId, CardSetInfo setInfo) {
|
public EmergencyPowers(UUID ownerId, CardSetInfo setInfo) {
|
||||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{5}{W}{U}");
|
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{5}{W}{U}");
|
||||||
|
|
||||||
// Each player shuffles their hand and graveyard into their library, then draws seven cards. Exile Emergency Powers.
|
// Each player shuffles their hand and graveyard into their library, then draws seven cards. Exile Emergency Powers.
|
||||||
this.getSpellAbility().addEffect(new ShuffleHandGraveyardAllEffect());
|
this.getSpellAbility().addEffect(new ShuffleHandGraveyardAllEffect());
|
||||||
this.getSpellAbility().addEffect(new DrawCardAllEffect(7).setText(", then draws seven cards"));
|
this.getSpellAbility().addEffect(new DrawCardAllEffect(7).setText(", then draws seven cards"));
|
||||||
this.getSpellAbility().addEffect(ExileSpellEffect.getInstance());
|
|
||||||
|
|
||||||
// Addendum — If you cast this spell during your main phase, you may put a permanent card with converted mana cost 7 or less from your hand onto the battlefield.
|
// Addendum — If you cast this spell during your main phase, you may put a permanent card with converted mana cost 7 or less from your hand onto the battlefield.
|
||||||
this.getSpellAbility().addEffect(new ConditionalOneShotEffect(
|
this.getSpellAbility().addEffect(new EmergencyPowersEffect());
|
||||||
new PutCardFromHandOntoBattlefieldEffect(filter),
|
|
||||||
AddendumCondition.instance,
|
|
||||||
"<br><i>Addendum</i> — " +
|
|
||||||
"If you cast this spell during your main phase, " +
|
|
||||||
"you may put a permanent card with converted mana cost 7 or less " +
|
|
||||||
"from your hand onto the battlefield."
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private EmergencyPowers(final EmergencyPowers card) {
|
private EmergencyPowers(final EmergencyPowers card) {
|
||||||
|
@ -55,4 +43,37 @@ public final class EmergencyPowers extends CardImpl {
|
||||||
return new EmergencyPowers(this);
|
return new EmergencyPowers(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class EmergencyPowersEffect extends OneShotEffect {
|
||||||
|
|
||||||
|
public static final FilterPermanentCard filter
|
||||||
|
= new FilterPermanentCard("a permanent card with converted mana cost 7 or less");
|
||||||
|
|
||||||
|
static {
|
||||||
|
filter.add(new ConvertedManaCostPredicate(ComparisonType.FEWER_THAN, 8));
|
||||||
|
}
|
||||||
|
|
||||||
|
EmergencyPowersEffect() {
|
||||||
|
super(Outcome.Benefit);
|
||||||
|
staticText = "Exile {this}.<br><i>Addendum</i> — If you cast this spell during your main phase, " +
|
||||||
|
"you may put a permanent card with converted mana cost 7 or less from your hand onto the battlefield.";
|
||||||
|
}
|
||||||
|
|
||||||
|
private EmergencyPowersEffect(final EmergencyPowersEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EmergencyPowersEffect copy() {
|
||||||
|
return new EmergencyPowersEffect(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
if (AddendumCondition.instance.apply(game, source)) {
|
||||||
|
new PutCardFromHandOntoBattlefieldEffect(filter).apply(game, source);
|
||||||
|
}
|
||||||
|
return ExileSpellEffect.getInstance().apply(game, source);
|
||||||
|
}
|
||||||
|
}
|
||||||
// I am the senate!
|
// I am the senate!
|
||||||
|
|
Loading…
Reference in a new issue