we have two functions that do the same thing. GameAction.exile(c) and GameAction.removeFromGame(c). Exile is the new language, so I left this function and updated all calls to use exile(c)

This commit is contained in:
jendave
2011-08-06 09:27:22 +00:00
parent aac1e35ff1
commit 4d112ed03e
9 changed files with 62 additions and 55 deletions

View File

@@ -193,7 +193,7 @@ public class AbilityFactory_Bounce {
AllZone.GameAction.shuffle(tgtC.getOwner());
}
else if(Destination.equals("Exile"))
AllZone.GameAction.removeFromGame(tgtC);
AllZone.GameAction.exile(tgtC);
else if(Destination.equals("Hand"))
{
PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, tgtC.getOwner());

View File

@@ -3290,7 +3290,7 @@ public class CardFactory implements NewConstants {
AllZone.GameAction.shuffle(tgtC.getOwner());
}
else if(Destination.equals("Exile"))
AllZone.GameAction.removeFromGame(tgtC);
AllZone.GameAction.exile(tgtC);
else if(Destination.equals("Hand"))
{
PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, tgtC.getOwner());
@@ -3453,7 +3453,7 @@ public class CardFactory implements NewConstants {
AllZone.GameAction.shuffle(tgtC.getOwner());
}
else if (Destination.equals("Exile"))
AllZone.GameAction.removeFromGame(tgtC);
AllZone.GameAction.exile(tgtC);
else if (Destination.equals("Hand"))
AllZone.GameAction.moveToHand(tgtC);
}
@@ -3628,7 +3628,7 @@ public class CardFactory implements NewConstants {
AllZone.GameAction.moveToTopOfLibrary(c);
AllZone.GameAction.shuffle(c.getOwner());
}
else if(Destination.equals("Exile")) AllZone.GameAction.removeFromGame(c);
else if(Destination.equals("Exile")) AllZone.GameAction.exile(c);
else if(Destination.equals("Hand")) {
PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, c.getOwner());
AllZone.GameAction.moveTo(hand, c);
@@ -7022,7 +7022,7 @@ public class CardFactory implements NewConstants {
public void resolve() {
if(AllZone.GameAction.isCardInPlay(getTargetCard())
&& CardFactoryUtil.canTarget(card, getTargetCard())) {
AllZone.GameAction.removeFromGame(getTargetCard());
AllZone.GameAction.exile(getTargetCard());
}
}//resolve()
};
@@ -7171,7 +7171,7 @@ public class CardFactory implements NewConstants {
public void resolve() {
if(AllZone.GameAction.isCardInPlay(getTargetCard())
&& CardFactoryUtil.canTarget(card, getTargetCard())) {
AllZone.GameAction.removeFromGame(getTargetCard());
AllZone.GameAction.exile(getTargetCard());
//put permanent into play
Card c = getSourceCard();
@@ -10509,7 +10509,7 @@ public class CardFactory implements NewConstants {
CardList grave = AllZoneUtil.getPlayerGraveyard(player);
PlayerZone lib = AllZone.getZone(Constant.Zone.Library, player);
//exile Feldon's Cane
AllZone.GameAction.removeFromGame(card);
AllZone.GameAction.exile(card);
for(Card c:grave) {
lib.add(c);
@@ -10648,7 +10648,7 @@ public class CardFactory implements NewConstants {
AllZone.GameAction.sacrifice(card);
for(Card c:grave) {
AllZone.GameAction.removeFromGame(c);
AllZone.GameAction.exile(c);
}
AllZone.getZone(Constant.Zone.Graveyard, player).reset();
AllZone.GameAction.shuffle(player);
@@ -10698,7 +10698,7 @@ public class CardFactory implements NewConstants {
public void resolve() {
if(AllZone.GameAction.isCardInPlay(getTargetCard())
&& CardFactoryUtil.canTarget(card, getTargetCard())) {
AllZone.GameAction.removeFromGame(getTargetCard());
AllZone.GameAction.exile(getTargetCard());
}//if
}//resolve()
};//abilityComes

View File

@@ -1729,7 +1729,7 @@ public class CardFactoryUtil {
@Override
public void resolve() {
AllZone.GameAction.removeFromGame(sourceCard);
AllZone.GameAction.exile(sourceCard);
sourceCard.addCounter(Counters.TIME, suspendCounters);
}
};

View File

@@ -1846,7 +1846,7 @@ public class CardFactory_Creatures {
if(card.isToken()) return;
AllZone.GameAction.removeFromGame(card);
AllZone.GameAction.exile(card);
}
};//SpellAbility
Command destroy = new Command() {
@@ -4430,7 +4430,7 @@ public class CardFactory_Creatures {
play.remove(getTargetCard());
removed.add(getTargetCard());
*/
AllZone.GameAction.removeFromGame(getTargetCard());
AllZone.GameAction.exile(getTargetCard());
}
}//resolve()
};
@@ -4558,7 +4558,7 @@ public class CardFactory_Creatures {
play.remove(getTargetCard());
removed.add(getTargetCard());
*/
AllZone.GameAction.removeFromGame(getTargetCard());
AllZone.GameAction.exile(getTargetCard());
}
}//resolve()
};
@@ -4685,7 +4685,7 @@ public class CardFactory_Creatures {
play.remove(getTargetCard());
removed.add(getTargetCard());
*/
AllZone.GameAction.removeFromGame(getTargetCard());
AllZone.GameAction.exile(getTargetCard());
}
}//resolve()
};
@@ -4849,7 +4849,7 @@ public class CardFactory_Creatures {
play.remove(getTargetCard());
removed.add(getTargetCard());
*/
AllZone.GameAction.removeFromGame(getTargetCard());
AllZone.GameAction.exile(getTargetCard());
}
}//resolve()
};
@@ -4981,7 +4981,7 @@ public class CardFactory_Creatures {
play.remove(getTargetCard());
removed.add(getTargetCard());
*/
AllZone.GameAction.removeFromGame(getTargetCard());
AllZone.GameAction.exile(getTargetCard());
}
}//resolve()
};
@@ -5533,7 +5533,7 @@ public class CardFactory_Creatures {
{
if(zone.is(Constant.Zone.Hand) && !c.isLand())
{
AllZone.GameAction.removeFromGame(c);
AllZone.GameAction.exile(c);
chosen.push(c);
AllZone.Stack.add(ability);
stopSetNext(new ComputerAI_StackNotEmpty());
@@ -8035,8 +8035,8 @@ public class CardFactory_Creatures {
@Override
public void chooseTargetAI() {
if (AllZone.Computer_Graveyard.getCards().length >=2) {
AllZone.GameAction.removeFromGame(AllZone.Computer_Graveyard.getCards()[0]);
AllZone.GameAction.removeFromGame(AllZone.Computer_Graveyard.getCards()[0]);
AllZone.GameAction.exile(AllZone.Computer_Graveyard.getCards()[0]);
AllZone.GameAction.exile(AllZone.Computer_Graveyard.getCards()[0]);
}
}
@@ -8073,7 +8073,7 @@ public class CardFactory_Creatures {
if (o!=null)
{
Card c1 = (Card)o;
AllZone.GameAction.removeFromGame(c1);
AllZone.GameAction.exile(c1);
list.remove(c1);
o = AllZone.Display.getChoice("Choose second card to exile", list.toArray());
@@ -8081,7 +8081,7 @@ public class CardFactory_Creatures {
{
Card c2 = (Card)o;
AllZone.GameAction.removeFromGame(c2);
AllZone.GameAction.exile(c2);
once = true;
AllZone.Stack.add(ability2);
@@ -9243,7 +9243,7 @@ public class CardFactory_Creatures {
list.addAll(AllZone.Human_Play.getCards());
list = list.getName("Stangg Twin");
if(list.size() == 1) AllZone.GameAction.removeFromGame(list.get(0));
if(list.size() == 1) AllZone.GameAction.exile(list.get(0));
}
});
@@ -11108,7 +11108,7 @@ public class CardFactory_Creatures {
if(getTargetCard() != null) {
if(AllZone.GameAction.isCardInPlay(getTargetCard())
&& CardFactoryUtil.canTarget(card, getTargetCard())) {
AllZone.GameAction.removeFromGame(getTargetCard());
AllZone.GameAction.exile(getTargetCard());
}
}
}
@@ -11901,11 +11901,11 @@ public class CardFactory_Creatures {
Object o = AllZone.Display.getChoiceOptional("Select card to remove: ",
cards.toArray());
Card c = (Card) o;
AllZone.GameAction.removeFromGame(c);
AllZone.GameAction.exile(c);
AllZone.GameAction.shuffle(opponent);
} else {
Card c = lib.get(0);
AllZone.GameAction.removeFromGame(c);
AllZone.GameAction.exile(c);
AllZone.GameAction.shuffle(opponent);
}
}
@@ -12991,10 +12991,10 @@ public class CardFactory_Creatures {
Object o = AllZone.Display.getChoiceOptional(title, gravecards.toArray());
if(o != null) {
Card removedCard = (Card) o;
AllZone.GameAction.removeFromGame(removedCard);
AllZone.GameAction.exile(removedCard);
}
} else {
AllZone.GameAction.removeFromGame(gravecards.get(0));
AllZone.GameAction.exile(gravecards.get(0));
}
}
@@ -16222,7 +16222,7 @@ public class CardFactory_Creatures {
}
}
}
AllZone.GameAction.removeFromGame(card);
AllZone.GameAction.exile(card);
}
}//if human
else {
@@ -16239,7 +16239,7 @@ public class CardFactory_Creatures {
Card c = CardFactoryUtil.AI_getBestEnchantment(list, card, false);
lib.remove(c);
play.add(c);
AllZone.GameAction.removeFromGame(card);
AllZone.GameAction.exile(card);
}
}
@@ -17601,7 +17601,7 @@ public class CardFactory_Creatures {
list = list.getType("Nightmare");
for(Card c:list) {
AllZone.GameAction.removeFromGame(c);
AllZone.GameAction.exile(c);
}
}
@@ -19238,7 +19238,7 @@ public class CardFactory_Creatures {
int max = Math.min(lib.size(), 10);
for(int i = 0; i < max; i++) {
//remove the top card 10 times
AllZone.GameAction.removeFromGame(lib.get(0));
AllZone.GameAction.exile(lib.get(0));
}
if(getTargetCard() != null) {
if(AllZone.GameAction.isCardInPlay(getTargetCard())
@@ -19262,7 +19262,7 @@ public class CardFactory_Creatures {
public void makeToken(Card c)
{
AllZone.GameAction.removeFromGame(c);
AllZone.GameAction.exile(c);
CardFactoryUtil.makeToken("Zombie", "B 2 2 Zombie", card, "B", new String[] {
"Creature", "Zombie"}, 2, 2, new String[] {""});
}
@@ -20256,7 +20256,7 @@ public class CardFactory_Creatures {
for(int m = 0; m < selection.size(); m++) {
intermSumPower += selection.get(m).getBaseAttack();
intermSumToughness += selection.get(m).getBaseDefense();
AllZone.GameAction.removeFromGame(selection.get(m));
AllZone.GameAction.exile(selection.get(m));
}
}
@@ -20268,7 +20268,7 @@ public class CardFactory_Creatures {
if(c.getNetAttack() <= 2 && c.getNetDefense() <= 3) {
intermSumPower += c.getBaseAttack();
intermSumToughness += c.getBaseDefense();
AllZone.GameAction.removeFromGame(c);
AllZone.GameAction.exile(c);
count++;
}
//is this needed?

View File

@@ -438,7 +438,7 @@ public class CardFactory_Instants {
&& CardFactoryUtil.canTarget(card, getTargetCard())) {
Player controller = getTargetCard().getController();
AllZone.GameAction.removeFromGame(getTargetCard());
AllZone.GameAction.exile(getTargetCard());
CardFactoryUtil.makeToken("Shapeshifter", "C 1 1 Shapeshifter",
controller, "", new String[] {"Creature", "Shapeshifter"}, 1,
@@ -1990,7 +1990,7 @@ public class CardFactory_Instants {
if(!getTargetCard().isFaceDown()) {
//bounce all permanents with the same name
for(int i = 0; i < sameName.size(); i++) {
if(sameName.get(i).isToken()) AllZone.GameAction.removeFromGame(sameName.get(i));
if(sameName.get(i).isToken()) AllZone.GameAction.exile(sameName.get(i));
else {
PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, sameName.get(i).getOwner());
AllZone.GameAction.moveTo(hand, sameName.get(i));
@@ -3362,7 +3362,7 @@ public class CardFactory_Instants {
PlayerZone lib = AllZone.getZone(Constant.Zone.Library, player);
//remove card from play
AllZone.GameAction.removeFromGame(getTargetCard());
AllZone.GameAction.exile(getTargetCard());
//Retrieve basic land
CardList lands = new CardList(lib.getCards());
@@ -3722,7 +3722,7 @@ public class CardFactory_Instants {
public void selectCard(Card c, PlayerZone zone) {
if(c.isBlue() && zone.is(Constant.Zone.Hand)
&& !c.equals(card)) {
AllZone.GameAction.removeFromGame(c);
AllZone.GameAction.exile(c);
Player player = card.getController();
//AllZone.GameAction.getPlayerLife(player).subtractLife(1,card);
player.subtractLife(1, card);
@@ -4470,14 +4470,14 @@ public class CardFactory_Instants {
if(o == null) break;
Card c_1 = (Card) o;
graveList.remove(c_1); //remove from the display list
AllZone.GameAction.removeFromGame(c_1);
AllZone.GameAction.exile(c_1);
}
}
else { //Computer
//Random random = new Random();
for(int j = 0; j < X; j++) {
//int index = random.nextInt(X-j);
AllZone.GameAction.removeFromGame(graveList.get(j));
AllZone.GameAction.exile(graveList.get(j));
}
}
@@ -4600,7 +4600,7 @@ public class CardFactory_Instants {
for(int i = 0; i < 7; i++) {
Card c = libList.get(i);
AllZone.GameAction.removeFromGame(c);
AllZone.GameAction.exile(c);
}
int max = libList.size();
@@ -4614,7 +4614,7 @@ public class CardFactory_Instants {
}
} else if(stop == 0) {
AllZone.GameAction.removeFromGame(c);
AllZone.GameAction.exile(c);
}
}
}

View File

@@ -2924,7 +2924,7 @@ class CardFactory_Planeswalkers {
CardList handList = new CardList(hand.getCards());
for(Card c:libList)
AllZone.GameAction.removeFromGame(c);
AllZone.GameAction.exile(c);
handList.shuffle();
for(Card c:handList) {

View File

@@ -34,7 +34,7 @@ public class CardFactory_Sorceries {
discardDraw7(AllZone.ComputerPlayer);
if (cardName.equals("Time Reversal"))
AllZone.GameAction.removeFromGame(card);
AllZone.GameAction.exile(card);
}//resolve()
void discardDraw7(Player player) {
@@ -6083,13 +6083,13 @@ public class CardFactory_Sorceries {
damage++; // tally up how many cards removed
Card c_1 = (Card) o;
graveList.remove(c_1); //remove from the display list
AllZone.GameAction.removeFromGame(c_1);
AllZone.GameAction.exile(c_1);
}
}
else { //Computer
// it would be nice if the computer chose vanilla creatures over
for(int j = 0; j < size; j++) {
AllZone.GameAction.removeFromGame(graveList.get(j));
AllZone.GameAction.exile(graveList.get(j));
}
}
tPlayer.addDamage(damage, card);
@@ -6578,7 +6578,7 @@ public class CardFactory_Sorceries {
Card tgt = getTargetCard();
if (null != tgt) {
if (tgt.isToken()) {
AllZone.GameAction.removeFromGame(tgt);
AllZone.GameAction.exile(tgt);
} else {
PlayerZone lib = AllZone.getZone(Constant.Zone.Library, tgt.getOwner());
PlayerZone play = AllZone.getZone(Constant.Zone.Play, tgt.getController());
@@ -7450,7 +7450,7 @@ public class CardFactory_Sorceries {
for(int i = 0; i < target.length; i++) {
Card c = target[i];
if (AllZone.GameAction.isCardInPlay(c))
AllZone.GameAction.removeFromGame(c);
AllZone.GameAction.exile(c);
}
card.getController().addDamage(5, card);

View File

@@ -2574,7 +2574,7 @@ public class CombatUtil {
@Override
public void resolve() {
if(attacker.isToken())
AllZone.GameAction.removeFromGame(attacker);
AllZone.GameAction.exile(attacker);
else {
PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, attacker.getOwner());
AllZone.GameAction.moveTo(hand, attacker);

View File

@@ -168,7 +168,7 @@ public class GameAction {
discard_nath(c);
discard_megrim(c);
if(CardFactoryUtil.getCards("Necropotence", c.getOwner()).size() > 0){ // necro disrupts madness
removeFromGame(c);
exile(c);
return;
}
discard_madness(c);
@@ -2417,6 +2417,7 @@ public class GameAction {
return true;
}
/*
//because originally, MTGForge didn't keep track of cards removed from the game.
public void removeFromGame(Card c) {
if(AllZone.GameAction.isCardRemovedFromGame(c)) return;
@@ -2428,17 +2429,23 @@ public class GameAction {
zone.remove(c);
if(!c.isToken()) removed.add(c);
}
}*/
/**
* basically an alias for removeFromGame to bring the language in the code
* to match the mechanics in Forge
* @param c
* @param c the card to be exiled
*/
public void exile(Card c) {
removeFromGame(c);
//removeFromGame(c);
if(AllZone.GameAction.isCardRemovedFromGame(c)) return;
PlayerZone zone = AllZone.getZone(c); //could be hand, grave, play, ...
PlayerZone removed = AllZone.getZone(Constant.Zone.Removed_From_Play, c.getOwner());
if (zone != null) // for suspend
zone.remove(c);
if(!c.isToken()) removed.add(c);
}