forked from External/mage
[CMM] Implement For the Ancestors
This commit is contained in:
parent
03320d1752
commit
4c8a9653bb
2 changed files with 89 additions and 0 deletions
88
Mage.Sets/src/mage/cards/f/ForTheAncestors.java
Normal file
88
Mage.Sets/src/mage/cards/f/ForTheAncestors.java
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
package mage.cards.f;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.keyword.FlashbackAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.choices.ChoiceCreatureType;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetCard;
|
||||
import mage.target.common.TargetCardInHand;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class ForTheAncestors extends CardImpl {
|
||||
|
||||
public ForTheAncestors(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{G}");
|
||||
|
||||
// Choose a creature type. Look at the top six cards of your library. You may reveal any number of cards of the chosen type from among them and put the revealed cards into your hand. Put the rest on the bottom of your library in a random order.
|
||||
this.getSpellAbility().addEffect(new ForTheAncestorsEffect());
|
||||
|
||||
// Flashback {3}{G}
|
||||
this.addAbility(new FlashbackAbility(this, new ManaCostsImpl<>("{3}{G}")));
|
||||
}
|
||||
|
||||
private ForTheAncestors(final ForTheAncestors card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForTheAncestors copy() {
|
||||
return new ForTheAncestors(this);
|
||||
}
|
||||
}
|
||||
|
||||
class ForTheAncestorsEffect extends OneShotEffect {
|
||||
|
||||
ForTheAncestorsEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "choose a creature type. Look at the top six cards of your library. " +
|
||||
"You may reveal any number of cards of the chosen type from among them and " +
|
||||
"put the revealed cards into your hand. Put the rest on the bottom of your library in a random order";
|
||||
}
|
||||
|
||||
private ForTheAncestorsEffect(final ForTheAncestorsEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForTheAncestorsEffect copy() {
|
||||
return new ForTheAncestorsEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
ChoiceCreatureType choice = new ChoiceCreatureType();
|
||||
player.choose(outcome, choice, game);
|
||||
SubType subType = SubType.fromString(choice.getChoice());
|
||||
FilterCard filter = new FilterCard(subType + " cards");
|
||||
filter.add(subType.getPredicate());
|
||||
Cards cards = new CardsImpl(player.getLibrary().getTopCards(game, 6));
|
||||
TargetCard target = new TargetCardInHand(0, Integer.MAX_VALUE, filter);
|
||||
player.choose(outcome, cards, target, source, game);
|
||||
Cards toHand = new CardsImpl(target.getTargets());
|
||||
player.revealCards(source, toHand, game);
|
||||
player.moveCards(toHand, Zone.HAND, source, game);
|
||||
cards.retainZone(Zone.LIBRARY, game);
|
||||
player.putCardsOnBottomOfLibrary(cards, game, source, false);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -227,6 +227,7 @@ public final class CommanderMasters extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Flux Channeler", 847, Rarity.UNCOMMON, mage.cards.f.FluxChanneler.class));
|
||||
cards.add(new SetCardInfo("Fog Bank", 848, Rarity.UNCOMMON, mage.cards.f.FogBank.class));
|
||||
cards.add(new SetCardInfo("Font of Fertility", 895, Rarity.COMMON, mage.cards.f.FontOfFertility.class));
|
||||
cards.add(new SetCardInfo("For the Ancestors", 740, Rarity.RARE, mage.cards.f.ForTheAncestors.class));
|
||||
cards.add(new SetCardInfo("Forebear's Blade", 384, Rarity.UNCOMMON, mage.cards.f.ForebearsBlade.class));
|
||||
cards.add(new SetCardInfo("Forest", 449, Rarity.LAND, mage.cards.basiclands.Forest.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Forge of Heroes", 995, Rarity.COMMON, mage.cards.f.ForgeOfHeroes.class));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue