Implemented Wellspring

This commit is contained in:
Evan Kranzler 2019-08-26 12:49:08 -04:00
parent 1f1eb08609
commit 217e4b14e0
2 changed files with 91 additions and 0 deletions

View file

@ -0,0 +1,90 @@
package mage.cards.w;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.UntapEnchantedEffect;
import mage.abilities.effects.common.continuous.GainControlTargetEffect;
import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.TargetPermanent;
import mage.target.common.TargetLandPermanent;
import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class Wellspring extends CardImpl {
public Wellspring(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{G}{W}");
this.subtype.add(SubType.AURA);
// Enchant land
TargetPermanent auraTarget = new TargetLandPermanent();
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature));
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
// When Wellspring enters the battlefield, gain control of enchanted land until end of turn.
this.addAbility(new EntersBattlefieldTriggeredAbility(
new WellspringEffect("gain control of enchanted land until end of turn")
));
// At the beginning of your upkeep, untap enchanted land. You gain control of that land until end of turn.
ability = new BeginningOfUpkeepTriggeredAbility(
new UntapEnchantedEffect().setText("untap enchanted land."), TargetController.YOU, false
);
ability.addEffect(new WellspringEffect("You gain control of that land until end of turn"));
this.addAbility(ability);
}
private Wellspring(final Wellspring card) {
super(card);
}
@Override
public Wellspring copy() {
return new Wellspring(this);
}
}
class WellspringEffect extends OneShotEffect {
WellspringEffect(String text) {
super(Outcome.Benefit);
staticText = text;
}
private WellspringEffect(final WellspringEffect effect) {
super(effect);
}
@Override
public WellspringEffect copy() {
return new WellspringEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (permanent == null) {
return false;
}
ContinuousEffect effect = new GainControlTargetEffect(Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(permanent.getAttachedTo(), game));
game.addEffect(effect, source);
return true;
}
}

View file

@ -329,6 +329,7 @@ public final class Mirage extends ExpansionSet {
cards.add(new SetCardInfo("Ward of Lights", 47, Rarity.COMMON, mage.cards.w.WardOfLights.class));
cards.add(new SetCardInfo("Warping Wurm", 287, Rarity.RARE, mage.cards.w.WarpingWurm.class));
cards.add(new SetCardInfo("Wave Elemental", 102, Rarity.UNCOMMON, mage.cards.w.WaveElemental.class));
cards.add(new SetCardInfo("Wellspring", 348, Rarity.RARE, mage.cards.w.Wellspring.class));
cards.add(new SetCardInfo("Wild Elephant", 254, Rarity.COMMON, mage.cards.w.WildElephant.class));
cards.add(new SetCardInfo("Wildfire Emissary", 203, Rarity.UNCOMMON, mage.cards.w.WildfireEmissary.class));
cards.add(new SetCardInfo("Windreaper Falcon", 289, Rarity.UNCOMMON, mage.cards.w.WindreaperFalcon.class));