- Converted Temporal Aperture to script

This commit is contained in:
Sol
2013-03-21 03:59:59 +00:00
parent 2b7ad652c7
commit fcf4ac4339
2 changed files with 7 additions and 125 deletions

View File

@@ -1,6 +1,13 @@
Name:Temporal Aperture
ManaCost:2
Types:Artifact
A:AB$ Shuffle | Cost$ 5 T | SubAbility$ DBReveal | SpellDescription$ Shuffle your library, then reveal the top card. Until end of turn, for as long as that card remains on top of your library, play with the top card of your library revealed and you may play that card without paying its mana cost. (If it has X in its mana cost, X is 0.)
SVar:DBReveal:DB$ Dig | DigNum$ 1 | Reveal$ True | ChangeNum$ All | ChangeValid$ Card | DestinationZone$ Library | LibraryPosition$ 0 | LibraryPosition2$ 0 | RememberChanged$ True | SubAbility$ DBAperture
SVar:DBAperture:DB$ Effect | Name$ Temporal Aperture Effect | StaticAbilities$ STPlay | RememberObjects$ Remembered | Triggers$ StillTopCheck | SVars$ ExileEffect | SpellDescription$ Until end of turn, for as long as that card remains on top of your library, play with the top card of your library revealed and you may play that card without paying its mana cost. | SubAbility$ DBCleanup
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
SVar:STPlay:Mode$ Continuous | EffectZone$ Command | Affected$ Card.IsRemembered+TopLibrary | AddKeyword$ May be played without paying its mana cost | AffectedZone$ Library
SVar:StillTopCheck:Mode$ Always | TriggerZones$ Command | IsPresent$ Card.TopLibrary+YouCtrl+IsNotRemembered | PresentZone$ Library | Execute$ ExileEffect | Static$ True
SVar:ExileEffect:DB$ ChangeZone | Defined$ Self | Origin$ Command | Destination$ Exile
SVar:RemAIDeck:True
SVar:Picture:http://www.wizards.com/global/images/magic/general/temporal_aperture.jpg
Oracle:{5}, {T}: Shuffle your library, then reveal the top card. Until end of turn, for as long as that card remains on top of your library, play with the top card of your library revealed and you may play that card without paying its mana cost. (If it has X in its mana cost, X is 0.)

View File

@@ -3,14 +3,10 @@ package forge.card.cardfactory;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JOptionPane;
import forge.Card;
import forge.Command;
import forge.Singletons;
import forge.card.cost.Cost;
import forge.card.mana.ManaCost;
import forge.card.spellability.Ability;
import forge.card.spellability.AbilityActivated;
import forge.card.spellability.Target;
import forge.control.input.Input;
@@ -197,126 +193,5 @@ class CardFactoryArtifacts {
ability.setStackDescription(sbStack.toString());
card.addSpellAbility(ability);
} // *************** END ************ END **************************
// *************** START *********** START **************************
else if (cardName.equals("Temporal Aperture")) {
/*
* 5, Tap: Shuffle your library, then reveal the top card. Until end
* of turn, for as long as that card remains on top of your library,
* play with the top card of your library revealed and you may play
* that card without paying its mana cost. (If it has X in its mana
* cost, X is 0.)
*/
final Card[] topCard = new Card[1];
final Ability freeCast = new Ability(card, ManaCost.ZERO) {
@Override
public boolean canPlay() {
final PlayerZone lib = card.getController().getZone(ZoneType.Library);
return super.canPlay() && ((lib.size() > 0) && lib.get(0).equals(topCard[0]));
}
@Override
public void resolve() {
final Card freeCard = topCard[0];
final Player player = card.getController();
if (freeCard != null) {
if (freeCard.isLand()) {
if (player.canPlayLand(freeCard)) {
player.playLand(freeCard);
} else {
JOptionPane.showMessageDialog(null, "You can't play any more lands this turn.", "",
JOptionPane.INFORMATION_MESSAGE);
}
} else {
Singletons.getModel().getGame().getActionPlay().playCardWithoutManaCost(freeCard, player);
}
} else {
final StringBuilder sb = new StringBuilder();
sb.append("Error in ").append(cardName).append(". freeCard is null");
JOptionPane.showMessageDialog(null, sb.toString(), "", JOptionPane.INFORMATION_MESSAGE);
}
}
@Override
public boolean canPlayAI() {
return false;
}
};
freeCast.setDescription("Play the previously revealed top card of your library for free.");
final StringBuilder sb = new StringBuilder();
sb.append(cardName).append(" - play card without paying its mana cost.");
freeCast.setStackDescription(sb.toString());
class AbilityTemporalAperture extends AbilityActivated {
public AbilityTemporalAperture(final Card ca, final Cost co, final Target t) {
super(ca, co, t);
}
@Override
public AbilityActivated getCopy() {
AbilityActivated res = new AbilityTemporalAperture(getSourceCard(),
getPayCosts(), getTarget() == null ? null : new Target(getTarget()));
CardFactory.copySpellAbility(this, res);
return res;
}
private static final long serialVersionUID = -7328518969488588777L;
@Override
public void resolve() {
final PlayerZone lib = card.getController().getZone(ZoneType.Library);
if (lib.size() > 0) {
// shuffle your library
card.getController().shuffle();
// reveal the top card
topCard[0] = lib.get(0);
final StringBuilder sb = new StringBuilder();
sb.append("Revealed card:\n").append(topCard[0].getName());
JOptionPane.showMessageDialog(null, sb.toString(), card.getName(), JOptionPane.PLAIN_MESSAGE);
card.addSpellAbility(freeCast);
card.addExtrinsicKeyword("Play with the top card of your library revealed.");
Singletons.getModel().getGame().getEndOfTurn().addUntil(new Command() {
private static final long serialVersionUID = -2860753262177388046L;
@Override
public void execute() {
card.removeSpellAbility(freeCast);
card.removeExtrinsicKeyword("Play with the top card of your library revealed.");
}
});
}
} // resolve
@Override
public boolean canPlayAI() {
return false;
}
}
final Cost abCost = new Cost(card, "5 T", true);
final AbilityActivated ability = new AbilityTemporalAperture(card, abCost, null);
final StringBuilder sbStack = new StringBuilder();
sbStack.append(card).append(" - Shuffle your library, then reveal the top card.");
ability.setStackDescription(sbStack.toString());
final StringBuilder sbDesc = new StringBuilder();
sbDesc.append(abCost).append("Shuffle your library, then reveal the top card. ");
sbDesc.append("Until end of turn, for as long as that card remains on top of your ");
sbDesc.append("library, play with the top card of your library revealed ");
sbDesc.append("and you may play that card without paying its mana cost. ");
sbDesc.append("(If it has X in its mana cost, X is 0.)");
ability.setDescription(sbDesc.toString());
card.addSpellAbility(ability);
} // *************** END ************ END **************************
}
}