mirror of
https://github.com/magefree/mage.git
synced 2025-12-23 12:02:01 -08:00
[TDM] Implement Breaching Dragonstorm
This commit is contained in:
parent
2605f6d0c1
commit
fd86c23f4f
2 changed files with 101 additions and 0 deletions
100
Mage.Sets/src/mage/cards/b/BreachingDragonstorm.java
Normal file
100
Mage.Sets/src/mage/cards/b/BreachingDragonstorm.java
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
package mage.cards.b;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.ReturnToHandSourceEffect;
|
||||
import mage.cards.*;
|
||||
import mage.constants.*;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.predicate.mageobject.ManaValuePredicate;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class BreachingDragonstorm extends CardImpl {
|
||||
|
||||
private static final FilterPermanent filter = new FilterPermanent(SubType.DRAGON, "a Dragon");
|
||||
|
||||
public BreachingDragonstorm(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{4}{R}");
|
||||
|
||||
// When this enchantment enters, exile cards from the top of your library until you exile a nonland card. You may cast it without paying its mana cost if that spell's mana value is 8 or less. If you don't, put that card into your hand.
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new BreachingDragonstormEffect()));
|
||||
|
||||
// When a Dragon you control enters, return this enchantment to its owner's hand.
|
||||
this.addAbility(new EntersBattlefieldControlledTriggeredAbility(new ReturnToHandSourceEffect(), filter));
|
||||
}
|
||||
|
||||
private BreachingDragonstorm(final BreachingDragonstorm card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BreachingDragonstorm copy() {
|
||||
return new BreachingDragonstorm(this);
|
||||
}
|
||||
}
|
||||
|
||||
class BreachingDragonstormEffect extends OneShotEffect {
|
||||
|
||||
private static final FilterCard filter = new FilterCard();
|
||||
|
||||
static {
|
||||
filter.add(new ManaValuePredicate(ComparisonType.FEWER_THAN, 9));
|
||||
}
|
||||
|
||||
BreachingDragonstormEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "exile cards from the top of your library until you exile a nonland card. " +
|
||||
"You may cast it without paying its mana cost if that spell's mana value is 8 or less. " +
|
||||
"If you don't, put that card into your hand";
|
||||
}
|
||||
|
||||
private BreachingDragonstormEffect(final BreachingDragonstormEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BreachingDragonstormEffect copy() {
|
||||
return new BreachingDragonstormEffect(this);
|
||||
}
|
||||
|
||||
private static Card getCard(Player player, Cards cards, Game game, Ability source) {
|
||||
for (Card card : player.getLibrary().getCards(game)) {
|
||||
cards.add(card);
|
||||
player.moveCards(card, Zone.EXILED, source, game);
|
||||
game.processAction();
|
||||
if (!card.isLand(game)) {
|
||||
return card;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
Cards cards = new CardsImpl();
|
||||
Card card = getCard(player, cards, game, source);
|
||||
if (card != null) {
|
||||
CardUtil.castSpellWithAttributesForFree(player, source, game, card, filter);
|
||||
if (game.getState().getZone(card.getId()) == Zone.EXILED) {
|
||||
player.moveCards(card, Zone.HAND, source, game);
|
||||
}
|
||||
}
|
||||
cards.retainZone(Zone.EXILED, game);
|
||||
player.putCardsOnBottomOfLibrary(cards, game, source, false);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -39,6 +39,7 @@ public final class TarkirDragonstorm extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Blossoming Sands", 251, Rarity.COMMON, mage.cards.b.BlossomingSands.class));
|
||||
cards.add(new SetCardInfo("Bone-Cairn Butcher", 173, Rarity.UNCOMMON, mage.cards.b.BoneCairnButcher.class));
|
||||
cards.add(new SetCardInfo("Boulderborn Dragon", 239, Rarity.COMMON, mage.cards.b.BoulderbornDragon.class));
|
||||
cards.add(new SetCardInfo("Breaching Dragonstorm", 101, Rarity.UNCOMMON, mage.cards.b.BreachingDragonstorm.class));
|
||||
cards.add(new SetCardInfo("Caustic Exhale", 74, Rarity.COMMON, mage.cards.c.CausticExhale.class));
|
||||
cards.add(new SetCardInfo("Channeled Dragonfire", 423, Rarity.UNCOMMON, mage.cards.c.ChanneledDragonfire.class));
|
||||
cards.add(new SetCardInfo("Coordinated Maneuver", 6, Rarity.COMMON, mage.cards.c.CoordinatedManeuver.class));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue