Implemented Thassa's Oracle

This commit is contained in:
Evan Kranzler 2020-01-08 15:09:27 -05:00
parent 292a0a2912
commit 53845a17f9
2 changed files with 89 additions and 0 deletions

View file

@ -0,0 +1,88 @@
package mage.cards.t;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.dynamicvalue.common.DevotionCount;
import mage.abilities.effects.OneShotEffect;
import mage.cards.*;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetCardInLibrary;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class ThassasOracle extends CardImpl {
public ThassasOracle(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{U}{U}");
this.subtype.add(SubType.MERFOLK);
this.subtype.add(SubType.WIZARD);
this.power = new MageInt(1);
this.toughness = new MageInt(3);
// When Thassa's Oracle enters the battlefield, look at the top X cards of your library, where X is your devotion to blue. Put one of them on top of your library and the rest on the bottom of your library in a random order. If X is greater than or equal to the number of cards in your library, you win the game.
this.addAbility(new EntersBattlefieldTriggeredAbility(new ThassasOracleEffect())
.addHint(DevotionCount.U.getHint()));
}
private ThassasOracle(final ThassasOracle card) {
super(card);
}
@Override
public ThassasOracle copy() {
return new ThassasOracle(this);
}
}
class ThassasOracleEffect extends OneShotEffect {
ThassasOracleEffect() {
super(Outcome.Benefit);
staticText = "look at the top X cards of your library, where X is your devotion to blue. " +
"Put one of them on top of your library and the rest on the bottom of your library in a random order. " +
"If X is greater than or equal to the number of cards in your library, you win the game";
}
private ThassasOracleEffect(final ThassasOracleEffect effect) {
super(effect);
}
@Override
public ThassasOracleEffect copy() {
return new ThassasOracleEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
if (player.getLibrary().size() == 0) {
player.won(game);
return true;
}
int xValue = DevotionCount.U.calculate(game, source, this);
Cards cards = new CardsImpl(player.getLibrary().getTopCards(game, xValue));
TargetCardInLibrary target = new TargetCardInLibrary(StaticFilters.FILTER_CARD);
player.choose(Outcome.DrawCard, cards, target, game);
Card card = game.getCard(target.getFirstTarget());
cards.remove(card);
player.putCardsOnTopOfLibrary(new CardsImpl(card), game, source, false);
player.putCardsOnBottomOfLibrary(cards, game, source, false);
if (xValue >= player.getLibrary().size()) {
player.won(game);
}
return true;
}
}

View file

@ -140,6 +140,7 @@ public final class TherosBeyondDeath extends ExpansionSet {
cards.add(new SetCardInfo("Temple of Malice", 247, Rarity.RARE, mage.cards.t.TempleOfMalice.class));
cards.add(new SetCardInfo("Temple of Plenty", 248, Rarity.RARE, mage.cards.t.TempleOfPlenty.class));
cards.add(new SetCardInfo("Terror of Mount Velus", 295, Rarity.RARE, mage.cards.t.TerrorOfMountVelus.class));
cards.add(new SetCardInfo("Thassa's Oracle", 73, Rarity.RARE, mage.cards.t.ThassasOracle.class));
cards.add(new SetCardInfo("Thassa, Deep-Dwelling", 71, Rarity.MYTHIC, mage.cards.t.ThassaDeepDwelling.class));
cards.add(new SetCardInfo("The Akroan War", 124, Rarity.RARE, mage.cards.t.TheAkroanWar.class));
cards.add(new SetCardInfo("The Binding of the Titans", 166, Rarity.UNCOMMON, mage.cards.t.TheBindingOfTheTitans.class));