mirror of
https://github.com/magefree/mage.git
synced 2025-12-21 11:02:00 -08:00
[CLB] Implement Lae'zel's Acrobatics. Changed similar cards to use common logic (#9856)
This commit is contained in:
parent
049dd48d0a
commit
d5e74dd710
5 changed files with 188 additions and 43 deletions
34
Mage/src/main/java/mage/util/ExileUtil.java
Normal file
34
Mage/src/main/java/mage/util/ExileUtil.java
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
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