mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
* Satyr Wayfinder - Fixed that the put land card to hand effect was not optional.
This commit is contained in:
parent
09977ec705
commit
e9d31b9265
1 changed files with 11 additions and 18 deletions
|
@ -29,6 +29,7 @@ package mage.sets.bornofthegods;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
|
import mage.MageObject;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
@ -95,25 +96,17 @@ class SatyrWayfinderEffect 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 player = game.getPlayer(source.getControllerId());
|
||||||
if (player != null) {
|
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||||
Cards cards = new CardsImpl(Zone.PICK);
|
if (player != null && sourceObject != null) {
|
||||||
|
Cards cards = new CardsImpl(Zone.LIBRARY);
|
||||||
boolean properCardFound = false;
|
cards.addAll(player.getLibrary().getTopCards(game, 4));
|
||||||
int count = Math.min(player.getLibrary().size(), 4);
|
boolean properCardFound = cards.count(filterPutInHand, source.getControllerId(), source.getSourceId(), game) > 0;
|
||||||
for (int i = 0; i < count; i++) {
|
|
||||||
Card card = player.getLibrary().removeFromTop(game);
|
|
||||||
if (card != null) {
|
|
||||||
cards.add(card);
|
|
||||||
if (filterPutInHand.match(card, source.getSourceId(), source.getControllerId(), game)) {
|
|
||||||
properCardFound = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!cards.isEmpty()) {
|
if (!cards.isEmpty()) {
|
||||||
player.revealCards("Satyr Wayfinder", cards, game);
|
player.revealCards(sourceObject.getLogName(), cards, game);
|
||||||
TargetCard target = new TargetCard(Zone.PICK, filterPutInHand);
|
TargetCard target = new TargetCard(Zone.LIBRARY, filterPutInHand);
|
||||||
if (properCardFound && player.choose(Outcome.DrawCard, cards, target, game)) {
|
if (properCardFound &&
|
||||||
|
player.chooseUse(outcome, "Put a land card into your hand?", game) &&
|
||||||
|
player.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);
|
||||||
|
|
Loading…
Reference in a new issue