mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
Merge pull request #5088 from NoahGleason/fertile-imagination
Implement Fertile Imagination
This commit is contained in:
commit
1b14c6f72d
3 changed files with 127 additions and 1 deletions
|
@ -80,7 +80,7 @@ class BloodOathEffect extends OneShotEffect {
|
|||
if (player != null && opponent != null && sourceObject != null) {
|
||||
Choice choiceImpl = new ChoiceImpl();
|
||||
choiceImpl.setChoices(choice);
|
||||
if (!player.choose(Outcome.Neutral, choiceImpl, game)) {
|
||||
if (player.choose(Outcome.Neutral, choiceImpl, game)) {
|
||||
CardType type = null;
|
||||
String choosenType = choiceImpl.getChoice();
|
||||
|
||||
|
|
125
Mage.Sets/src/mage/cards/f/FertileImagination.java
Normal file
125
Mage.Sets/src/mage/cards/f/FertileImagination.java
Normal file
|
@ -0,0 +1,125 @@
|
|||
package mage.cards.f;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.cards.Cards;
|
||||
import mage.choices.Choice;
|
||||
import mage.choices.ChoiceImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.token.SaprolingToken;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetOpponent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author noahg
|
||||
*/
|
||||
public final class FertileImagination extends CardImpl {
|
||||
|
||||
public FertileImagination(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{G}{G}");
|
||||
|
||||
|
||||
// Choose a card type. Target opponent reveals their hand. Create two 1/1 green Saproling creature tokens for each card of the chosen type revealed this way.
|
||||
this.getSpellAbility().addEffect(new FertileImaginationEffect());
|
||||
this.getSpellAbility().addTarget(new TargetOpponent());
|
||||
}
|
||||
|
||||
public FertileImagination(final FertileImagination card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FertileImagination copy() {
|
||||
return new FertileImagination(this);
|
||||
}
|
||||
}
|
||||
|
||||
class FertileImaginationEffect extends OneShotEffect {
|
||||
|
||||
private static final Set<String> choice = new LinkedHashSet<>();
|
||||
|
||||
static {
|
||||
choice.add(CardType.ARTIFACT.toString());
|
||||
choice.add(CardType.CREATURE.toString());
|
||||
choice.add(CardType.ENCHANTMENT.toString());
|
||||
choice.add(CardType.INSTANT.toString());
|
||||
choice.add(CardType.LAND.toString());
|
||||
choice.add(CardType.PLANESWALKER.toString());
|
||||
choice.add(CardType.SORCERY.toString());
|
||||
choice.add(CardType.TRIBAL.toString());
|
||||
}
|
||||
|
||||
public FertileImaginationEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "Choose a card type. Target opponent reveals their hand. Create two 1/1 green Saproling creature tokens for each card of the chosen type revealed this way";
|
||||
}
|
||||
|
||||
public FertileImaginationEffect(final FertileImaginationEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FertileImaginationEffect copy() {
|
||||
return new FertileImaginationEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
Player opponent = game.getPlayer(source.getFirstTarget());
|
||||
if (player != null && opponent != null && sourceObject != null) {
|
||||
Choice choiceImpl = new ChoiceImpl();
|
||||
choiceImpl.setChoices(choice);
|
||||
if (player.choose(Outcome.Neutral, choiceImpl, game)) {
|
||||
CardType type = null;
|
||||
String choosenType = choiceImpl.getChoice();
|
||||
|
||||
if (choosenType.equals(CardType.ARTIFACT.toString())) {
|
||||
type = CardType.ARTIFACT;
|
||||
} else if (choosenType.equals(CardType.LAND.toString())) {
|
||||
type = CardType.LAND;
|
||||
} else if (choosenType.equals(CardType.CREATURE.toString())) {
|
||||
type = CardType.CREATURE;
|
||||
} else if (choosenType.equals(CardType.ENCHANTMENT.toString())) {
|
||||
type = CardType.ENCHANTMENT;
|
||||
} else if (choosenType.equals(CardType.INSTANT.toString())) {
|
||||
type = CardType.INSTANT;
|
||||
} else if (choosenType.equals(CardType.SORCERY.toString())) {
|
||||
type = CardType.SORCERY;
|
||||
} else if (choosenType.equals(CardType.PLANESWALKER.toString())) {
|
||||
type = CardType.PLANESWALKER;
|
||||
} else if (choosenType.equals(CardType.TRIBAL.toString())) {
|
||||
type = CardType.TRIBAL;
|
||||
}
|
||||
if (type != null) {
|
||||
Cards hand = opponent.getHand();
|
||||
SaprolingToken saprolingToken = new SaprolingToken();
|
||||
opponent.revealCards(sourceObject.getIdName(), hand, game);
|
||||
Set<Card> cards = hand.getCards(game);
|
||||
int tokensToMake = 0;
|
||||
for (Card card : cards) {
|
||||
if (card != null && card.getCardType().contains(type)) {
|
||||
tokensToMake += 2;
|
||||
}
|
||||
}
|
||||
game.informPlayers(sourceObject.getLogName() + " creates " + (tokensToMake == 0 ? "no" : "" + tokensToMake) + " 1/1 green Saproling creature tokens.");
|
||||
saprolingToken.putOntoBattlefield(tokensToMake, game, source.getId(), source.getControllerId());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -74,6 +74,7 @@ public final class Dissension extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Entropic Eidolon", 45, Rarity.COMMON, mage.cards.e.EntropicEidolon.class));
|
||||
cards.add(new SetCardInfo("Evolution Vat", 161, Rarity.RARE, mage.cards.e.EvolutionVat.class));
|
||||
cards.add(new SetCardInfo("Experiment Kraj", 110, Rarity.RARE, mage.cards.e.ExperimentKraj.class));
|
||||
cards.add(new SetCardInfo("Fertile Imagination", 84, Rarity.UNCOMMON, mage.cards.f.FertileImagination.class));
|
||||
cards.add(new SetCardInfo("Flame-Kin War Scout", 61, Rarity.UNCOMMON, mage.cards.f.FlameKinWarScout.class));
|
||||
cards.add(new SetCardInfo("Flaring Flame-Kin", 62, Rarity.UNCOMMON, mage.cards.f.FlaringFlameKin.class));
|
||||
cards.add(new SetCardInfo("Flash Foliage", 85, Rarity.UNCOMMON, mage.cards.f.FlashFoliage.class));
|
||||
|
|
Loading…
Reference in a new issue