mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
- Fixed #5433
This commit is contained in:
parent
f15d8a0da8
commit
d1c1abb967
1 changed files with 30 additions and 22 deletions
|
@ -10,10 +10,11 @@ import mage.constants.*;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import mage.abilities.effects.AsThoughManaEffect;
|
||||||
|
import mage.players.ManaPoolItem;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author TheElk801
|
* @author TheElk801
|
||||||
|
@ -69,17 +70,18 @@ class MnemonicBetrayalExileEffect extends OneShotEffect {
|
||||||
}
|
}
|
||||||
Cards cards = new CardsImpl();
|
Cards cards = new CardsImpl();
|
||||||
Map<UUID, Integer> cardMap = new HashMap();
|
Map<UUID, Integer> cardMap = new HashMap();
|
||||||
for (UUID playerId : game.getOpponents(source.getControllerId())) {
|
game.getOpponents(source.getControllerId()).stream().map((playerId) -> game.getPlayer(playerId)).filter((player) -> (player != null)).forEachOrdered((player) -> {
|
||||||
Player player = game.getPlayer(playerId);
|
cards.addAll(player.getGraveyard());
|
||||||
if (player != null) {
|
});
|
||||||
cards.addAll(player.getGraveyard());
|
cards.getCards(game).stream().map((card) -> {
|
||||||
}
|
|
||||||
}
|
|
||||||
for (Card card : cards.getCards(game)) {
|
|
||||||
cardMap.put(card.getId(), card.getZoneChangeCounter(game));
|
cardMap.put(card.getId(), card.getZoneChangeCounter(game));
|
||||||
|
return card;
|
||||||
|
}).map((card) -> {
|
||||||
game.addEffect(new MnemonicBetrayalCastFromExileEffect(card, game), source);
|
game.addEffect(new MnemonicBetrayalCastFromExileEffect(card, game), source);
|
||||||
|
return card;
|
||||||
|
}).forEachOrdered((card) -> {
|
||||||
game.addEffect(new MnemonicBetrayalAnyColorEffect(card, game), source);
|
game.addEffect(new MnemonicBetrayalAnyColorEffect(card, game), source);
|
||||||
}
|
});
|
||||||
controller.moveCardsToExile(cards.getCards(game), source, game, true, source.getSourceId(), source.getSourceObjectIfItStillExists(game).getName());
|
controller.moveCardsToExile(cards.getCards(game), source, game, true, source.getSourceId(), source.getSourceObjectIfItStillExists(game).getName());
|
||||||
game.addDelayedTriggeredAbility(new MnemonicBetrayalDelayedTriggeredAbility(cards, cardMap), source);
|
game.addDelayedTriggeredAbility(new MnemonicBetrayalDelayedTriggeredAbility(cards, cardMap), source);
|
||||||
return true;
|
return true;
|
||||||
|
@ -125,7 +127,7 @@ class MnemonicBetrayalCastFromExileEffect extends AsThoughEffectImpl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class MnemonicBetrayalAnyColorEffect extends AsThoughEffectImpl {
|
class MnemonicBetrayalAnyColorEffect extends AsThoughEffectImpl implements AsThoughManaEffect {
|
||||||
|
|
||||||
private final Card card;
|
private final Card card;
|
||||||
private final int zoneCounter;
|
private final int zoneCounter;
|
||||||
|
@ -154,13 +156,21 @@ class MnemonicBetrayalAnyColorEffect extends AsThoughEffectImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
|
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
|
||||||
if (card.getZoneChangeCounter(game) != zoneCounter) {
|
if (objectId.equals(card.getId())
|
||||||
this.discard();
|
&& card.getZoneChangeCounter(game) <= zoneCounter + 1
|
||||||
return false;
|
&& affectedControllerId.equals(source.getControllerId())) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
if (objectId.equals(card.getId())) {
|
||||||
|
this.discard();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return objectId.equals(card.getId())
|
return false;
|
||||||
&& card.getZoneChangeCounter(game) == zoneCounter
|
}
|
||||||
&& affectedControllerId.equals(source.getControllerId());
|
|
||||||
|
@Override
|
||||||
|
public ManaType getAsThoughManaType(ManaType manaType, ManaPoolItem mana, UUID affectedControllerId, Ability source, Game game) {
|
||||||
|
return mana.getFirstAvailable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,12 +250,10 @@ class MnemonicBetrayalReturnEffect extends OneShotEffect {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Cards cardsToReturn = new CardsImpl();
|
Cards cardsToReturn = new CardsImpl();
|
||||||
for (Card card : cards.getCards(game)) {
|
cards.getCards(game).stream().filter((card) -> (game.getState().getZone(card.getId()) == Zone.EXILED
|
||||||
if (game.getState().getZone(card.getId()) == Zone.EXILED
|
&& card.getZoneChangeCounter(game) == cardMap.getOrDefault(card.getId(), -5) + 1)).forEachOrdered((card) -> {
|
||||||
&& card.getZoneChangeCounter(game) == cardMap.getOrDefault(card.getId(), -5) + 1) {
|
cardsToReturn.add(card);
|
||||||
cardsToReturn.add(card);
|
});
|
||||||
}
|
|
||||||
}
|
|
||||||
return player.moveCards(cardsToReturn, Zone.GRAVEYARD, source, game);
|
return player.moveCards(cardsToReturn, Zone.GRAVEYARD, source, game);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue