mirror of
https://github.com/correl/mage.git
synced 2025-01-01 03:00:12 +00:00
[ONE] Implement Conduit of Worlds
This commit is contained in:
parent
747a9b14f7
commit
35cf249236
2 changed files with 133 additions and 0 deletions
132
Mage.Sets/src/mage/cards/c/ConduitOfWorlds.java
Normal file
132
Mage.Sets/src/mage/cards/c/ConduitOfWorlds.java
Normal file
|
@ -0,0 +1,132 @@
|
||||||
|
package mage.cards.c;
|
||||||
|
|
||||||
|
import mage.ApprovingObject;
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.common.ActivateAsSorceryActivatedAbility;
|
||||||
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
|
import mage.abilities.costs.common.TapSourceCost;
|
||||||
|
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
|
||||||
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
import mage.abilities.effects.common.ruleModifying.PlayLandsFromGraveyardControllerEffect;
|
||||||
|
import mage.cards.Card;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.cards.CardSetInfo;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Duration;
|
||||||
|
import mage.constants.Outcome;
|
||||||
|
import mage.filter.FilterCard;
|
||||||
|
import mage.filter.common.FilterNonlandCard;
|
||||||
|
import mage.filter.predicate.mageobject.PermanentPredicate;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.game.events.GameEvent;
|
||||||
|
import mage.players.Player;
|
||||||
|
import mage.target.common.TargetCardInYourGraveyard;
|
||||||
|
import mage.watchers.common.SpellsCastWatcher;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author TheElk801
|
||||||
|
*/
|
||||||
|
public final class ConduitOfWorlds extends CardImpl {
|
||||||
|
|
||||||
|
private static final FilterCard filter = new FilterNonlandCard("nonland permanent card");
|
||||||
|
|
||||||
|
static {
|
||||||
|
filter.add(PermanentPredicate.instance);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ConduitOfWorlds(UUID ownerId, CardSetInfo setInfo) {
|
||||||
|
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}{G}{G}");
|
||||||
|
|
||||||
|
// You may play lands from your graveyard.
|
||||||
|
this.addAbility(new SimpleStaticAbility(new PlayLandsFromGraveyardControllerEffect()));
|
||||||
|
|
||||||
|
// {T}: Choose target nonland permanent card in your graveyard. If you haven't cast a spell this turn, you may cast that card. If you do, you can't cast additional spells this turn. Activate only as a sorcery.
|
||||||
|
Ability ability = new ActivateAsSorceryActivatedAbility(new ConduitOfWorldsEffect(), new TapSourceCost());
|
||||||
|
ability.addTarget(new TargetCardInYourGraveyard(filter));
|
||||||
|
this.addAbility(ability);
|
||||||
|
}
|
||||||
|
|
||||||
|
private ConduitOfWorlds(final ConduitOfWorlds card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ConduitOfWorlds copy() {
|
||||||
|
return new ConduitOfWorlds(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ConduitOfWorldsEffect extends OneShotEffect {
|
||||||
|
|
||||||
|
ConduitOfWorldsEffect() {
|
||||||
|
super(Outcome.Benefit);
|
||||||
|
staticText = "choose target nonland permanent card in your graveyard. " +
|
||||||
|
"If you haven't cast a spell this turn, you may cast that card. " +
|
||||||
|
"If you do, you can't cast additional spells this turn";
|
||||||
|
}
|
||||||
|
|
||||||
|
private ConduitOfWorldsEffect(final ConduitOfWorldsEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ConduitOfWorldsEffect copy() {
|
||||||
|
return new ConduitOfWorldsEffect(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
if (!game.getState()
|
||||||
|
.getWatcher(SpellsCastWatcher.class)
|
||||||
|
.getSpellsCastThisTurn(source.getControllerId())
|
||||||
|
.isEmpty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Player player = game.getPlayer(source.getControllerId());
|
||||||
|
Card card = game.getCard(getTargetPointer().getFirst(game, source));
|
||||||
|
if (player == null || card == null || !player.chooseUse(
|
||||||
|
Outcome.Benefit, "Cast " + card.getName() + "? (You still pay the costs)", source, game
|
||||||
|
)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), Boolean.TRUE);
|
||||||
|
boolean wasCast = player.cast(
|
||||||
|
player.chooseAbilityForCast(card, game, false),
|
||||||
|
game, false, new ApprovingObject(source, game)
|
||||||
|
);
|
||||||
|
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), null);
|
||||||
|
if (!wasCast) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
game.addEffect(new ConduitOfWorldsCantCastEffect(), source);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ConduitOfWorldsCantCastEffect extends ContinuousRuleModifyingEffectImpl {
|
||||||
|
|
||||||
|
public ConduitOfWorldsCantCastEffect() {
|
||||||
|
super(Duration.EndOfTurn, Outcome.Detriment);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ConduitOfWorldsCantCastEffect(final ConduitOfWorldsCantCastEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ConduitOfWorldsCantCastEffect copy() {
|
||||||
|
return new ConduitOfWorldsCantCastEffect(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == GameEvent.EventType.CAST_SPELL;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
|
return source.isControlledBy(event.getPlayerId());
|
||||||
|
}
|
||||||
|
}
|
|
@ -70,6 +70,7 @@ public final class PhyrexiaAllWillBeOne extends ExpansionSet {
|
||||||
cards.add(new SetCardInfo("Churning Reservoir", 127, Rarity.UNCOMMON, mage.cards.c.ChurningReservoir.class));
|
cards.add(new SetCardInfo("Churning Reservoir", 127, Rarity.UNCOMMON, mage.cards.c.ChurningReservoir.class));
|
||||||
cards.add(new SetCardInfo("Cinderslash Ravager", 200, Rarity.UNCOMMON, mage.cards.c.CinderslashRavager.class));
|
cards.add(new SetCardInfo("Cinderslash Ravager", 200, Rarity.UNCOMMON, mage.cards.c.CinderslashRavager.class));
|
||||||
cards.add(new SetCardInfo("Compleat Devotion", 7, Rarity.COMMON, mage.cards.c.CompleatDevotion.class));
|
cards.add(new SetCardInfo("Compleat Devotion", 7, Rarity.COMMON, mage.cards.c.CompleatDevotion.class));
|
||||||
|
cards.add(new SetCardInfo("Conduit of Worlds", 163, Rarity.RARE, mage.cards.c.ConduitOfWorlds.class));
|
||||||
cards.add(new SetCardInfo("Contagious Vorrac", 164, Rarity.COMMON, mage.cards.c.ContagiousVorrac.class));
|
cards.add(new SetCardInfo("Contagious Vorrac", 164, Rarity.COMMON, mage.cards.c.ContagiousVorrac.class));
|
||||||
cards.add(new SetCardInfo("Copper Longlegs", 165, Rarity.COMMON, mage.cards.c.CopperLonglegs.class));
|
cards.add(new SetCardInfo("Copper Longlegs", 165, Rarity.COMMON, mage.cards.c.CopperLonglegs.class));
|
||||||
cards.add(new SetCardInfo("Copperline Gorge", 249, Rarity.RARE, mage.cards.c.CopperlineGorge.class));
|
cards.add(new SetCardInfo("Copperline Gorge", 249, Rarity.RARE, mage.cards.c.CopperlineGorge.class));
|
||||||
|
|
Loading…
Reference in a new issue