*Added ThisTurnCast to xCount to complement ThisTurnEntered. Count$ThisTurnCast <Valid> lets you count how many <Valid> cards were cast so far this turn. StormCount remains, but is now functionally equivalent to ThisTurnCast Card.

*Converted to script
	Ichneumon Druid
	Predatory Advantage
	Storm Entity
	Vengevine
*Added
	Ethersworn Canonist
This commit is contained in:
Hellfish
2011-10-17 20:56:14 +00:00
parent 87d0160488
commit f6d1e11559
14 changed files with 94 additions and 412 deletions

View File

@@ -678,7 +678,7 @@ public final class CardUtil {
* @param from zone coming from
* @param valid a isValid expression
* @param src a Card object
* @return a CardList that matches then given criteria
* @return a CardList that matches the given criteria
*/
public static CardList getThisTurnEntered(final Constant.Zone to, final Constant.Zone from, final String valid, final Card src) {
CardList res = new CardList();
@@ -694,6 +694,23 @@ public final class CardUtil {
return res;
}
/**
* getThisTurnCast.
*
* @param valid a String object
* @param src a Card object
* @return a CardList that matches the given criteria
*/
public static CardList getThisTurnCast(final String valid, final Card src) {
CardList res = new CardList();
res.addAll(AllZone.getStack().getCardsCastThisTurn());
res = res.getValidCards(valid, src.getController(), src);
return res;
}
/**
* getLKICopy.

View File

@@ -134,7 +134,7 @@ public class ComputerAI_General implements Computer {
creatures2.add(creatures.get(i));
}
}
if (creatures2.size() + Phase.getComputerStartingCardspellCount() > 1
if (creatures2.size() + CardUtil.getThisTurnCast("Creature.YouCtrl", vengevines.get(0)).size() > 1
&& c.isCreature()
&& CardUtil.getConvertedManaCost(c.getManaCost()) <= 3) {
return true;

View File

@@ -54,7 +54,6 @@ public class EndOfTurn implements java.io.Serializable {
//Pyrohemia and Pestilence
CardList all = AllZoneUtil.getCardsIn(Zone.Battlefield);
GameActionUtil.endOfTurn_Predatory_Advantage();
GameActionUtil.endOfTurn_Wall_Of_Reverence();
GameActionUtil.endOfTurn_Lighthouse_Chronologist();

View File

@@ -49,11 +49,8 @@ public final class GameActionUtil {
playCard_Cascade(c);
playCard_Ripple(c);
//playCard_Storm(sa);
playCard_Vengevine(c);
playCard_Venser_Emblem(c);
playCard_Ichneumon_Druid(c);
}
@@ -68,19 +65,17 @@ public final class GameActionUtil {
public void execute() {
CardList humanNexus = AllZone.getHumanPlayer().getCardsIn(Zone.Battlefield, "Maelstrom Nexus");
CardList computerNexus = AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield, "Maelstrom Nexus");
if (humanNexus.size() > 0) {
if (Phase.getPlayerSpellCount() == 1 && !c.isCopiedSpell()) {
for (int i = 0; i < humanNexus.size(); i++) {
doCascade(c);
}
}
}
if (computerNexus.size() > 0) {
if (Phase.getComputerSpellCount() == 1 && !c.isCopiedSpell()) {
for (int i = 0; i < computerNexus.size(); i++) {
if(!c.isCopiedSpell()) {
CardList humanNexus = AllZone.getHumanPlayer().getCardsIn(Zone.Battlefield, "Maelstrom Nexus");
CardList computerNexus = AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield, "Maelstrom Nexus");
CardList maelstromNexii = new CardList();
maelstromNexii.addAll(humanNexus);
maelstromNexii.addAll(computerNexus);
for(Card nexus : maelstromNexii) {
if(CardUtil.getThisTurnCast("Card.YouCtrl", nexus).size() == 1) {
doCascade(c);
}
}
@@ -287,90 +282,6 @@ public final class GameActionUtil {
ripple.execute();
} //playCard_Ripple()
/**
* <p>playCard_Storm.</p>
*
* @param sa a {@link forge.card.spellability.SpellAbility} object.
*/ /*
public static void playCard_Storm(SpellAbility sa) {
Card source = sa.getSourceCard();
if (!source.isCopiedSpell()
&& source.hasKeyword("Storm")) {
int StormNumber = Phase.getStormCount() - 1;
for (int i = 0; i < StormNumber; i++)
AllZone.getCardFactory().copySpellontoStack(source, source, sa, true);
}
}//playCard_Storm()
*/
/**
* <p>playCard_Vengevine.</p>
*
* @param c a {@link forge.Card} object.
*/
public static void playCard_Vengevine(final Card c) {
if (c.isCreature() == true
&& (Phase.getPlayerCreatureSpellCount() == 2 || Phase.getComputerStartingCardspellCount() == 2))
{
final Player controller = c.getController();
final PlayerZone play = controller.getZone(Constant.Zone.Battlefield);
CardList list = controller.getCardsIn(Zone.Graveyard);
list = list.getName("Vengevine");
if (list.size() > 0) {
for (int i = 0; i < list.size(); i++) {
final Card card = list.get(i);
Ability ability = new Ability(card, "0") {
@Override
public void resolve() {
if (controller.isComputer()
|| GameActionUtil.showYesNoDialog(card, "Return Vengevine from the graveyard?"))
{
if (controller.getZone(Zone.Graveyard).contains(card)) {
AllZone.getGameAction().moveTo(play, card);
}
}
}
}; // ability
StringBuilder sb = new StringBuilder();
sb.append(card).append(" - ").append("Whenever you cast a spell, if it's the second creature ");
sb.append("spell you cast this turn, you may return Vengevine from your graveyard to the battlefield.");
ability.setStackDescription(sb.toString());
AllZone.getStack().addSimultaneousStackEntry(ability);
}
} //if
}
} //playCard_Vengevine()
/**
* <p>playCard_Ichneumon_Druid.</p>
*
* @param c a {@link forge.Card} object.
*/
public static void playCard_Ichneumon_Druid(final Card c) {
if (c.isInstant() && (Phase.getPlayerInstantSpellCount() >= 2 || Phase.getComputerInstantSpellCount() >= 2)) {
final Player player = c.getController();
final Player opp = player.getOpponent();
CardList list = opp.getCardsIn(Zone.Battlefield, "Ichneumon Druid");
for (int i = 0; i < list.size(); i++) {
final Card card = list.get(i);
Ability ability = new Ability(card, "0") {
@Override
public void resolve() {
player.addDamage(4, card);
}
}; // ability
StringBuilder sb = new StringBuilder();
sb.append(card).append(" - ").append("Whenever an opponent casts an instant spell other than the first instant spell that player casts each turn, Ichneumon Druid deals 4 damage to him or her.");
ability.setStackDescription(sb.toString());
AllZone.getStack().addSimultaneousStackEntry(ability);
}
}
} //playCard_Ichneumon_Druid()
/**
* <p>playCard_Venser_Emblem.</p>
*
@@ -514,31 +425,6 @@ public final class GameActionUtil {
}
} //endOfTurn_Wall_Of_Reverence()
/**
* <p>endOfTurn_Predatory_Advantage.</p>
*/
public static void endOfTurn_Predatory_Advantage() {
final Player player = AllZone.getPhase().getPlayerTurn();
CardList list = player.getOpponent().getCardsIn(Zone.Battlefield, "Predatory Advantage");
for (int i = 0; i < list.size(); i++) {
final Player controller = list.get(i).getController();
if ((player.isHuman() && Phase.getPlayerCreatureSpellCount() == 0)
|| (player.isComputer() && Phase.getComputerStartingCardspellCount() == 0))
{
Ability abTrig = new Ability(list.get(i), "0") {
public void resolve() {
CardFactoryUtil.makeToken("Lizard", "G 2 2 Lizard", controller, "G",
new String[]{"Creature", "Lizard"}, 2, 2, new String[]{""});
}
};
abTrig.setTrigger(true);
abTrig.setStackDescription("At the beginning of each opponent's end step, if that player didn't cast a creature spell this turn, put a 2/2 green Lizard creature token onto the battlefield.");
AllZone.getGameAction().playSpellAbility(abTrig);
}
}
}
/**
* <p>endOfTurn_Lighthouse_Chronologist.</p>
*/

View File

@@ -40,6 +40,8 @@ public class MagicStack extends MyObservable {
private boolean frozen = false;
private boolean bResolving = false;
private int splitSecondOnStack = 0;
private CardList thisTurnCast = new CardList();
/**
* <p>isFrozen.</p>
@@ -314,7 +316,7 @@ public class MagicStack extends MyObservable {
sp.resetOnceResolved();
return;
}
if (frozen) {
SpellAbility_StackInstance si = new SpellAbility_StackInstance(sp);
getFrozenStack().push(si);
@@ -746,7 +748,7 @@ public class MagicStack extends MyObservable {
this.updateObservers();
if (sp.isSpell() && !sp.getSourceCard().isCopiedSpell()) {
Phase.increaseSpellCount(sp);
thisTurnCast.add(sp.getSourceCard());
GameActionUtil.executePlayCardEffects(sp);
}
@@ -1210,5 +1212,18 @@ public class MagicStack extends MyObservable {
return frozenStack;
}
/**
* Accessor for the field thisTurnCast.
* @return a CardList.
*/
public final CardList getCardsCastThisTurn() {
return thisTurnCast;
}
/**
* clearCardsCastThisTurn.
*/
public void clearCardsCastThisTurn() {
thisTurnCast.clear();
}
}

View File

@@ -28,20 +28,6 @@ public class Phase extends MyObservable implements java.io.Serializable {
// accessing the following:
/** Constant <code>GameBegins=0</code> */
private static int GameBegins = 0;
/** Constant <code>StormCount=</code> */
private static int StormCount;
/** Constant <code>PlayerSpellCount=</code> */
private static int PlayerSpellCount;
/** Constant <code>PlayerCreatureSpellCount=</code> */
private static int PlayerCreatureSpellCount;
/** Constant <code>PlayerInstantSpellCount=</code> */
private static int PlayerInstantSpellCount;
/** Constant <code>ComputerSpellCount=</code> */
private static int ComputerSpellCount;
/** Constant <code>ComputerCreatureSpellCount=</code> */
private static int ComputerCreatureSpellCount;
/** Constant <code>ComputerInstantSpellCount=</code> */
private static int ComputerInstantSpellCount;
private Stack<Player> extraTurns = new Stack<Player>();
@@ -260,13 +246,6 @@ public class Phase extends MyObservable implements java.io.Serializable {
* <p>turnReset.</p>
*/
public void turnReset() {
setStormCount(0);
setPlayerSpellCount(0);
setPlayerCreatureSpellCount(0);
setPlayerInstantSpellCount(0);
setComputerSpellCount(0);
setComputerCreatureSpellCount(0);
setComputerInstantSpellCount(0);
playerTurn.setNumLandsPlayed(0);
}
@@ -480,6 +459,7 @@ public class Phase extends MyObservable implements java.io.Serializable {
private Player handleNextTurn() {
Player nextTurn = extraTurns.isEmpty() ? getPlayerTurn().getOpponent() : extraTurns.pop();
AllZone.getStack().clearCardsCastThisTurn();
AllZone.resetZoneMoveTracking();
AllZone.getComputerPlayer().resetProwl();
AllZone.getHumanPlayer().resetProwl();
@@ -795,114 +775,6 @@ public class Phase extends MyObservable implements java.io.Serializable {
return sb.toString();
}
/**
* <p>increaseSpellCount.</p>
*
* @param sp a {@link forge.card.spellability.SpellAbility} object.
*/
public static void increaseSpellCount(final SpellAbility sp) {
incrementStormCount();
if (sp.getActivatingPlayer().isHuman()) {
incrementPlayerSpellCount();
if (sp instanceof Spell_Permanent && sp.getSourceCard().isCreature()) {
incrementPlayerCreatureSpellCount();
}
if (sp.getSourceCard().isInstant()) {
incrementPlayerInstantSpellCount();
}
} else {
incrementComputerSpellCount();
if (sp instanceof Spell_Permanent && sp.getSourceCard().isCreature()) {
incrementComputerCreatureSpellCount();
}
if (sp.getSourceCard().isInstant()) {
incrementComputerInstantSpellCount();
}
}
}
/**
* <p>incrementComputerInstantSpellCount.</p>
*
* @since 1.0.15
*/
protected static void incrementComputerInstantSpellCount() {
ComputerInstantSpellCount++;
}
/**
* <p>incrementComputerCreatureSpellCount.</p>
*
* @since 1.0.15
*/
protected static void incrementComputerCreatureSpellCount() {
ComputerCreatureSpellCount++;
}
/**
* <p>incrementComputerSpellCount.</p>
*
* @since 1.0.15
*/
protected static void incrementComputerSpellCount() {
ComputerSpellCount++;
}
/**
* <p>incrementPlayerInstantSpellCount.</p>
*
* @since 1.0.15
*/
protected static void incrementPlayerInstantSpellCount() {
PlayerInstantSpellCount++;
}
/**
* <p>incrementPlayerCreatureSpellCount.</p>
*
* @since 1.0.15
*/
protected static void incrementPlayerCreatureSpellCount() {
PlayerCreatureSpellCount++;
}
/**
* <p>incrementPlayerSpellCount.</p>
*
* @since 1.0.15
*/
protected static void incrementPlayerSpellCount() {
PlayerSpellCount++;
}
/**
* <p>incrementStormCount.</p>
*
* @since 1.0.15
*/
protected static void incrementStormCount() {
StormCount++;
}
/**
* <p>setStormCount.</p>
*
* @param stormCount a int.
*/
public static void setStormCount(final int stormCount) {
StormCount = stormCount;
}
/**
* <p>getStormCount.</p>
*
* @return a int.
*/
public static int getStormCount() {
return StormCount;
}
/**
* <p>setGameBegins.</p>
*
@@ -932,114 +804,6 @@ public class Phase extends MyObservable implements java.io.Serializable {
this.phaseIndex = findIndex(phaseID);
}
/**
* <p>getPlayerSpellCount.</p>
*
* @return a int.
*/
static int getPlayerSpellCount() {
return PlayerSpellCount;
}
/**
* <p>setPlayerSpellCount.</p>
*
* @param i a int.
*/
static void setPlayerSpellCount(final int i) {
PlayerSpellCount = (i);
}
/**
* <p>getPlayerCreatureSpellCount.</p>
*
* @return a int.
*/
static int getPlayerCreatureSpellCount() {
return PlayerCreatureSpellCount;
}
/**
* <p>setPlayerCreatureSpellCount.</p>
*
* @param i a int.
*/
static void setPlayerCreatureSpellCount(final int i) {
PlayerCreatureSpellCount = (i);
}
/**
* <p>getPlayerInstantSpellCount.</p>
*
* @return a int.
*/
static int getPlayerInstantSpellCount() {
return PlayerInstantSpellCount;
}
/**
* <p>setPlayerInstantSpellCount.</p>
*
* @param i a int.
*/
static void setPlayerInstantSpellCount(final int i) {
PlayerInstantSpellCount = (i);
}
/**
* <p>getComputerSpellCount.</p>
*
* @return a int.
*/
static int getComputerSpellCount() {
return ComputerSpellCount;
}
/**
* <p>setComputerSpellCount.</p>
*
* @param i a int.
*/
static void setComputerSpellCount(final int i) {
ComputerSpellCount = (i);
}
/**
* <p>getComputerStartingCardspellCount.</p>
*
* @return a int.
*/
static int getComputerStartingCardspellCount() {
return ComputerCreatureSpellCount;
}
/**
* <p>setComputerCreatureSpellCount.</p>
*
* @param i a int.
*/
static void setComputerCreatureSpellCount(final int i) {
ComputerCreatureSpellCount = (i);
}
/**
* <p>getComputerInstantSpellCount.</p>
*
* @return a int.
*/
static int getComputerInstantSpellCount() {
return ComputerInstantSpellCount;
}
/**
* <p>setComputerInstantSpellCount.</p>
*
* @param i a int.
*/
static void setComputerInstantSpellCount(final int i) {
ComputerInstantSpellCount = (i);
}
/**
*
* TODO Write javadoc for this method.

View File

@@ -2947,7 +2947,7 @@ public class CardFactoryUtil {
}
if (sq[0].equals("StormCount")) {
return doXMath(Phase.getStormCount() - 1, m, c);
return doXMath(AllZone.getStack().getCardsCastThisTurn().size() - 1, m, c);
}
if(sq[0].equals("DamageDoneThisTurn")) {
@@ -3190,8 +3190,8 @@ public class CardFactoryUtil {
// Count$ThisTurnEntered <ZoneDestination> <ZoneOrigin> <Valid>
// or
// Count$ThisTurnEntered <ZoneDestination <Valid>
if (sq[0].startsWith("ThisTurnEntered")) {
// Count$ThisTurnEntered <ZoneDestination> <Valid>
if (sq[0].contains("ThisTurnEntered")) {
String[] workingCopy = l[0].split(" ");
Zone destination, origin;
String validFilter;
@@ -3209,6 +3209,18 @@ public class CardFactoryUtil {
return doXMath(res.size(), m, c);
}
// Count$ThisTurnCast <Valid>
if(sq[0].contains("ThisTurnCast")) {
String[] workingCopy = l[0].split(" ");
String validFilter = workingCopy[1];
CardList res = CardUtil.getThisTurnCast(validFilter, c);
int ret = doXMath(res.size(), m, c);
System.out.println("Requesting ThisTurn Cast \"" + validFilter + "\", returning " + ret);
return ret;
}
// Count$Morbid.<True>.<False>

View File

@@ -1642,43 +1642,6 @@ public class CardFactory_Creatures {
card.addComesIntoPlayCommand(comesIntoPlay);
}//*************** END ************ END **************************
//*************** START *********** START **************************
else if (cardName.equals("Storm Entity")) {
final SpellAbility intoPlay = new Ability(card, "0") {
@Override
public boolean canPlayAI() {
CardList human = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
CardListUtil.sortAttack(human);
return (human.get(0).getNetAttack() < Phase.getStormCount() && Phase.getStormCount() > 1);
}
@Override
public void resolve() {
for (int i = 0; i < Phase.getStormCount() - 1; i++) {
card.addCounter(Counters.P1P1, 1);
}
}
};//SpellAbility
Command comesIntoPlay = new Command() {
private static final long serialVersionUID = -3734151854295L;
public void execute() {
AllZone.getStack().addSimultaneousStackEntry(intoPlay);
}
};
StringBuilder sb = new StringBuilder();
sb.append(cardName).append(" - enters the battlefield with a +1/+1 counter on it for each other spell played this turn.");
intoPlay.setStackDescription(sb.toString());
card.addComesIntoPlayCommand(comesIntoPlay);
}//*************** END ************ END **************************
//*************** START *********** START **************************
else if (cardName.equals("Vampire Hexmage")) {
/*