forked from External/mage
new ExileReturnBattlefieldNextEndStepTargetEffect (#11251)
* adjust ExileThenReturnTargetEffect * initial rework ExileReturnBattlefieldNextEndStepTargetEffect (test coverage provided by CloudshiftTest) * refactor some more cards * refactor more straightforward cards * add params and more refactoring * text fixes * maintain order in set * fix Lae'zel's Acrobatics and add test
This commit is contained in:
parent
c8e2282a79
commit
6e18dbd2e4
29 changed files with 402 additions and 1182 deletions
|
|
@ -1,34 +0,0 @@
|
|||
package mage.util;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import mage.cards.Card;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.cards.MeldCard;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.PermanentCard;
|
||||
import mage.game.permanent.PermanentMeld;
|
||||
|
||||
public class ExileUtil {
|
||||
public static Cards returnCardsFromExile(Set<Card> cards, Game game) {
|
||||
Cards cardsToReturn = new CardsImpl();
|
||||
for (Card exiled : cards) {
|
||||
if (exiled instanceof PermanentMeld) {
|
||||
MeldCard meldCard = (MeldCard) ((PermanentCard) exiled).getCard();
|
||||
Card topCard = meldCard.getTopHalfCard();
|
||||
Card bottomCard = meldCard.getBottomHalfCard();
|
||||
if (topCard.getZoneChangeCounter(game) == meldCard.getTopLastZoneChangeCounter()) {
|
||||
cardsToReturn.add(topCard);
|
||||
}
|
||||
if (bottomCard.getZoneChangeCounter(game) == meldCard.getBottomLastZoneChangeCounter()) {
|
||||
cardsToReturn.add(bottomCard);
|
||||
}
|
||||
} else if (exiled.getZoneChangeCounter(game) == game.getState().getZoneChangeCounter(exiled.getId()) - 1) {
|
||||
cardsToReturn.add(exiled);
|
||||
}
|
||||
}
|
||||
|
||||
return cardsToReturn;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue