Converted Jhoira, of the Ghitu to script

This commit is contained in:
moomarc
2012-07-16 13:01:49 +00:00
parent 65a897ab3f
commit b55dfebded
5 changed files with 50 additions and 87 deletions

View File

@@ -1,7 +1,10 @@
Name:Jhoira of the Ghitu
ManaCost:1 U R
Types:Legendary Creature Human Wizard
Text:2, Exile a nonland card from your hand: Put four time counters on the exiled card. If it doesn't have suspend, it gains suspend.
Text:no text
A:AB$ PutCounter | Cost$ 2 ExileFromHand<1/Card.nonLand/nonland card> | CostDesc$ 2, Exile a nonland card from your hand: | RememberCostCards$ True | Defined$ Remembered | CounterType$ TIME | CounterNum$ 4 | SubAbility$ GiveSuspend | TgtZone$ Exile | StackDescription$ Put four time counters on the exiled card. If it doesn't have suspend, it gains suspend. | SpellDescription$ Put four time counters on the exiled card. If it doesn't have suspend, it gains suspend. (At the beginning of your upkeep, remove a time counter from that card. When the last is removed, cast it without paying its mana cost. If it's a creature, it has haste.)
SVar:GiveSuspend:DB$ Pump | Defined$ Remembered | KW$ Suspend | PumpZone$ Exile | Permanent$ True | SubAbility$ DBCleanup | StackDescription$ If it doesn't have suspend, it gains suspend.
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
PT:2/2
SVar:RemRandomDeck:True
SVar:Rarity:Rare

View File

@@ -2551,7 +2551,8 @@ public class AbilityFactory {
final HashMap<String, String> params = af.getMapParams();
Card host;
if (!params.containsKey("RememberTargets") && !params.containsKey("RememberToughness")) {
if (!params.containsKey("RememberTargets") && !params.containsKey("RememberToughness")
&& !params.containsKey("RememberCostCards")) {
return;
}
@@ -2569,6 +2570,15 @@ public class AbilityFactory {
host.addRemembered(o);
}
}
if (params.containsKey("RememberCostCards")) {
if (params.get("Cost").contains("Exile")) {
final CardList paidListExiled = sa.getPaidList("Exiled");
for (final Card exiledAsCost : paidListExiled) {
host.addRemembered(exiledAsCost);
}
}
}
}
/**

View File

@@ -229,52 +229,50 @@ public class AbilityFactoryCounters {
private static String putStackDescription(final AbilityFactory af, final SpellAbility sa) {
final HashMap<String, String> params = af.getMapParams();
final StringBuilder sb = new StringBuilder();
final Card card = sa.getSourceCard();
if (!(sa instanceof AbilitySub)) {
sb.append(sa.getSourceCard().getName()).append(" - ");
sb.append(card.getName()).append(" - ");
} else {
sb.append(" ");
}
final Counters cType = Counters.valueOf(params.get("CounterType"));
final Card card = sa.getSourceCard();
final int amount = AbilityFactory.calculateAmount(sa.getSourceCard(), params.get("CounterNum"), sa);
sb.append("Put ");
if (params.containsKey("UpTo")) {
sb.append("up to ");
}
sb.append(amount).append(" ").append(cType.getName()).append(" counter");
if (amount != 1) {
sb.append("s");
}
sb.append(" on ");
ArrayList<Card> tgtCards;
final Target tgt = sa.getTarget();
if (tgt != null) {
tgtCards = tgt.getTargetCards();
if (params.containsKey("StackDescription")) {
sb.append(params.get("StackDescription"));
} else {
tgtCards = AbilityFactory.getDefinedCards(card, params.get("Defined"), sa);
}
final Iterator<Card> it = tgtCards.iterator();
while (it.hasNext()) {
final Card tgtC = it.next();
if (tgtC.isFaceDown()) {
sb.append("Morph");
final Counters cType = Counters.valueOf(params.get("CounterType"));
final int amount = AbilityFactory.calculateAmount(card, params.get("CounterNum"), sa);
sb.append("Put ");
if (params.containsKey("UpTo")) {
sb.append("up to ");
}
sb.append(amount).append(" ").append(cType.getName()).append(" counter");
if (amount != 1) {
sb.append("s");
}
sb.append(" on ");
ArrayList<Card> tgtCards;
final Target tgt = sa.getTarget();
if (tgt != null) {
tgtCards = tgt.getTargetCards();
} else {
sb.append(tgtC);
tgtCards = AbilityFactory.getDefinedCards(card, params.get("Defined"), sa);
}
final Iterator<Card> it = tgtCards.iterator();
while (it.hasNext()) {
final Card tgtC = it.next();
if (tgtC.isFaceDown()) {
sb.append("Morph");
} else {
sb.append(tgtC);
}
if (it.hasNext()) {
sb.append(", ");
if (it.hasNext()) {
sb.append(", ");
}
}
sb.append(".");
}
sb.append(".");
final AbilitySub abSub = sa.getSubAbility();
if (abSub != null) {
sb.append(abSub.getStackDescription());

View File

@@ -1308,6 +1308,9 @@ public class AbilityFactoryPump {
for (int i = 0; i < this.keywords.size(); i++) {
applyTo.addExtrinsicKeyword(this.keywords.get(i));
if (this.keywords.get(i).equals("Suspend")) {
applyTo.setSuspend(true);
}
}
if (!this.params.containsKey("Permanent")) {

View File

@@ -300,55 +300,6 @@ public class CardFactoryCreatures {
card.addComesIntoPlayCommand(intoPlay);
}
private static void getCard_JhoiraOfTheGhitu(final Card card, final String cardName) {
final Stack<Card> chosen = new Stack<Card>();
final SpellAbility ability = new Ability(card, "2") {
@Override
public boolean canPlay() {
CardList possible = card.getController().getCardsIn(ZoneType.Hand);
possible = possible.filter(CardListFilter.NON_LANDS);
return !possible.isEmpty() && super.canPlay();
}
@Override
public boolean canPlayAI() {
return false;
}
@Override
public void resolve() {
final Card c = chosen.pop();
c.addCounter(Counters.TIME, 4);
c.setSuspend(true);
}
};
ability.setAfterPayMana(new Input() {
private static final long serialVersionUID = -1647181037510967127L;
@Override
public void showMessage() {
ButtonUtil.disableAll();
CMatchUI.SINGLETON_INSTANCE.showMessage("Exile a nonland card from your hand.");
}
@Override
public void selectCard(final Card c, final PlayerZone zone) {
if (zone.is(ZoneType.Hand) && !c.isLand()) {
Singletons.getModel().getGameAction().exile(c);
chosen.push(c);
final StringBuilder sb = new StringBuilder();
sb.append(card.toString()).append(" - Suspending ").append(c.toString());
ability.setStackDescription(sb.toString());
AllZone.getStack().add(ability);
this.stop();
}
}
});
card.addSpellAbility(ability);
}
private static void getCard_VedalkenPlotter(final Card card, final String cardName) {
final Card[] target = new Card[2];
final int[] index = new int[1];
@@ -1640,8 +1591,6 @@ public class CardFactoryCreatures {
getCard_PhylacteryLich(card, cardName);
} else if (cardName.equals("Sky Swallower")) {
getCard_SkySwallower(card, cardName);
} else if (cardName.equals("Jhoira of the Ghitu")) {
getCard_JhoiraOfTheGhitu(card, cardName);
} else if (cardName.equals("Vedalken Plotter")) {
getCard_VedalkenPlotter(card, cardName);
} else if (cardName.equals("Painter's Servant")) {