code cleanup in CardFactory_Creatures

This commit is contained in:
jendave
2011-08-06 13:29:24 +00:00
parent 8f8d5cf72f
commit efcb15d1ea

View File

@@ -1035,13 +1035,7 @@ public class CardFactory_Creatures {
final SpellAbility ability = new Ability(card, "0") { final SpellAbility ability = new Ability(card, "0") {
@Override @Override
public void resolve() { public void resolve() {
PlayerZone hPlay = AllZone.getZone(Constant.Zone.Battlefield, AllZone.HumanPlayer); CardList creatures = AllZoneUtil.getCreaturesInPlay();
PlayerZone cPlay = AllZone.getZone(Constant.Zone.Battlefield, AllZone.ComputerPlayer);
CardList creatures = new CardList();
creatures.addAll(hPlay.getCards());
creatures.addAll(cPlay.getCards());
creatures = creatures.getType("Creature");
for(int i = 0; i < creatures.size(); i++) { for(int i = 0; i < creatures.size(); i++) {
Card crd = creatures.get(i); Card crd = creatures.get(i);
@@ -1072,13 +1066,7 @@ public class CardFactory_Creatures {
final SpellAbility ability = new Ability(card, "0") { final SpellAbility ability = new Ability(card, "0") {
@Override @Override
public void resolve() { public void resolve() {
PlayerZone hPlay = AllZone.getZone(Constant.Zone.Battlefield, AllZone.HumanPlayer); CardList creatures = AllZoneUtil.getCreaturesInPlay();
PlayerZone cPlay = AllZone.getZone(Constant.Zone.Battlefield, AllZone.ComputerPlayer);
CardList creatures = new CardList();
creatures.addAll(hPlay.getCards());
creatures.addAll(cPlay.getCards());
creatures = creatures.getType("Creature");
for(int i = 0; i < creatures.size(); i++) { for(int i = 0; i < creatures.size(); i++) {
Card crd = creatures.get(i); Card crd = creatures.get(i);
@@ -1134,14 +1122,12 @@ public class CardFactory_Creatures {
@Override @Override
public void resolve() { public void resolve() {
CardList all = new CardList(); CardList all = AllZoneUtil.getCreaturesInPlay();
all.addAll(AllZone.Human_Battlefield.getCards());
all.addAll(AllZone.Computer_Battlefield.getCards());
all = all.filter(new CardListFilter() all = all.filter(new CardListFilter()
{ {
public boolean addCard(Card c) public boolean addCard(Card c)
{ {
return c.isCreature() && !c.getKeyword().contains("Flying") && return !c.getKeyword().contains("Flying") &&
CardFactoryUtil.canDamage(card, c); CardFactoryUtil.canDamage(card, c);
} }
}); });
@@ -1173,14 +1159,12 @@ public class CardFactory_Creatures {
@Override @Override
public void resolve() { public void resolve() {
CardList all = new CardList(); CardList all = AllZoneUtil.getCreaturesInPlay();
all.addAll(AllZone.Human_Battlefield.getCards());
all.addAll(AllZone.Computer_Battlefield.getCards());
all = all.filter(new CardListFilter() all = all.filter(new CardListFilter()
{ {
public boolean addCard(Card c) public boolean addCard(Card c)
{ {
return c.isCreature() && c.getKeyword().contains("Flying") && return c.getKeyword().contains("Flying") &&
CardFactoryUtil.canDamage(card, c); CardFactoryUtil.canDamage(card, c);
} }
}); });
@@ -1256,9 +1240,7 @@ public class CardFactory_Creatures {
final SpellAbility ability = new Ability(card, "0") { final SpellAbility ability = new Ability(card, "0") {
@Override @Override
public void resolve() { public void resolve() {
PlayerZone zone = AllZone.getZone(Constant.Zone.Battlefield, card.getController()); CardList list = AllZoneUtil.getCreaturesInPlay(card.getController());
CardList list = new CardList(zone.getCards());
list = list.getType("Creature");
Card c; Card c;
for(int i = 0; i < list.size(); i++) { for(int i = 0; i < list.size(); i++) {
@@ -1295,24 +1277,6 @@ public class CardFactory_Creatures {
//*************** START *********** START ************************** //*************** START *********** START **************************
else if(cardName.equals("Sengir Autocrat")) { else if(cardName.equals("Sengir Autocrat")) {
/*
final SpellAbility ability = new Ability(card, "0") {
@Override
public void resolve() {
for(int i = 0; i < 3; i++)
CardFactoryUtil.makeToken("Serf", "B 0 1 Serf", card, "B", new String[] {
"Creature", "Serf"}, 0, 1, new String[] {""});
}
};//SpellAbility
Command intoPlay = new Command() {
private static final long serialVersionUID = -2966662310531173458L;
public void execute() {
ability.setStackDescription(card.getName() + " - " + card.getController()
+ " puts three 0/1 tokens into play");
AllZone.Stack.add(ability);
}
};*/
Command leavesPlay = new Command() { Command leavesPlay = new Command() {
private static final long serialVersionUID = 7242867764317580066L; private static final long serialVersionUID = 7242867764317580066L;
@@ -1322,7 +1286,6 @@ public class CardFactory_Creatures {
AllZone.GameAction.exile(serf); AllZone.GameAction.exile(serf);
}//execute }//execute
};//Command };//Command
// card.addComesIntoPlayCommand(intoPlay);
card.addLeavesPlayCommand(leavesPlay); card.addLeavesPlayCommand(leavesPlay);
}//*************** END ************ END ************************** }//*************** END ************ END **************************
@@ -1903,9 +1866,6 @@ public class CardFactory_Creatures {
public void resolve() { public void resolve() {
Player opponent = card.getController().getOpponent(); Player opponent = card.getController().getOpponent();
opponent.discard(this); opponent.discard(this);
//if(AllZone.HumanPlayer.equals(opponent)) AllZone.InputControl.setInput(CardFactoryUtil.input_discard(this));
//else //computer
//AllZone.GameAction.discardRandom(opponent, this);
}//resolve() }//resolve()
};//SpellAbility };//SpellAbility
@@ -2389,9 +2349,7 @@ public class CardFactory_Creatures {
@Override @Override
public void resolve() { public void resolve() {
CardList list = new CardList(); CardList list = AllZoneUtil.getCardsInPlay();
list.addAll(AllZone.Human_Battlefield.getCards());
list.addAll(AllZone.Computer_Battlefield.getCards());
for(int i = 0; i < list.size(); i++) for(int i = 0; i < list.size(); i++)
if(!list.get(i).getType().contains("Land")) { if(!list.get(i).getType().contains("Land")) {
@@ -2418,10 +2376,7 @@ public class CardFactory_Creatures {
final SpellAbility ability = new Ability(card, "0") { final SpellAbility ability = new Ability(card, "0") {
@Override @Override
public void resolve() { public void resolve() {
CardList list = new CardList(); CardList list = AllZoneUtil.getCreaturesInPlay();
list.addAll(AllZone.Human_Battlefield.getCards());
list.addAll(AllZone.Computer_Battlefield.getCards());
list = list.getType("Creature");
for(int i = 0; i < list.size(); i++) for(int i = 0; i < list.size(); i++)
if(!list.get(i).getKeyword().contains("Flying") if(!list.get(i).getKeyword().contains("Flying")
&& CardFactoryUtil.canDamage(card, list.get(i))) list.get(i).addDamage(5, card); && CardFactoryUtil.canDamage(card, list.get(i))) list.get(i).addDamage(5, card);
@@ -2962,10 +2917,7 @@ public class CardFactory_Creatures {
public void execute() { public void execute() {
//check to see if any other creatures in play //check to see if any other creatures in play
CardList list = new CardList(); CardList list = AllZoneUtil.getCreaturesInPlay();
list.addAll(AllZone.Human_Battlefield.getCards());
list.addAll(AllZone.Computer_Battlefield.getCards());
list = list.getType("Creature");
//check to see if any cards in hand //check to see if any cards in hand
PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController()); PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController());
@@ -3671,9 +3623,6 @@ public class CardFactory_Creatures {
public void resolve() { public void resolve() {
card.getController().drawCard(); card.getController().drawCard();
card.getController().discard(this); card.getController().discard(this);
//if(card.getController().equals(AllZone.HumanPlayer)) AllZone.InputControl.setInput(CardFactoryUtil.input_discard(this));
//else AllZone.GameAction.discardRandom(AllZone.ComputerPlayer, this);
} }
};//SpellAbility };//SpellAbility
@@ -3806,12 +3755,6 @@ public class CardFactory_Creatures {
if(getTargetCard() == null || getTargetCard() == card) AllZone.GameAction.sacrifice(card); if(getTargetCard() == null || getTargetCard() == card) AllZone.GameAction.sacrifice(card);
else if(AllZone.GameAction.isCardInPlay(getTargetCard())) { else if(AllZone.GameAction.isCardInPlay(getTargetCard())) {
/*
PlayerZone play = AllZone.getZone(getTargetCard());
PlayerZone removed = AllZone.getZone(Constant.Zone.Removed_From_Play, getTargetCard().getController());
play.remove(getTargetCard());
removed.add(getTargetCard());
*/
AllZone.GameAction.exile(getTargetCard()); AllZone.GameAction.exile(getTargetCard());
} }
}//resolve() }//resolve()
@@ -3939,12 +3882,6 @@ public class CardFactory_Creatures {
if(getTargetCard() == null || getTargetCard() == card) AllZone.GameAction.sacrifice(card); if(getTargetCard() == null || getTargetCard() == card) AllZone.GameAction.sacrifice(card);
else if(AllZone.GameAction.isCardInPlay(getTargetCard())) { else if(AllZone.GameAction.isCardInPlay(getTargetCard())) {
/*
PlayerZone play = AllZone.getZone(getTargetCard());
PlayerZone removed = AllZone.getZone(Constant.Zone.Removed_From_Play, getTargetCard().getController());
play.remove(getTargetCard());
removed.add(getTargetCard());
*/
AllZone.GameAction.exile(getTargetCard()); AllZone.GameAction.exile(getTargetCard());
} }
}//resolve() }//resolve()
@@ -4071,12 +4008,6 @@ public class CardFactory_Creatures {
if(getTargetCard() == null || getTargetCard() == card) AllZone.GameAction.sacrifice(card); if(getTargetCard() == null || getTargetCard() == card) AllZone.GameAction.sacrifice(card);
else if(AllZone.GameAction.isCardInPlay(getTargetCard())) { else if(AllZone.GameAction.isCardInPlay(getTargetCard())) {
/*
PlayerZone play = AllZone.getZone(getTargetCard());
PlayerZone removed = AllZone.getZone(Constant.Zone.Removed_From_Play, getTargetCard().getController());
play.remove(getTargetCard());
removed.add(getTargetCard());
*/
AllZone.GameAction.exile(getTargetCard()); AllZone.GameAction.exile(getTargetCard());
} }
}//resolve() }//resolve()
@@ -4239,12 +4170,6 @@ public class CardFactory_Creatures {
if(getTargetCard() == null || getTargetCard() == card) AllZone.GameAction.sacrifice(card); if(getTargetCard() == null || getTargetCard() == card) AllZone.GameAction.sacrifice(card);
else if(AllZone.GameAction.isCardInPlay(getTargetCard())) { else if(AllZone.GameAction.isCardInPlay(getTargetCard())) {
/*
PlayerZone play = AllZone.getZone(getTargetCard());
PlayerZone removed = AllZone.getZone(Constant.Zone.Removed_From_Play, getTargetCard().getController());
play.remove(getTargetCard());
removed.add(getTargetCard());
*/
AllZone.GameAction.exile(getTargetCard()); AllZone.GameAction.exile(getTargetCard());
} }
}//resolve() }//resolve()
@@ -4375,12 +4300,6 @@ public class CardFactory_Creatures {
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(getTargetCard());
PlayerZone removed = AllZone.getZone(Constant.Zone.Removed_From_Play, getTargetCard().getController());
play.remove(getTargetCard());
removed.add(getTargetCard());
*/
AllZone.GameAction.exile(getTargetCard()); AllZone.GameAction.exile(getTargetCard());
} }
}//resolve() }//resolve()