- Added Conundrum Sphinx

This commit is contained in:
swordshine
2013-09-24 00:32:01 +00:00
parent a97398e0b3
commit 919de9b0fa
5 changed files with 87 additions and 1 deletions

1
.gitattributes vendored
View File

@@ -2123,6 +2123,7 @@ res/cardsfolder/c/control_magic.txt svneol=native#text/plain
res/cardsfolder/c/control_of_the_court.txt svneol=native#text/plain res/cardsfolder/c/control_of_the_court.txt svneol=native#text/plain
res/cardsfolder/c/controlled_instincts.txt svneol=native#text/plain res/cardsfolder/c/controlled_instincts.txt svneol=native#text/plain
res/cardsfolder/c/controvert.txt svneol=native#text/plain res/cardsfolder/c/controvert.txt svneol=native#text/plain
res/cardsfolder/c/conundrum_sphinx.txt -text
res/cardsfolder/c/convalescence.txt svneol=native#text/plain res/cardsfolder/c/convalescence.txt svneol=native#text/plain
res/cardsfolder/c/convalescent_care.txt svneol=native#text/plain res/cardsfolder/c/convalescent_care.txt svneol=native#text/plain
res/cardsfolder/c/conversion.txt svneol=native#text/plain res/cardsfolder/c/conversion.txt svneol=native#text/plain

View File

@@ -0,0 +1,13 @@
Name:Conundrum Sphinx
ManaCost:2 U U
Types:Creature Sphinx
PT:4/4
K:Flying
T:Mode$ Attacks | ValidCard$ Card.Self | Execute$ EachName | TriggerDescription$ Whenever CARDNAME attacks, each player names a card. Then each player reveals the top card of his or her library. If the card a player revealed is the card he or she named, that player puts it into his or her hand. If it's not, that player puts it on the bottom of his or her library.
SVar:EachName:AB$ RepeatEach | Cost$ 0 | RepeatPlayers$ Player | RepeatSubAbility$ DBName | SubAbility$ DBDigEach
SVar:DBName:DB$ NameCard | Defined$ Player.IsRemembered | AILogic$ RandomInComputerDeck
SVar:DBDigEach:DB$ RepeatEach | Cost$ 0 | RepeatPlayers$ Player | RepeatSubAbility$ DBDig
SVar:DBDig:DB$ Dig | DigNum$ 1 | Defined$ Player.IsRemembered | ChangeNum$ All | ChangeValid$ Card.NamedByRememberedPlayer | Reveal$ True
SVar:RemRandomDeck:True
SVar:Picture:http://www.wizards.com/global/images/magic/general/conundrum_sphinx.jpg
Oracle:Flying\nWhenever Conundrum Sphinx attacks, each player names a card. Then each player reveals the top card of his or her library. If the card a player revealed is the card he or she named, that player puts it into his or her hand. If it's not, that player puts it on the bottom of his or her library.

View File

@@ -5308,6 +5308,24 @@ public class Card extends GameEntity implements Comparable<Card> {
if (!this.getName().equals(source.getNamedCard())) { if (!this.getName().equals(source.getNamedCard())) {
return false; return false;
} }
} else if (property.equals("NamedByRememberedPlayer")) {
if (source.getRemembered().isEmpty()) {
final Card newCard = game.getCardState(source);
for (final Object o : newCard.getRemembered()) {
if (o instanceof Player) {
if (!this.getName().equals(((Player) o).getNamedCard())) {
return false;
}
}
}
}
for (final Object o : source.getRemembered()) {
if (o instanceof Player) {
if (!this.getName().equals(((Player) o).getNamedCard())) {
return false;
}
}
}
} else if (property.equals("ChosenCard")) { } else if (property.equals("ChosenCard")) {
if (!source.getChosenCard().contains(this)) { if (!source.getChosenCard().contains(this)) {
return false; return false;

View File

@@ -111,6 +111,7 @@ public class ChooseCardNameEffect extends SpellAbilityEffect {
Card instanceForPlayer = cp.toForgeCard(p); // the Card instance for test needs a game to be tested Card instanceForPlayer = cp.toForgeCard(p); // the Card instance for test needs a game to be tested
if (instanceForPlayer.isValid(valid, host.getController(), host)) { if (instanceForPlayer.isValid(valid, host.getController(), host)) {
host.setNamedCard(cp.getName()); host.setNamedCard(cp.getName());
p.setNamedCard(cp.getName());
ok = true; ok = true;
} }
} else { } else {
@@ -123,6 +124,8 @@ public class ChooseCardNameEffect extends SpellAbilityEffect {
chosen = ComputerUtilCard.getMostProminentCardName(p.getOpponent().getCardsIn(ZoneType.Library)); chosen = ComputerUtilCard.getMostProminentCardName(p.getOpponent().getCardsIn(ZoneType.Library));
} else if (logic.equals("BestCreatureInComputerDeck")) { } else if (logic.equals("BestCreatureInComputerDeck")) {
chosen = ComputerUtilCard.getBestCreatureAI(p.getCardsIn(ZoneType.Library)).getName(); chosen = ComputerUtilCard.getBestCreatureAI(p.getCardsIn(ZoneType.Library)).getName();
} else if (logic.equals("RandomInComputerDeck")) {
chosen = Aggregates.random(p.getCardsIn(ZoneType.Library)).getName();
} }
} else { } else {
List<Card> list = CardLists.filterControlledBy(p.getGame().getCardsInGame(), p.getOpponent()); List<Card> list = CardLists.filterControlledBy(p.getGame().getCardsInGame(), p.getOpponent());
@@ -136,6 +139,7 @@ public class ChooseCardNameEffect extends SpellAbilityEffect {
} }
GuiChoose.one("Computer picked: ", new String[]{chosen}); GuiChoose.one("Computer picked: ", new String[]{chosen});
host.setNamedCard(chosen); host.setNamedCard(chosen);
p.setNamedCard(chosen);
ok = true; ok = true;
} }
} }

View File

@@ -130,6 +130,9 @@ public class Player extends GameEntity implements Comparable<Player> {
/** The last drawn card. */ /** The last drawn card. */
private Card lastDrawnCard = null; private Card lastDrawnCard = null;
/** The named card. */
private String namedCard = "";
/** The num drawn this turn. */ /** The num drawn this turn. */
private int numDrawnThisTurn = 0; private int numDrawnThisTurn = 0;
private int numDrawnThisDrawStep = 0; private int numDrawnThisDrawStep = 0;
@@ -1958,6 +1961,30 @@ public class Player extends GameEntity implements Comparable<Player> {
return this.lastDrawnCard; return this.lastDrawnCard;
} }
/**
* <p>
* Getter for the field <code>namedCard</code>.
* </p>
*
* @return a String.
*/
public final String getNamedCard() {
return this.namedCard;
}
/**
* <p>
* Setter for the field <code>namedCard</code>.
* </p>
*
* @param s
* a {@link forge.Card} object.
* @return
* @return a {@link forge.Card} object.
*/
public final void setNamedCard(final String s) {
this.namedCard = s;
}
/** /**
* <p> * <p>
* getTurn. * getTurn.
@@ -2378,6 +2405,11 @@ public class Player extends GameEntity implements Comparable<Player> {
if (this.equals(sourceController) || !this.isOpponentOf(sourceController)) { if (this.equals(sourceController) || !this.isOpponentOf(sourceController)) {
return false; return false;
} }
} else if (property.equals("OpponentToActive")) {
final Player active = game.getPhaseHandler().getPlayerTurn();
if (this.equals(active) || !this.isOpponentOf(active)) {
return false;
}
} else if (property.equals("Other")) { } else if (property.equals("Other")) {
if (this.equals(sourceController)) { if (this.equals(sourceController)) {
return false; return false;
@@ -2424,11 +2456,29 @@ public class Player extends GameEntity implements Comparable<Player> {
} }
} else if (property.startsWith("withMore")) { } else if (property.startsWith("withMore")) {
final String cardType = property.split("sThan")[0].substring(8); final String cardType = property.split("sThan")[0].substring(8);
final Player controller = "Active".equals(property.split("sThan")[1]) ? game.getPhaseHandler().getPlayerTurn() : sourceController;
final List<Card> oppList = CardLists.filter(this.getCardsIn(ZoneType.Battlefield), CardPredicates.isType(cardType)); final List<Card> oppList = CardLists.filter(this.getCardsIn(ZoneType.Battlefield), CardPredicates.isType(cardType));
final List<Card> yourList = CardLists.filter(sourceController.getCardsIn(ZoneType.Battlefield), CardPredicates.isType(cardType)); final List<Card> yourList = CardLists.filter(controller.getCardsIn(ZoneType.Battlefield), CardPredicates.isType(cardType));
if (oppList.size() <= yourList.size()) { if (oppList.size() <= yourList.size()) {
return false; return false;
} }
} else if (property.startsWith("hasMore")) {
final Player controller = "Active".equals(property.split("Than")[1]) ? game.getPhaseHandler().getPlayerTurn() : sourceController;
if (property.substring(7).startsWith("Life") && this.getLife() <= controller.getLife()) {
return false;
} else if (property.substring(7).startsWith("CardsInHand")
&& this.getCardsIn(ZoneType.Hand).size() <= controller.getCardsIn(ZoneType.Hand).size()) {
return false;
}
} else if (property.startsWith("hasFewer")) {
final Player controller = "Active".equals(property.split("Than")[1]) ? game.getPhaseHandler().getPlayerTurn() : sourceController;
if (property.substring(8).startsWith("CreaturesInYard")) {
final List<Card> oppList = CardLists.filter(this.getCardsIn(ZoneType.Graveyard), Presets.CREATURES);
final List<Card> yourList = CardLists.filter(controller.getCardsIn(ZoneType.Graveyard), Presets.CREATURES);
if (oppList.size() >= yourList.size()) {
return false;
}
}
} else if (property.startsWith("withMost")) { } else if (property.startsWith("withMost")) {
if (property.substring(8).equals("Life")) { if (property.substring(8).equals("Life")) {
int highestLife = this.getLife(); // Negative base just in case a few Lich's are running around int highestLife = this.getLife(); // Negative base just in case a few Lich's are running around