[STX] Implemented Jadzi, Oracle of Arcavios / Journey to the Oracle

This commit is contained in:
Evan Kranzler 2021-04-11 18:10:56 -04:00
parent dab3dfdc5a
commit edec5b32fb
2 changed files with 162 additions and 0 deletions

View file

@ -0,0 +1,161 @@
package mage.cards.j;
import mage.ApprovingObject;
import mage.abilities.Ability;
import mage.abilities.SpellAbility;
import mage.abilities.common.MagecraftAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
import mage.abilities.costs.common.DiscardCardCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.decorator.ConditionalOneShotEffect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DoIfCostPaid;
import mage.abilities.effects.common.ReturnToHandSourceEffect;
import mage.abilities.hint.common.LandsYouControlHint;
import mage.cards.Card;
import mage.cards.CardSetInfo;
import mage.cards.CardsImpl;
import mage.cards.ModalDoubleFacesCard;
import mage.constants.*;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetCardInHand;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class JadziOracleOfArcavios extends ModalDoubleFacesCard {
private static final Condition condition = new PermanentsOnTheBattlefieldCondition(
StaticFilters.FILTER_CONTROLLED_PERMANENT_LAND, ComparisonType.MORE_THAN, 7
);
public JadziOracleOfArcavios(UUID ownerId, CardSetInfo setInfo) {
super(
ownerId, setInfo,
new CardType[]{CardType.CREATURE}, new SubType[]{SubType.HUMAN, SubType.WIZARD}, "{6}{U}{U}",
"Journey to the Oracle",
new CardType[]{CardType.SORCERY}, new SubType[]{}, "{2}{G}{G}"
);
// 1.
// Jadzi, Oracle of Arcavios
// Legendary Creature - Human Wizard
this.getLeftHalfCard().addSuperType(SuperType.LEGENDARY);
this.getLeftHalfCard().setPT(5, 5);
// Discard a card: Return Jadzi, Oracle of Arcavios to its owner's hand.
this.getLeftHalfCard().addAbility(new SimpleActivatedAbility(
new ReturnToHandSourceEffect(true), new DiscardCardCost()
));
// Magecraft Whenever you cast or copy an instant or sorcery spell, reveal the top card of your library. If it's a nonland card, you may cast it by paying {1} rather than paying its mana cost. If it's a land card, put it onto the battlefield.
this.getLeftHalfCard().addAbility(new MagecraftAbility(new JadziOracleOfArcaviosEffect()));
// 1.
// Journey to the Oracle
// Sorcery
// You may put any number of land cards from your hand onto the battlefield. Then if you control eight or more lands, you may discard a card. If you do, return Journey to the Oracle to it owner's hand.
this.getRightHalfCard().getSpellAbility().addEffect(new JourneyToTheOracleEffect());
this.getRightHalfCard().getSpellAbility().addEffect(new ConditionalOneShotEffect(
new DoIfCostPaid(
new ReturnToHandSourceEffect(), new DiscardCardCost()
), condition, "Then if you control eight or more lands, " +
"you may discard a card. If you do, return {this} to its owner's hand."
));
this.getRightHalfCard().getSpellAbility().addHint(LandsYouControlHint.instance);
}
private JadziOracleOfArcavios(final JadziOracleOfArcavios card) {
super(card);
}
@Override
public JadziOracleOfArcavios copy() {
return new JadziOracleOfArcavios(this);
}
}
class JadziOracleOfArcaviosEffect extends OneShotEffect {
JadziOracleOfArcaviosEffect() {
super(Outcome.Benefit);
staticText = "reveal the top card of your library. If it's a nonland card, you may cast it " +
"by paying {1} rather than paying its mana cost. If it's a land card, put it onto the battlefield";
}
private JadziOracleOfArcaviosEffect(final JadziOracleOfArcaviosEffect effect) {
super(effect);
}
@Override
public JadziOracleOfArcaviosEffect copy() {
return new JadziOracleOfArcaviosEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
Card card = player.getLibrary().getFromTop(game);
if (card == null) {
return false;
}
player.revealCards(source, new CardsImpl(card), game);
if (card.isLand()) {
return player.moveCards(card, Zone.BATTLEFIELD, source, game);
}
if (!player.chooseUse(outcome, "Cast " + " by paying {1}?", source, game)) {
return false;
}
SpellAbility spellAbility = player.chooseAbilityForCast(card, game, true);
if (spellAbility == null) {
return false;
}
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), Boolean.TRUE);
player.setCastSourceIdWithAlternateMana(card.getId(), new ManaCostsImpl<>("{1}"), null);
Boolean cardWasCast = player.cast(
player.chooseAbilityForCast(card, game, true),
game, false, new ApprovingObject(source, game)
);
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), null);
return true;
}
}
class JourneyToTheOracleEffect extends OneShotEffect {
JourneyToTheOracleEffect() {
super(Outcome.Benefit);
staticText = "You may put any number of land cards from your hand onto the battlefield";
}
private JourneyToTheOracleEffect(final JourneyToTheOracleEffect effect) {
super(effect);
}
@Override
public JourneyToTheOracleEffect copy() {
return new JourneyToTheOracleEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
TargetCardInHand target = new TargetCardInHand(
0, Integer.MAX_VALUE, StaticFilters.FILTER_CARD_LANDS
);
player.choose(Outcome.PutCardInPlay, target, source.getSourceId(), game);
return player.moveCards(new CardsImpl(target.getTargets()), Zone.BATTLEFIELD, source, game);
}
}

View file

@ -148,6 +148,7 @@ public final class StrixhavenSchoolOfMages extends ExpansionSet {
cards.add(new SetCardInfo("Introduction to Annihilation", 3, Rarity.COMMON, mage.cards.i.IntroductionToAnnihilation.class));
cards.add(new SetCardInfo("Introduction to Prophecy", 4, Rarity.COMMON, mage.cards.i.IntroductionToProphecy.class));
cards.add(new SetCardInfo("Island", 368, Rarity.LAND, mage.cards.basiclands.Island.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Jadzi, Oracle of Arcavios", 151, Rarity.MYTHIC, mage.cards.j.JadziOracleOfArcavios.class));
cards.add(new SetCardInfo("Karok Wrangler", 135, Rarity.UNCOMMON, mage.cards.k.KarokWrangler.class));
cards.add(new SetCardInfo("Kasmina, Enigma Sage", 196, Rarity.MYTHIC, mage.cards.k.KasminaEnigmaSage.class));
cards.add(new SetCardInfo("Kelpie Guide", 45, Rarity.UNCOMMON, mage.cards.k.KelpieGuide.class));