-if moveToHand is called on a token, the token is simply removed from the zone it's in. (aka, moveToHand now handles tokens)

-simplified code for Hurkyl's Recall
This commit is contained in:
jendave
2011-08-06 13:17:26 +00:00
parent 9502e7c0c8
commit b69ec49431
2 changed files with 92 additions and 143 deletions

View File

@@ -3035,28 +3035,6 @@ public class CardFactory_Instants {
alt.setBeforePayMana(exileBlue);
/*
Command bounceIslandsAI = new Command()
{
private static final long serialVersionUID = -8745630329512914365L;
public void execute()
{
PlayerZone play = AllZone.getZone(Constant.Zone.Play, AllZone.ComputerPlayer);
CardList list = new CardList(play.getCards());
list = list.getType("Island");
//TODO: sort by tapped
for (int i=0;i<3;i++)
{
AllZone.GameAction.moveToHand(list.get(i));
}
}
};
alt.setBeforePayManaAI(bounceIslandsAI);
*/
card.clearSpellAbility();
card.addSpellAbility(alt);
card.addSpellAbility(spell);
@@ -3241,15 +3219,12 @@ public class CardFactory_Instants {
private static final long serialVersionUID = 6024081054401784073L;
public void resolve()
{
CardList all = new CardList();
all.addAll(AllZone.Human_Battlefield.getCards());
all.addAll(AllZone.Computer_Battlefield.getCards());
CardList all = AllZoneUtil.getCreaturesInPlay();
all = all.filter(new CardListFilter()
{
public boolean addCard(Card c)
{
return c.isCreature() && c.getKeyword().contains("Flying") &&
CardFactoryUtil.canDamage(card, c);
return c.getKeyword().contains("Flying") && CardFactoryUtil.canDamage(card, c);
}
});
@@ -3349,11 +3324,7 @@ public class CardFactory_Instants {
});
//get all creatures
CardList list = new CardList();
list.addAll(AllZone.Human_Battlefield.getCards());
list.addAll(AllZone.Computer_Battlefield.getCards());
list = list.getName(getTargetCard().getName());
CardList list = AllZoneUtil.getCardsInPlay(getTargetCard().getName());
list.remove(getTargetCard());
if (!getTargetCard().isFaceDown())
@@ -3374,7 +3345,6 @@ public class CardFactory_Instants {
crd.addTempDefenseBoost(-2);
}
});
//list.get(i).addDamage(2);
}
}//in play?
@@ -3438,19 +3408,13 @@ public class CardFactory_Instants {
private static final long serialVersionUID = -3554283811532201543L;
public void resolve()
{
CardList all = new CardList();
all.addAll(AllZone.Human_Battlefield.getCards());
all.addAll(AllZone.Computer_Battlefield.getCards());
all = all.filter(new CardListFilter()
{
public boolean addCard(Card c)
{
return c.isCreature() && CardFactoryUtil.canDamage(card, c);
}
});
CardList all = AllZoneUtil.getCreaturesInPlay();
for(int i = 0; i < all.size(); i++)
for(int i = 0; i < all.size(); i++) {
if(CardFactoryUtil.canDamage(card, all.get(i))) {
all.get(i).addDamage(card.getXManaCostPaid(), card);
}
}
card.setXManaCostPaid(0);
}
@@ -3557,15 +3521,9 @@ public class CardFactory_Instants {
@Override
public boolean canPlayAI() {
PlayerZone humanPlay = AllZone.getZone(Constant.Zone.Battlefield, AllZone.HumanPlayer);
CardList humanArts = new CardList(humanPlay.getCards());
CardList humanArts = AllZoneUtil.getPlayerCardsInPlay(AllZone.HumanPlayer);
humanArts = humanArts.getType("Artifact");
if(humanArts.size() > 0) {
return true;
}
else {
return false;
}
return humanArts.size() > 0;
}//canPlayAI
@Override
@@ -3576,24 +3534,14 @@ public class CardFactory_Instants {
@Override
public void resolve() {
Player player = getTargetPlayer();
PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, player);
PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, player);
final Player opponent = player.getOpponent();
PlayerZone oppPlay = AllZone.getZone(Constant.Zone.Battlefield, opponent);
CardList artifacts = new CardList(play.getCards());
artifacts.addAll(oppPlay.getCards());
CardList artifacts = AllZoneUtil.getCardsInPlay();
artifacts = artifacts.getType("Artifact");
for(int i = 0; i < artifacts.size(); i++) {
Card thisArtifact = artifacts.get(i);
//if is token, remove token from play, else return artifact to hand
if(thisArtifact.getOwner().equals(player)) {
if(thisArtifact.isToken()) {
play.remove(thisArtifact);
}
else {
AllZone.GameAction.moveTo(hand, thisArtifact);
}
//moveToHand handles tokens
AllZone.GameAction.moveToHand(thisArtifact);
}
}
}//resolve()

View File

@@ -156,7 +156,8 @@ public class GameAction {
public void moveToHand(Card c) {
PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, c.getOwner());
moveTo(hand, c);
if(c.isToken()) AllZone.getZone(c).remove(c);
else moveTo(hand, c);
}
public void moveToPlay(Card c) {