- Converted Zone.add() to moveTo() for the leftovers that aren't issue cases, or occur during game startup.

This commit is contained in:
jendave
2011-08-06 15:55:26 +00:00
parent 7f270e10b2
commit 3b98694854
10 changed files with 66 additions and 105 deletions

View File

@@ -173,7 +173,6 @@ public class Card extends MyObservable {
//used a limited number of times per turn //used a limited number of times per turn
//CardFactory.SSP_canPlay(Card) uses these variables //CardFactory.SSP_canPlay(Card) uses these variables
private int abilityTurnUsed; //What turn did this card last use this ability?
private int abilityUsed; //How many times has this ability been used? private int abilityUsed; //How many times has this ability been used?
public void addTrigger(Trigger t) public void addTrigger(Trigger t)
@@ -202,15 +201,7 @@ public class Card extends MyObservable {
{ {
triggers.clear(); triggers.clear();
} }
public void setAbilityTurnUsed(int i) {
abilityTurnUsed = i;
}
public int getAbilityTurnUsed() {
return abilityTurnUsed;
}
public void setAbilityUsed(int i) { public void setAbilityUsed(int i) {
abilityUsed = i; abilityUsed = i;
} }

View File

@@ -5325,8 +5325,7 @@ public class CardFactory implements NewConstants {
AllZone.GameAction.exile(getTargetCard()); AllZone.GameAction.exile(getTargetCard());
//put permanent onto the battlefield //put permanent onto the battlefield
Card c = getSourceCard(); AllZone.GameAction.moveToPlay(card);
AllZone.getZone(Constant.Zone.Battlefield, c.getController()).add(c);
} }
}//resolve() }//resolve()
@@ -5359,9 +5358,7 @@ public class CardFactory implements NewConstants {
if(!c.isToken()) { if(!c.isToken()) {
c = AllZone.CardFactory.copyCard(c); c = AllZone.CardFactory.copyCard(c);
c.setController(c.getOwner()); c.setController(c.getOwner());
AllZone.GameAction.moveToPlay(c);
PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, c.getOwner());
play.add(c);
} }
}//resolve() }//resolve()
};//SpellAbility };//SpellAbility
@@ -6750,12 +6747,11 @@ public class CardFactory implements NewConstants {
public void resolve() { public void resolve() {
final Player player = card.getController(); final Player player = card.getController();
CardList grave = AllZoneUtil.getPlayerGraveyard(player); CardList grave = AllZoneUtil.getPlayerGraveyard(player);
PlayerZone lib = AllZone.getZone(Constant.Zone.Library, player);
for(Card c:grave) { for(Card c:grave) {
lib.add(c); AllZone.GameAction.moveToLibrary(c);
} }
AllZone.getZone(Constant.Zone.Graveyard, player).reset();
player.shuffle(); player.shuffle();
} }
@@ -6788,13 +6784,13 @@ public class CardFactory implements NewConstants {
public void resolve() { public void resolve() {
final Player player = card.getController(); final Player player = card.getController();
CardList grave = AllZoneUtil.getPlayerGraveyard(player); CardList grave = AllZoneUtil.getPlayerGraveyard(player);
PlayerZone lib = AllZone.getZone(Constant.Zone.Library, player);
AllZone.GameAction.moveToLibrary(card); AllZone.GameAction.moveToLibrary(card);
for(Card c:grave) { for(Card c:grave) {
lib.add(c); AllZone.GameAction.moveToLibrary(c);
} }
AllZone.getZone(Constant.Zone.Graveyard, player).reset();
player.shuffle(); player.shuffle();
player.gainLife(5, card); player.gainLife(5, card);
} }

View File

@@ -1097,7 +1097,6 @@ public class CardFactoryUtil {
@Override @Override
public void resolve() { public void resolve() {
PlayerZone lib = AllZone.getZone(Constant.Zone.Library, sourceCard.getController()); PlayerZone lib = AllZone.getZone(Constant.Zone.Library, sourceCard.getController());
PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, sourceCard.getController());
CardList mercs = new CardList(); CardList mercs = new CardList();
CardList list = new CardList(lib.getCards()); CardList list = new CardList(lib.getCards());
@@ -4089,15 +4088,14 @@ public class CardFactoryUtil {
for(String kw:intrinsicKeywords) for(String kw:intrinsicKeywords)
c.addIntrinsicKeyword(kw); c.addIntrinsicKeyword(kw);
PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, controller);
int multiplier = AllZoneUtil.getDoublingSeasonMagnitude(controller); int multiplier = AllZoneUtil.getDoublingSeasonMagnitude(controller);
// todo: does this need to set PlayerZone_ComesIntoPlay.SimultaneousEntry like Rite of Replication does?
for(int i = 0; i < multiplier; i++) { for(int i = 0; i < multiplier; i++) {
Card temp = CardFactory.copyStats(c); Card temp = CardFactory.copyStats(c);
temp.setController(controller); temp.setController(controller);
temp.setOwner(controller); temp.setOwner(controller);
temp.setToken(true); temp.setToken(true);
play.add(temp); AllZone.GameAction.moveToPlay(temp);
list.add(temp); list.add(temp);
} }
return list; return list;

View File

@@ -100,8 +100,7 @@ class CardFactory_Auras {
@Override @Override
public void resolve() { public void resolve() {
PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, card.getController()); AllZone.GameAction.moveToPlay(card);
play.add(card);
Card c = getTargetCard(); Card c = getTargetCard();
@@ -292,8 +291,7 @@ class CardFactory_Auras {
@Override @Override
public void resolve() { public void resolve() {
PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, card.getController()); AllZone.GameAction.moveToPlay(card);
play.add(card);
Card c = getTargetCard(); Card c = getTargetCard();
@@ -410,8 +408,7 @@ class CardFactory_Auras {
@Override @Override
public void resolve() { public void resolve() {
PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, card.getController()); AllZone.GameAction.moveToPlay(card);
play.add(card);
Card c = getTargetCard(); Card c = getTargetCard();
@@ -605,8 +602,7 @@ class CardFactory_Auras {
NewType[0] = GuiUtils.getChoice("Select land type.", "Plains","Island","Swamp","Mountain","Forest"); NewType[0] = GuiUtils.getChoice("Select land type.", "Plains","Island","Swamp","Mountain","Forest");
} }
} }
PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, card.getController()); AllZone.GameAction.moveToPlay(card);
play.add(card);
Card c = getTargetCard(); Card c = getTargetCard();
@@ -782,8 +778,7 @@ class CardFactory_Auras {
@Override @Override
public void resolve() { public void resolve() {
PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, card.getController()); AllZone.GameAction.moveToPlay(card);
play.add(card);
Card c = getTargetCard(); Card c = getTargetCard();
@@ -862,8 +857,7 @@ class CardFactory_Auras {
@Override @Override
public void resolve() { public void resolve() {
PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, card.getController()); AllZone.GameAction.moveToPlay(card);
play.add(card);
Card c = getTargetCard(); Card c = getTargetCard();
@@ -980,8 +974,7 @@ class CardFactory_Auras {
@Override @Override
public void resolve() { public void resolve() {
PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, card.getController()); AllZone.GameAction.moveToPlay(card);
play.add(card);
Card c = getTargetCard(); Card c = getTargetCard();
@@ -1074,8 +1067,7 @@ class CardFactory_Auras {
@Override @Override
public void resolve() { public void resolve() {
PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, card.getController()); AllZone.GameAction.moveToPlay(card);
play.add(card);
Card c = getTargetCard(); Card c = getTargetCard();
@@ -1173,8 +1165,7 @@ class CardFactory_Auras {
@Override @Override
public void resolve() { public void resolve() {
PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, card.getController()); AllZone.GameAction.moveToPlay(card);
play.add(card);
Card c = getTargetCard(); Card c = getTargetCard();
@@ -1235,8 +1226,7 @@ class CardFactory_Auras {
@Override @Override
public void resolve() { public void resolve() {
PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, card.getController()); AllZone.GameAction.moveToPlay(card);
play.add(card);
Card c = getTargetCard(); Card c = getTargetCard();
@@ -1340,8 +1330,7 @@ class CardFactory_Auras {
@Override @Override
public void resolve() { public void resolve() {
PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, card.getController()); AllZone.GameAction.moveToPlay(card);
play.add(card);
Card c = getTargetCard(); Card c = getTargetCard();
@@ -1450,8 +1439,7 @@ class CardFactory_Auras {
@Override @Override
public void resolve() { public void resolve() {
PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, card.getController()); AllZone.GameAction.moveToPlay(card);
play.add(card);
Card c = getTargetCard(); Card c = getTargetCard();
@@ -1768,8 +1756,7 @@ class CardFactory_Auras {
@Override @Override
public void resolve() { public void resolve() {
PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, card.getController()); AllZone.GameAction.moveToPlay(card);
play.add(card);
Card c = getTargetCard(); Card c = getTargetCard();
@@ -1882,8 +1869,7 @@ class CardFactory_Auras {
@Override @Override
public void resolve() { public void resolve() {
PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, card.getController()); AllZone.GameAction.moveToPlay(card);
play.add(card);
Card c = getTargetCard(); Card c = getTargetCard();
@@ -2021,8 +2007,7 @@ class CardFactory_Auras {
@Override @Override
public void resolve() { public void resolve() {
PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, card.getController()); AllZone.GameAction.moveToPlay(card);
play.add(card);
Card c = getTargetCard(); Card c = getTargetCard();
if(AllZone.GameAction.isCardInPlay(c) && CardFactoryUtil.canTarget(card, c)) card.enchantCard(c); if(AllZone.GameAction.isCardInPlay(c) && CardFactoryUtil.canTarget(card, c)) card.enchantCard(c);
@@ -2340,8 +2325,7 @@ class CardFactory_Auras {
@Override @Override
public void resolve() { public void resolve() {
PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, card.getController()); AllZone.GameAction.moveToPlay(card);
play.add(card);
Card c = getTargetCard(); Card c = getTargetCard();
@@ -2481,8 +2465,7 @@ class CardFactory_Auras {
@Override @Override
public void resolve() { public void resolve() {
PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, card.getController()); AllZone.GameAction.moveToPlay(card);
play.add(card);
Card c = getTargetCard(); Card c = getTargetCard();

View File

@@ -268,9 +268,7 @@ public class CardFactory_Creatures {
copy.setImageFilename("morph.jpg"); copy.setImageFilename("morph.jpg");
} }
AllZone.GameAction.moveToPlay(copy);
PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, card.getController());
play.add(copy);
crds[i] = copy; crds[i] = copy;
} }
@@ -5378,8 +5376,7 @@ public class CardFactory_Creatures {
copy.setBaseAttack(token.getBaseAttack()); copy.setBaseAttack(token.getBaseAttack());
copy.setBaseDefense(token.getBaseDefense()); copy.setBaseDefense(token.getBaseDefense());
PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, card.getController()); AllZone.GameAction.moveToPlay(copy);
play.add(copy);
} }
@Override @Override
@@ -7875,11 +7872,12 @@ public class CardFactory_Creatures {
double Count = DoublingSeasons.size(); double Count = DoublingSeasons.size();
Count = Math.pow(2,Count); Count = Math.pow(2,Count);
for(int i = 0; i < Count; i++) { for(int i = 0; i < Count; i++) {
if(i + 1== Count) PlayerZone_ComesIntoPlay.SimultaneousEntry = false; if(i + 1 == Count) PlayerZone_ComesIntoPlay.SimultaneousEntry = false;
Card Copy = AllZone.CardFactory.copyCardintoNew(getSourceCard()); Card Copy = AllZone.CardFactory.copyCardintoNew(getSourceCard());
Copy.setToken(true); Copy.setToken(true);
Copy.setController(getSourceCard().getController()); Copy.setController(getSourceCard().getController());
play.add(Copy);
AllZone.GameAction.moveToPlay(Copy);
} }
} }
}; };

View File

@@ -107,8 +107,7 @@ class CardFactory_Planeswalkers {
emblem.setController(card.getController()); emblem.setController(card.getController());
emblem.setOwner(card.getOwner()); emblem.setOwner(card.getOwner());
PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, card.getController()); AllZone.GameAction.moveToPlay(emblem);
play.add(emblem);
//AllZone.GameAction.checkStateEffects(); //AllZone.GameAction.checkStateEffects();
AllZone.StaticEffects.rePopulateStateBasedList(); AllZone.StaticEffects.rePopulateStateBasedList();
@@ -1978,8 +1977,8 @@ class CardFactory_Planeswalkers {
emblem.setController(card.getController()); emblem.setController(card.getController());
emblem.setOwner(card.getOwner()); emblem.setOwner(card.getOwner());
PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, card.getController()); // todo: Emblems live in the command zone
play.add(emblem); AllZone.GameAction.moveToPlay(emblem);
//AllZone.GameAction.checkStateEffects(); //AllZone.GameAction.checkStateEffects();
AllZone.StaticEffects.rePopulateStateBasedList(); AllZone.StaticEffects.rePopulateStateBasedList();
@@ -2339,8 +2338,7 @@ class CardFactory_Planeswalkers {
emblem.setController(card.getController()); emblem.setController(card.getController());
emblem.setOwner(card.getOwner()); emblem.setOwner(card.getOwner());
PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, card.getController()); AllZone.GameAction.moveToPlay(emblem);
play.add(emblem);
} }
@Override @Override

View File

@@ -2853,19 +2853,18 @@ public class CardFactory_Sorceries {
@Override @Override
public void resolve() { public void resolve() {
if(AllZone.GameAction.isCardInPlay(getTargetCard()) if(AllZone.GameAction.isCardInPlay(getTargetCard())
&& CardFactoryUtil.canTarget(card, getTargetCard())) { && CardFactoryUtil.canTarget(card, getTargetCard())) {
PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, card.getController()); PlayerZone_ComesIntoPlay.SimultaneousEntry = true;
PlayerZone_ComesIntoPlay.SimultaneousEntry = true; double Count = AllZoneUtil.getDoublingSeasonMagnitude(card.getController());
double Count = AllZoneUtil.getDoublingSeasonMagnitude(card.getController()); for(int i = 0; i < Count; i++) {
for(int i = 0; i < Count; i++) { if(i + 1 == Count) PlayerZone_ComesIntoPlay.SimultaneousEntry = false;
if(i + 1== Count) PlayerZone_ComesIntoPlay.SimultaneousEntry = false; Card Copy = AllZone.CardFactory.copyCardintoNew(getTargetCard());
Card Copy = AllZone.CardFactory.copyCardintoNew(getTargetCard()); Copy.setToken(true);
Copy.setToken(true); Copy.setController(card.getController());
Copy.setController(card.getController()); AllZone.GameAction.moveToPlay(Copy);
play.add(Copy); }
} }
}
}//resolve() }//resolve()
}; };
@@ -2923,19 +2922,18 @@ public class CardFactory_Sorceries {
@Override @Override
public void resolve() { public void resolve() {
card.setKicked(true); card.setKicked(true);
if(AllZone.GameAction.isCardInPlay(getTargetCard()) if(AllZone.GameAction.isCardInPlay(getTargetCard())
&& CardFactoryUtil.canTarget(card, getTargetCard())) { && CardFactoryUtil.canTarget(card, getTargetCard())) {
PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, card.getController()); PlayerZone_ComesIntoPlay.SimultaneousEntry = true;
PlayerZone_ComesIntoPlay.SimultaneousEntry = true; int Count = 5 * AllZoneUtil.getDoublingSeasonMagnitude(card.getController());
int Count = 5 * AllZoneUtil.getDoublingSeasonMagnitude(card.getController()); for(int i = 0; i < Count; i++) {
for(int i = 0; i < Count; i++) { if(i + 1 == Count) PlayerZone_ComesIntoPlay.SimultaneousEntry = false;
if(i + 1 == Count) PlayerZone_ComesIntoPlay.SimultaneousEntry = false; Card Copy = AllZone.CardFactory.copyCardintoNew(getTargetCard());
Card Copy = AllZone.CardFactory.copyCardintoNew(getTargetCard()); Copy.setToken(true);
Copy.setToken(true); Copy.setController(card.getController());
Copy.setController(card.getController()); AllZone.GameAction.moveToPlay(Copy);
play.add(Copy); }
} }
}
}//resolve() }//resolve()
}; };
kicker.setKickerAbility(true); kicker.setKickerAbility(true);

View File

@@ -2543,7 +2543,6 @@ public class CombatUtil {
@Override @Override
public void resolve() { public void resolve() {
PlayerZone library = AllZone.getZone(Constant.Zone.Library, attacker.getController()); PlayerZone library = AllZone.getZone(Constant.Zone.Library, attacker.getController());
PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, attacker.getController());
CardList enchantments = new CardList(library.getCards()); CardList enchantments = new CardList(library.getCards());
//final String turn = attacker.getController(); //final String turn = attacker.getController();

View File

@@ -49,10 +49,12 @@ public class GameAction {
p.remove(c); p.remove(c);
} }
else{ else{
// things that were just created will not have zones!
//System.out.println(c.getName() + " " + zone.getZoneName()); //System.out.println(c.getName() + " " + zone.getZoneName());
} }
Card moving = c; Card moving = c;
if (!c.isToken()){ // Don't add the Token, unless it's moving to the battlefield
if (!c.isToken() || zone.is(Constant.Zone.Battlefield)){
// If a nontoken card is moving from the Battlefield, to non-Battlefield zone copy it // If a nontoken card is moving from the Battlefield, to non-Battlefield zone copy it
if (p != null && p.is(Constant.Zone.Battlefield) && !zone.is(Constant.Zone.Battlefield)) if (p != null && p.is(Constant.Zone.Battlefield) && !zone.is(Constant.Zone.Battlefield))
moving = AllZone.CardFactory.copyCard(c); moving = AllZone.CardFactory.copyCard(c);
@@ -2392,10 +2394,10 @@ public class GameAction {
AllZone.ComputerPlayer.drawCard(); AllZone.ComputerPlayer.drawCard();
} }
// todo: ManaPool should be moved to Player and be represented in the player panel
ManaPool mp = AllZone.ManaPool; ManaPool mp = AllZone.ManaPool;
mp.setImageFilename("mana_pool"); mp.setImageFilename("mana_pool");
AllZone.Human_Battlefield.add(mp); AllZone.Human_Battlefield.add(mp);
//ButtonUtil.reset();
AllZone.InputControl.setInput(new Input_Mulligan()); AllZone.InputControl.setInput(new Input_Mulligan());
Phase.GameBegins = 1; Phase.GameBegins = 1;

View File

@@ -869,7 +869,7 @@ public class GameActionUtil {
} }
revealed.shuffle(); revealed.shuffle();
for(Card bottom:revealed) { for(Card bottom:revealed) {
lib.add(bottom); AllZone.GameAction.moveToBottomOfLibrary(bottom);
} }
} }
}; };
@@ -10231,9 +10231,7 @@ public class GameActionUtil {
c.addSpellAbility(devour); c.addSpellAbility(devour);
c.addComesIntoPlayCommand(intoPlay); c.addComesIntoPlayCommand(intoPlay);
PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, card.getController()); AllZone.GameAction.moveToPlay(c);
play.add(c);
} }
};// Ability };// Ability
ability.setStackDescription("Dragon Broodmother - put a 1/1 red and green Dragon token onto the battlefield."); ability.setStackDescription("Dragon Broodmother - put a 1/1 red and green Dragon token onto the battlefield.");