Implemented Unbreakable Formation

This commit is contained in:
Evan Kranzler 2019-01-08 12:29:08 -05:00
parent dc2625d512
commit 4201f0a260
2 changed files with 80 additions and 0 deletions

View file

@ -0,0 +1,79 @@
package mage.cards.u;
import mage.abilities.Ability;
import mage.abilities.condition.common.AddendumCondition;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.GainAbilityControlledEffect;
import mage.abilities.effects.common.counter.AddCountersAllEffect;
import mage.abilities.keyword.IndestructibleAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.counters.CounterType;
import mage.filter.StaticFilters;
import mage.game.Game;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class UnbreakableFormation extends CardImpl {
public UnbreakableFormation(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{W}");
// Creatures you control gain indestructible until end of turn.
this.getSpellAbility().addEffect(new GainAbilityControlledEffect(
IndestructibleAbility.getInstance(), Duration.EndOfTurn,
StaticFilters.FILTER_PERMANENT_CREATURE
));
// Addendum If you cast this spell during your main phase, put a +1/+1 counter on each of those creatures, and they also gain vigilance until end of turn.
this.getSpellAbility().addEffect(new UnbreakableFormationEffect());
}
private UnbreakableFormation(final UnbreakableFormation card) {
super(card);
}
@Override
public UnbreakableFormation copy() {
return new UnbreakableFormation(this);
}
}
class UnbreakableFormationEffect extends OneShotEffect {
UnbreakableFormationEffect() {
super(Outcome.Benefit);
staticText = "<br><i>Addendum</i> &mdash; If you cast this spell during your main phase, " +
"put a +1/+1 counter on each of those creatures, and they also gain vigilance until end of turn.";
}
private UnbreakableFormationEffect(final UnbreakableFormationEffect effect) {
super(effect);
}
@Override
public UnbreakableFormationEffect copy() {
return new UnbreakableFormationEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
if (!AddendumCondition.instance.apply(game, source)) {
return false;
}
game.addEffect(new GainAbilityControlledEffect(
IndestructibleAbility.getInstance(), Duration.EndOfTurn,
StaticFilters.FILTER_PERMANENT_CREATURE
), source);
return new AddCountersAllEffect(
CounterType.P1P1.createInstance(),
StaticFilters.FILTER_CONTROLLED_CREATURE
).apply(game, source);
}
}

View file

@ -142,6 +142,7 @@ public final class RavnicaAllegiance extends ExpansionSet {
cards.add(new SetCardInfo("Titanic Brawl", 146, Rarity.COMMON, mage.cards.t.TitanicBrawl.class));
cards.add(new SetCardInfo("Tithe Taker", 27, Rarity.RARE, mage.cards.t.TitheTaker.class));
cards.add(new SetCardInfo("Trollbred Guardian", 148, Rarity.UNCOMMON, mage.cards.t.TrollbredGuardian.class));
cards.add(new SetCardInfo("Unbreakable Formation", 29, Rarity.RARE, mage.cards.u.UnbreakableFormation.class));
cards.add(new SetCardInfo("Verity Circle", 58, Rarity.RARE, mage.cards.v.VerityCircle.class));
cards.add(new SetCardInfo("Warrant // Warden", 230, Rarity.RARE, mage.cards.w.WarrantWarden.class));
cards.add(new SetCardInfo("Wilderness Reclamation", 149, Rarity.UNCOMMON, mage.cards.w.WildernessReclamation.class));