mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
* Commune with the Gods - Fixed that it was not possible to select none of the cards to go to hand.
This commit is contained in:
parent
078d6fb3c6
commit
bb10022ab5
1 changed files with 12 additions and 10 deletions
|
@ -28,6 +28,7 @@
|
||||||
package mage.sets.theros;
|
package mage.sets.theros;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import mage.MageObject;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
|
@ -95,14 +96,15 @@ class CommuneWithTheGodsEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player player = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
if (player != null) {
|
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||||
Cards cards = new CardsImpl(Zone.PICK);
|
if (sourceObject != null && controller != null) {
|
||||||
|
Cards cards = new CardsImpl();
|
||||||
|
|
||||||
boolean properCardFound = false;
|
boolean properCardFound = false;
|
||||||
int count = Math.min(player.getLibrary().size(), 5);
|
int count = Math.min(controller.getLibrary().size(), 5);
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
Card card = player.getLibrary().removeFromTop(game);
|
Card card = controller.getLibrary().removeFromTop(game);
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
cards.add(card);
|
cards.add(card);
|
||||||
if (filterPutInHand.match(card, source.getSourceId(), source.getControllerId(), game)) {
|
if (filterPutInHand.match(card, source.getSourceId(), source.getControllerId(), game)) {
|
||||||
|
@ -112,13 +114,13 @@ class CommuneWithTheGodsEffect extends OneShotEffect {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cards.isEmpty()) {
|
if (!cards.isEmpty()) {
|
||||||
player.revealCards("Commune with the Gods", cards, game);
|
controller.revealCards(sourceObject.getLogName(), cards, game);
|
||||||
TargetCard target = new TargetCard(Zone.PICK, filterPutInHand);
|
TargetCard target = new TargetCard(0, 1, Zone.LIBRARY, filterPutInHand);
|
||||||
if (properCardFound && player.choose(Outcome.DrawCard, cards, target, game)) {
|
if (properCardFound && controller.choose(Outcome.DrawCard, cards, target, game)) {
|
||||||
Card card = game.getCard(target.getFirstTarget());
|
Card card = game.getCard(target.getFirstTarget());
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
cards.remove(card);
|
cards.remove(card);
|
||||||
card.moveToZone(Zone.HAND, source.getSourceId(), game, false);
|
controller.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.LIBRARY);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -126,7 +128,7 @@ class CommuneWithTheGodsEffect extends OneShotEffect {
|
||||||
for (UUID cardId : cards) {
|
for (UUID cardId : cards) {
|
||||||
Card card = game.getCard(cardId);
|
Card card = game.getCard(cardId);
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
card.moveToZone(Zone.GRAVEYARD, source.getSourceId(), game, true);
|
controller.moveCardToGraveyardWithInfo(card, source.getSourceId(), game, Zone.LIBRARY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue