diff --git a/.gitattributes b/.gitattributes index 0c16bf27fe9..1f990f4c354 100644 --- a/.gitattributes +++ b/.gitattributes @@ -5443,6 +5443,7 @@ res/cardsfolder/j/jhessian_infiltrator.txt svneol=native#text/plain res/cardsfolder/j/jhessian_lookout.txt svneol=native#text/plain res/cardsfolder/j/jhessian_zombies.txt svneol=native#text/plain res/cardsfolder/j/jhoira_of_the_ghitu.txt svneol=native#text/plain +res/cardsfolder/j/jhoira_of_the_ghitu_avatar.txt -text res/cardsfolder/j/jhoiras_timebug.txt -text res/cardsfolder/j/jhoiras_toolbox.txt svneol=native#text/plain res/cardsfolder/j/jhovall_queen.txt svneol=native#text/plain diff --git a/res/cardsfolder/j/jhoira_of_the_ghitu_avatar.txt b/res/cardsfolder/j/jhoira_of_the_ghitu_avatar.txt new file mode 100644 index 00000000000..ea5b76077e2 --- /dev/null +++ b/res/cardsfolder/j/jhoira_of_the_ghitu_avatar.txt @@ -0,0 +1,9 @@ +Name:Jhoira of the Ghitu Avatar +ManaCost:no cost +Types:Vanguard +HandLifeModifier:+1/+0 +A:AB$ Play | Cost$ 3 Discard<1/Card> | ActivationZone$ Command | AnySupportedCard$ Instant | RandomCopied$ True | RandomNum$ 3 | ChoiceNum$ 1 | CopyCard$ True | WithoutManaCost$ True | SpellDescription$ Copy three instant cards chosen at random. You may cast one of the copies without paying its mana cost. +A:AB$ Play | Cost$ 3 Discard<1/Card> | ActivationZone$ Command | AnySupportedCard$ Sorcery | RandomCopied$ True | RandomNum$ 3 | ChoiceNum$ 1 | CopyCard$ True | WithoutManaCost$ True | SorcerySpeed$ True | SpellDescription$ Copy three sorcery cards chosen at random. You may cast one of the copies without paying its mana cost. Activate this ability only any time you could cast a sorcery. +SVar:Picture:http://www.cardforge.org/fpics/vgd-lq/jhoira_of_the_ghitu_avatar.jpg +Oracle:Hand +1, life +0\n{3}, Discard a card: Copy three instant cards chosen at random. You may cast one of the copies without paying its mana cost.\n{3}, Discard a card: Copy three sorcery cards chosen at random. You may cast one of the copies without paying its mana cost. Activate this ability only any time you could cast a sorcery. +SetInfo:VAN Special \ No newline at end of file diff --git a/src/main/java/forge/card/ability/effects/PlayEffect.java b/src/main/java/forge/card/ability/effects/PlayEffect.java index 462dc538810..b4e5471ab17 100644 --- a/src/main/java/forge/card/ability/effects/PlayEffect.java +++ b/src/main/java/forge/card/ability/effects/PlayEffect.java @@ -6,11 +6,15 @@ import java.util.List; import org.apache.commons.lang3.StringUtils; import com.google.common.base.Predicate; +import com.google.common.base.Predicates; +import com.google.common.collect.Iterables; +import com.google.common.collect.Lists; import forge.Card; import forge.CardCharacteristicName; import forge.CardLists; import forge.Singletons; +import forge.card.CardRulesPredicates; import forge.card.ability.AbilityUtils; import forge.card.ability.SpellAbilityEffect; import forge.card.spellability.Spell; @@ -26,6 +30,9 @@ import forge.game.zone.ZoneType; import forge.gui.GuiChoose; import forge.gui.GuiDialog; import forge.item.CardDb; +import forge.item.CardPrinted; +import forge.util.Aggregates; +import forge.util.PredicateString.StringOp; public class PlayEffect extends SpellAbilityEffect { @Override @@ -82,6 +89,43 @@ public class PlayEffect extends SpellAbilityEffect { tgtCards.add(encodedCards.get(encodedIndex)); useEncoded = true; } + else if (sa.hasParam("AnySupportedCard")) { + List cards = Lists.newArrayList(CardDb.instance().getUniqueCards()); + String valid = sa.getParam("AnySupportedCard"); + if (StringUtils.containsIgnoreCase(valid, "sorcery")) { + Predicate cpp = Predicates.compose(CardRulesPredicates.Presets.IS_SORCERY, CardPrinted.FN_GET_RULES); + cards = Lists.newArrayList(Iterables.filter(cards, cpp)); + } + if (StringUtils.containsIgnoreCase(valid, "instant")) { + Predicate cpp = Predicates.compose(CardRulesPredicates.Presets.IS_INSTANT, CardPrinted.FN_GET_RULES); + cards = Lists.newArrayList(Iterables.filter(cards, cpp)); + } + if (sa.hasParam("RandomCopied")) { + List copysource = new ArrayList(cards); + List choice = new ArrayList(); + final String num = sa.hasParam("RandomNum") ? sa.getParam("RandomNum") : "1"; + int ncopied = AbilityUtils.calculateAmount(source, num, sa); + while(ncopied > 0) { + final CardPrinted cp = Aggregates.random(copysource); + if (cp.getMatchingForgeCard().isValid(valid, source.getController(), source)) { + choice.add(cp.getMatchingForgeCard()); + copysource.remove(cp); + ncopied -= 1; + } + } + if (sa.hasParam("ChoiceNum")) { + final int choicenum = AbilityUtils.calculateAmount(source, sa.getParam("ChoiceNum"), sa); + List afterchoice = new ArrayList(); + for (int i = 0; i < choicenum; i++) { + afterchoice.add(GuiChoose.oneOrNone(source + "- Choose a Card", choice)); + } + tgtCards = afterchoice; + } else { + tgtCards = choice; + } + + } + } else { tgtCards = getTargetCards(sa); }