mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
Implemented Estrid's Invocation
This commit is contained in:
parent
2086a43036
commit
fc2ce0629b
2 changed files with 106 additions and 0 deletions
105
Mage.Sets/src/mage/cards/e/EstridsInvocation.java
Normal file
105
Mage.Sets/src/mage/cards/e/EstridsInvocation.java
Normal file
|
@ -0,0 +1,105 @@
|
|||
package mage.cards.e;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||
import mage.abilities.common.EntersBattlefieldAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.CopyPermanentEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.util.functions.ApplyToPermanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class EstridsInvocation extends CardImpl {
|
||||
|
||||
public EstridsInvocation(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{U}");
|
||||
|
||||
// You may have Estrid's Invocation enter the battlefield as a copy of any enchantment you control, except it gains "At the beginning of your upkeep, you may exile this enchantment. If you do, return it to the battlefield under its owner's control."
|
||||
this.addAbility(new EntersBattlefieldAbility(new CopyPermanentEffect(
|
||||
StaticFilters.FILTER_ENCHANTMENT_PERMANENT,
|
||||
new EstridsInvocationApplier()
|
||||
).setText("as a copy of any enchantment you control, except it gains "
|
||||
+ "\"At the beginning of your upkeep, "
|
||||
+ "you may exile this enchantment. "
|
||||
+ "If you do, return it to the battlefield "
|
||||
+ "under its owner's control.\""), true
|
||||
));
|
||||
}
|
||||
|
||||
public EstridsInvocation(final EstridsInvocation card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EstridsInvocation copy() {
|
||||
return new EstridsInvocation(this);
|
||||
}
|
||||
}
|
||||
|
||||
class EstridsInvocationApplier extends ApplyToPermanent {
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Permanent permanent, Ability source, UUID copyToObjectId) {
|
||||
// At the beginning of your upkeep, you may exile this enchantment. If you do, return it to the battlefield under its owner's control.
|
||||
permanent.addAbility(new BeginningOfUpkeepTriggeredAbility(
|
||||
new EstridsInvocationEffect(), TargetController.YOU, true
|
||||
), source.getSourceId(), game);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, MageObject mageObject, Ability source, UUID copyToObjectId) {
|
||||
// At the beginning of your upkeep, you may exile this enchantment. If you do, return it to the battlefield under its owner's control.
|
||||
mageObject.getAbilities().add(new BeginningOfUpkeepTriggeredAbility(
|
||||
new EstridsInvocationEffect(), TargetController.YOU, true
|
||||
));
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class EstridsInvocationEffect extends OneShotEffect {
|
||||
|
||||
public EstridsInvocationEffect() {
|
||||
super(Outcome.Neutral);
|
||||
this.staticText = "you may exile this enchantment. "
|
||||
+ "If you do, return it to the battlefield under its owner's control";
|
||||
}
|
||||
|
||||
public EstridsInvocationEffect(final EstridsInvocationEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EstridsInvocationEffect copy() {
|
||||
return new EstridsInvocationEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
if (permanent.moveToExile(source.getSourceId(), "Estrid's Invocation", source.getSourceId(), game)) {
|
||||
Card card = game.getExile().getCard(source.getSourceId(), game);
|
||||
if (card != null) {
|
||||
return card.moveToZone(Zone.BATTLEFIELD, source.getSourceId(), game, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -37,6 +37,7 @@ public final class Commander2018 extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Empyrial Storm", 2, Rarity.RARE, mage.cards.e.EmpyrialStorm.class));
|
||||
cards.add(new SetCardInfo("Enchanter's Bane", 21, Rarity.RARE, mage.cards.e.EnchantersBane.class));
|
||||
cards.add(new SetCardInfo("Enchantress's Presence", 141, Rarity.RARE, mage.cards.e.EnchantresssPresence.class));
|
||||
cards.add(new SetCardInfo("Estrid's Invocation", 8, Rarity.RARE, mage.cards.e.EstridsInvocation.class));
|
||||
cards.add(new SetCardInfo("Explosive Vegetation", 144, Rarity.UNCOMMON, mage.cards.e.ExplosiveVegetation.class));
|
||||
cards.add(new SetCardInfo("Finest Hour", 180, Rarity.RARE, mage.cards.f.FinestHour.class));
|
||||
cards.add(new SetCardInfo("Forge of Heroes", 58, Rarity.COMMON, mage.cards.f.ForgeOfHeroes.class));
|
||||
|
|
Loading…
Reference in a new issue