mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
[TLA] Implement Solstice Revelations
This commit is contained in:
parent
9d2d7827ef
commit
d3b0531777
3 changed files with 118 additions and 1 deletions
114
Mage.Sets/src/mage/cards/s/SolsticeRevelations.java
Normal file
114
Mage.Sets/src/mage/cards/s/SolsticeRevelations.java
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
package mage.cards.s;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.keyword.FlashbackAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterControlledPermanent;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class SolsticeRevelations extends CardImpl {
|
||||
|
||||
public SolsticeRevelations(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{R}");
|
||||
|
||||
this.subtype.add(SubType.LESSON);
|
||||
|
||||
// Exile cards from the top of your library until you exile a nonland card. You may cast that card without paying its mana cost if the spell's mana value is less than the number of Mountains you control. If you don't cast that card this way, put it into your hand.
|
||||
this.getSpellAbility().addEffect(new SolsticeRevelationsEffect());
|
||||
|
||||
// Flashback {6}{R}
|
||||
this.addAbility(new FlashbackAbility(this, new ManaCostsImpl<>("{6}{R}")));
|
||||
}
|
||||
|
||||
private SolsticeRevelations(final SolsticeRevelations card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SolsticeRevelations copy() {
|
||||
return new SolsticeRevelations(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum SolsticeRevelationsPredicate implements ObjectSourcePlayerPredicate<Card> {
|
||||
instance;
|
||||
private static final FilterPermanent filter = new FilterControlledPermanent(SubType.MOUNTAIN);
|
||||
|
||||
@Override
|
||||
public boolean apply(ObjectSourcePlayer<Card> input, Game game) {
|
||||
return input.getObject().getManaValue()
|
||||
< game.getBattlefield().count(filter, input.getPlayerId(), input.getSource(), game);
|
||||
}
|
||||
}
|
||||
|
||||
class SolsticeRevelationsEffect extends OneShotEffect {
|
||||
|
||||
private static final FilterCard filter = new FilterCard();
|
||||
|
||||
static {
|
||||
filter.add(SolsticeRevelationsPredicate.instance);
|
||||
}
|
||||
|
||||
SolsticeRevelationsEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "exile cards from the top of your library until you exile a nonland card. " +
|
||||
"You may cast that card without paying its mana cost if the spell's mana value is less than " +
|
||||
"the number of Mountains you control. If you don't cast that card this way, put it into your hand";
|
||||
}
|
||||
|
||||
private SolsticeRevelationsEffect(final SolsticeRevelationsEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SolsticeRevelationsEffect copy() {
|
||||
return new SolsticeRevelationsEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
Card card = getCard(player, game, source);
|
||||
if (card == null) {
|
||||
return false;
|
||||
}
|
||||
if (!CardUtil.castSpellWithAttributesForFree(player, source, game, card, filter)) {
|
||||
player.moveCards(card, Zone.HAND, source, game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static Card getCard(Player player, Game game, Ability source) {
|
||||
for (Card card : player.getLibrary().getCards(game)) {
|
||||
player.moveCards(card, Zone.EXILED, source, game);
|
||||
game.processAction();
|
||||
if (!card.isLand(game)) {
|
||||
return card;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -146,6 +146,7 @@ public final class AvatarTheLastAirbender extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Sokka, Bold Boomeranger", 240, Rarity.RARE, mage.cards.s.SokkaBoldBoomeranger.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Sokka, Bold Boomeranger", 383, Rarity.RARE, mage.cards.s.SokkaBoldBoomeranger.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Sokka, Lateral Strategist", 241, Rarity.UNCOMMON, mage.cards.s.SokkaLateralStrategist.class));
|
||||
cards.add(new SetCardInfo("Solstice Revelations", 153, Rarity.UNCOMMON, mage.cards.s.SolsticeRevelations.class));
|
||||
cards.add(new SetCardInfo("Southern Air Temple", 36, Rarity.UNCOMMON, mage.cards.s.SouthernAirTemple.class));
|
||||
cards.add(new SetCardInfo("Sozin's Comet", 154, Rarity.MYTHIC, mage.cards.s.SozinsComet.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Sozin's Comet", 309, Rarity.MYTHIC, mage.cards.s.SozinsComet.class, NON_FULL_USE_VARIOUS));
|
||||
|
|
|
|||
|
|
@ -1536,7 +1536,7 @@ public final class CardUtil {
|
|||
} else {
|
||||
chosenAbility = player.chooseAbilityForCast(cardToCast, game, true);
|
||||
}
|
||||
boolean result = false;
|
||||
boolean result;
|
||||
if (chosenAbility instanceof SpellAbility) {
|
||||
result = player.cast(
|
||||
(SpellAbility) chosenAbility,
|
||||
|
|
@ -1545,6 +1545,8 @@ public final class CardUtil {
|
|||
} else if (playLand && chosenAbility instanceof PlayLandAbility) {
|
||||
Card land = game.getCard(chosenAbility.getSourceId());
|
||||
result = player.playLand(land, game, true);
|
||||
} else {
|
||||
result = false;
|
||||
}
|
||||
partsToCast.forEach(card -> game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), null));
|
||||
if (result && spellCastTracker != null) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue