mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
- Fixed #5695
This commit is contained in:
parent
53fbe7e502
commit
9f70a0ea85
1 changed files with 44 additions and 25 deletions
|
@ -19,10 +19,11 @@ import mage.constants.TargetController;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.filter.common.FilterCreatureCard;
|
import mage.filter.common.FilterCreatureCard;
|
||||||
import mage.filter.predicate.other.OwnerIdPredicate;
|
import mage.filter.predicate.other.OwnerIdPredicate;
|
||||||
|
import mage.filter.predicate.other.OwnerPredicate;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
import mage.target.TargetCard;
|
||||||
import mage.target.common.TargetCardInGraveyard;
|
import mage.target.common.TargetCardInGraveyard;
|
||||||
import mage.target.common.TargetCardInOpponentsGraveyard;
|
|
||||||
import mage.target.common.TargetOpponent;
|
import mage.target.common.TargetOpponent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -86,41 +87,55 @@ class DawnbreakReclaimerEffect extends OneShotEffect {
|
||||||
*/
|
*/
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
MageObject sourceObject = source.getSourceObject(game);
|
MageObject sourceObject = source.getSourceObject(game);
|
||||||
if (controller != null && sourceObject != null) {
|
if (controller != null
|
||||||
TargetCardInOpponentsGraveyard targetOpponentGraveyard = new TargetCardInOpponentsGraveyard(new FilterCreatureCard("a creature card in an opponent's graveyard"));
|
&& sourceObject != null) {
|
||||||
targetOpponentGraveyard.setNotTarget(true);
|
FilterCreatureCard filter = new FilterCreatureCard("a creature card in an opponent's graveyard");
|
||||||
|
filter.add(new OwnerPredicate(TargetController.OPPONENT));
|
||||||
|
TargetCard chosenCreatureOpponentGraveyard = new TargetCard(Zone.GRAVEYARD, filter);
|
||||||
Player opponent = null;
|
Player opponent = null;
|
||||||
Card cardOpponentGraveyard = null;
|
Card cardOpponentGraveyard = null;
|
||||||
targetOpponentGraveyard.setNotTarget(true);
|
chosenCreatureOpponentGraveyard.setNotTarget(true);
|
||||||
if (targetOpponentGraveyard.canChoose(source.getSourceId(), source.getControllerId(), game)) {
|
if (chosenCreatureOpponentGraveyard.canChoose(source.getSourceId(), source.getControllerId(), game)) {
|
||||||
controller.choose(Outcome.Detriment, targetOpponentGraveyard, source.getSourceId(), game);
|
controller.choose(Outcome.Detriment, chosenCreatureOpponentGraveyard, source.getSourceId(), game);
|
||||||
cardOpponentGraveyard = game.getCard(targetOpponentGraveyard.getFirstTarget());
|
cardOpponentGraveyard = game.getCard(chosenCreatureOpponentGraveyard.getFirstTarget());
|
||||||
if (cardOpponentGraveyard != null) {
|
if (cardOpponentGraveyard != null) {
|
||||||
opponent = game.getPlayer(cardOpponentGraveyard.getOwnerId());
|
opponent = game.getPlayer(cardOpponentGraveyard.getOwnerId());
|
||||||
game.informPlayers(sourceObject.getLogName() + ": " + controller.getLogName() + " has chosen " + cardOpponentGraveyard.getIdName() + " of " + opponent.getLogName());
|
game.informPlayers(sourceObject.getLogName()
|
||||||
|
+ ": " + controller.getLogName()
|
||||||
|
+ " has chosen "
|
||||||
|
+ cardOpponentGraveyard.getIdName()
|
||||||
|
+ " of " + opponent.getLogName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (opponent == null) {
|
if (opponent == null) {
|
||||||
// if no card from opponent was available controller has to chose an opponent to select a creature card in controllers graveyard
|
// if no card from opponent was available controller has to chose an opponent to select a creature card in controllers graveyard
|
||||||
TargetOpponent targetOpponent = new TargetOpponent(true);
|
TargetOpponent targetOpponent = new TargetOpponent(true);
|
||||||
targetOpponent.setNotTarget(true);
|
|
||||||
controller.choose(outcome, targetOpponent, source.getSourceId(), game);
|
controller.choose(outcome, targetOpponent, source.getSourceId(), game);
|
||||||
opponent = game.getPlayer(targetOpponent.getFirstTarget());
|
opponent = game.getPlayer(targetOpponent.getFirstTarget());
|
||||||
if (opponent != null) {
|
if (opponent != null) {
|
||||||
game.informPlayers(sourceObject.getLogName() + ": " + controller.getLogName() + " has chosen " + opponent.getLogName() + " to select a creature card from their graveyard");
|
game.informPlayers(sourceObject.getLogName()
|
||||||
|
+ ": " + controller.getLogName()
|
||||||
|
+ " has chosen "
|
||||||
|
+ opponent.getLogName()
|
||||||
|
+ " to select a creature card from their graveyard");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (opponent != null) {
|
if (opponent != null) {
|
||||||
FilterCreatureCard filter = new FilterCreatureCard("a creature card in " + controller.getName() + "'s the graveyard");
|
FilterCreatureCard filterCreatureCard =
|
||||||
filter.add(new OwnerIdPredicate(controller.getId()));
|
new FilterCreatureCard("a creature card in " + controller.getName() + "'s the graveyard");
|
||||||
TargetCardInGraveyard targetControllerGaveyard = new TargetCardInGraveyard(filter);
|
filterCreatureCard.add(new OwnerIdPredicate(controller.getId()));
|
||||||
|
TargetCardInGraveyard targetControllerGaveyard = new TargetCardInGraveyard(filterCreatureCard);
|
||||||
targetControllerGaveyard.setNotTarget(true);
|
targetControllerGaveyard.setNotTarget(true);
|
||||||
Card controllerCreatureCard = null;
|
Card controllerCreatureCard = null;
|
||||||
if (targetControllerGaveyard.canChoose(source.getSourceId(), opponent.getId(), game)
|
if (targetControllerGaveyard.canChoose(source.getSourceId(), opponent.getId(), game)
|
||||||
&& opponent.choose(outcome, targetControllerGaveyard, source.getSourceId(), game)) {
|
&& opponent.choose(outcome, targetControllerGaveyard, source.getSourceId(), game)) {
|
||||||
controllerCreatureCard = game.getCard(targetControllerGaveyard.getFirstTarget());
|
controllerCreatureCard = game.getCard(targetControllerGaveyard.getFirstTarget());
|
||||||
if (controllerCreatureCard != null) {
|
if (controllerCreatureCard != null) {
|
||||||
game.informPlayers(sourceObject.getLogName() + ": " + opponent.getLogName() + " has chosen " + controllerCreatureCard.getIdName() + " of " + controller.getLogName());
|
game.informPlayers(sourceObject.getLogName()
|
||||||
|
+ ": " + opponent.getLogName()
|
||||||
|
+ " has chosen "
|
||||||
|
+ controllerCreatureCard.getIdName()
|
||||||
|
+ " of " + controller.getLogName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Set<Card> cards = new HashSet<>();
|
Set<Card> cards = new HashSet<>();
|
||||||
|
@ -134,7 +149,11 @@ class DawnbreakReclaimerEffect extends OneShotEffect {
|
||||||
if (controller.chooseUse(
|
if (controller.chooseUse(
|
||||||
outcome,
|
outcome,
|
||||||
"Return those cards to the battlefield under their owners' control?",
|
"Return those cards to the battlefield under their owners' control?",
|
||||||
"Opponent's creature card: " + (cardOpponentGraveyard == null ? "none" : cardOpponentGraveyard.getLogName()) + ", your creature card: " + (controllerCreatureCard == null ? "none" : controllerCreatureCard.getLogName()),
|
"Opponent's creature card: "
|
||||||
|
+ (cardOpponentGraveyard == null
|
||||||
|
? "none" : cardOpponentGraveyard.getLogName())
|
||||||
|
+ ", your creature card: " + (controllerCreatureCard == null
|
||||||
|
? "none" : controllerCreatureCard.getLogName()),
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
source,
|
source,
|
||||||
|
|
Loading…
Reference in a new issue