living death

any ideas on why this infinite loops?
must be the iterators in the while, but I'm not sure why they aren't working properly
must be the iterators in the while, but I'm not sure why they aren't working properly
- Code: Select all
//********************Start********Start***********************
else if(cardName.equals("Living Death"))
{
final SpellAbility spell = new Spell(card)
{
private static final long serialVersionUID = -7657135492744579098L;
public void resolve()
{ //grab make 4 creature lists: human_play, human_graveyard, computer_play, computer_graveyard
CardList human_play = new CardList();
human_play.addAll(AllZone.Human_Play.getCards());
human_play = human_play.filter(new CardListFilter()
{
public boolean addCard(Card c) { return c.isCreature(); }
});
CardList human_graveyard = new CardList();
human_graveyard.addAll(AllZone.Human_Graveyard.getCards());
human_graveyard = human_graveyard.filter(new CardListFilter()
{
public boolean addCard(Card c) { return c.isCreature(); }
});
CardList computer_play = new CardList();
computer_play.addAll(AllZone.Computer_Play.getCards());
computer_play = computer_play.filter(new CardListFilter()
{
public boolean addCard(Card c) { return c.isCreature(); }
});
CardList computer_graveyard = new CardList();
computer_graveyard.addAll(AllZone.Human_Graveyard.getCards());
computer_graveyard = computer_graveyard.filter(new CardListFilter()
{
public boolean addCard(Card c) { return c.isCreature(); }
});
while(human_play.iterator().hasNext())
{ AllZone.Human_Play.remove(human_play.iterator().next()); }
while(human_play.iterator().hasNext())
{ AllZone.Human_Graveyard.add(human_play.iterator().next()); }
while(human_graveyard.iterator().hasNext())
{AllZone.Human_Graveyard.remove(human_graveyard.iterator().next());}
while(human_graveyard.iterator().hasNext())
{ AllZone.Human_Play.add(human_graveyard.iterator().next()); }
while(computer_play.iterator().hasNext())
{ AllZone.Computer_Play.remove(computer_play.iterator().next()); }
while(computer_play.iterator().hasNext())
{ AllZone.Computer_Graveyard.add(computer_play.iterator().next()); }
while(computer_graveyard.iterator().hasNext())
{AllZone.Computer_Graveyard.remove(computer_graveyard.iterator().next()); }
while(computer_graveyard.iterator().hasNext())
{ AllZone.Computer_Play.add(computer_graveyard.iterator().next()); }
}//resolve
};//spellability
card.clearSpellAbility();
card.addSpellAbility(spell);
}//*********************END**********END***********************