Implemented Interplanar Beacon

This commit is contained in:
Evan Kranzler 2019-03-31 18:49:25 -04:00
parent 54a1010c36
commit b73ac4ae8b
2 changed files with 96 additions and 0 deletions

View file

@ -0,0 +1,95 @@
package mage.cards.i;
import mage.ConditionalMana;
import mage.MageObject;
import mage.Mana;
import mage.abilities.Ability;
import mage.abilities.common.SpellCastControllerTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.mana.ColorlessManaAbility;
import mage.abilities.mana.ConditionalAnyColorManaAbility;
import mage.abilities.mana.builder.ConditionalManaBuilder;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.filter.FilterSpell;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.game.Game;
import mage.game.stack.Spell;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class InterplanarBeacon extends CardImpl {
private static final FilterSpell filter = new FilterSpell("a planeswalker spell");
static {
filter.add(new CardTypePredicate(CardType.PLANESWALKER));
}
public InterplanarBeacon(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.LAND}, "");
// Whenever you cast a planeswalker spell, you gain 1 life.
this.addAbility(new SpellCastControllerTriggeredAbility(
new GainLifeEffect(1), filter, false
));
// {T}: Add {C}.
this.addAbility(new ColorlessManaAbility());
// {1}, {T}: Add two mana of different colors. Spend this mana only to cast planeswalker spells.
Ability ability = new ConditionalAnyColorManaAbility(
new GenericManaCost(1), 2,
new InterplanarBeaconManaBuilder()
);
ability.addCost(new TapSourceCost());
this.addAbility(ability);
}
private InterplanarBeacon(final InterplanarBeacon card) {
super(card);
}
@Override
public InterplanarBeacon copy() {
return new InterplanarBeacon(this);
}
}
class InterplanarBeaconManaBuilder extends ConditionalManaBuilder {
@Override
public ConditionalMana build(Object... options) {
return new InterplanarBeaconConditionalMana(this.mana);
}
@Override
public String getRule() {
return "Spend this mana only to cast planeswalker spells";
}
}
class InterplanarBeaconConditionalMana extends ConditionalMana {
InterplanarBeaconConditionalMana(Mana mana) {
super(mana);
this.staticText = "Spend this mana only to cast planeswalker spells";
addCondition(new InterplanarBeaconManaCondition());
}
}
class InterplanarBeaconManaCondition implements Condition {
@Override
public boolean apply(Game game, Ability source) {
MageObject object = source.getSourceObject(game);
return object instanceof Spell && object.isPlaneswalker();
}
}

View file

@ -34,6 +34,7 @@ public final class WarOfTheSpark extends ExpansionSet {
cards.add(new SetCardInfo("Forest", 264, Rarity.LAND, mage.cards.basiclands.Forest.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Herald of the Dreadhorde", 93, Rarity.COMMON, mage.cards.h.HeraldOfTheDreadhorde.class));
cards.add(new SetCardInfo("Ignite the Beacon", 18, Rarity.RARE, mage.cards.i.IgniteTheBeacon.class));
cards.add(new SetCardInfo("Interplanar Beacon", 247, Rarity.UNCOMMON, mage.cards.i.InterplanarBeacon.class));
cards.add(new SetCardInfo("Invade the City", 201, Rarity.UNCOMMON, mage.cards.i.InvadeTheCity.class));
cards.add(new SetCardInfo("Island", 253, Rarity.LAND, mage.cards.basiclands.Island.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Island", 254, Rarity.LAND, mage.cards.basiclands.Island.class, NON_FULL_USE_VARIOUS));