mirror of
https://github.com/magefree/mage.git
synced 2025-12-21 19:11:59 -08:00
fixed search library
This commit is contained in:
parent
46656f19b5
commit
8187b250d2
4 changed files with 8 additions and 6 deletions
|
|
@ -30,6 +30,7 @@ package mage.abilities.effects;
|
||||||
|
|
||||||
import mage.Constants.Outcome;
|
import mage.Constants.Outcome;
|
||||||
import mage.target.TargetCard;
|
import mage.target.TargetCard;
|
||||||
|
import mage.target.common.TargetCardInLibrary;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -37,9 +38,9 @@ import mage.target.TargetCard;
|
||||||
*/
|
*/
|
||||||
public abstract class SearchEffect<T extends SearchEffect<T>> extends OneShotEffect<T> {
|
public abstract class SearchEffect<T extends SearchEffect<T>> extends OneShotEffect<T> {
|
||||||
|
|
||||||
protected TargetCard target;
|
protected TargetCardInLibrary target;
|
||||||
|
|
||||||
public SearchEffect(TargetCard target, Outcome outcome) {
|
public SearchEffect(TargetCardInLibrary target, Outcome outcome) {
|
||||||
super(outcome);
|
super(outcome);
|
||||||
this.target = target;
|
this.target = target;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,7 @@ import mage.game.permanent.Permanent;
|
||||||
import mage.target.Target;
|
import mage.target.Target;
|
||||||
import mage.target.TargetAmount;
|
import mage.target.TargetAmount;
|
||||||
import mage.target.TargetCard;
|
import mage.target.TargetCard;
|
||||||
|
import mage.target.common.TargetCardInLibrary;
|
||||||
import mage.util.Copyable;
|
import mage.util.Copyable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -96,7 +97,7 @@ public interface Player extends MageItem, Copyable<Player> {
|
||||||
public boolean removeFromBattlefield(Permanent permanent, Game game);
|
public boolean removeFromBattlefield(Permanent permanent, Game game);
|
||||||
public boolean putInGraveyard(Card card, Game game, boolean fromBattlefield);
|
public boolean putInGraveyard(Card card, Game game, boolean fromBattlefield);
|
||||||
public boolean removeFromGraveyard(Card card, Game game);
|
public boolean removeFromGraveyard(Card card, Game game);
|
||||||
public boolean searchLibrary(TargetCard target, Game game);
|
public boolean searchLibrary(TargetCardInLibrary target, Game game);
|
||||||
public boolean canPlayLand();
|
public boolean canPlayLand();
|
||||||
public boolean playLand(Card card, Game game);
|
public boolean playLand(Card card, Game game);
|
||||||
public boolean activateAbility(ActivatedAbility ability, Game game);
|
public boolean activateAbility(ActivatedAbility ability, Game game);
|
||||||
|
|
|
||||||
|
|
@ -812,10 +812,10 @@ public abstract class PlayerImpl<T extends PlayerImpl<T>> implements Player, Ser
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean searchLibrary(TargetCard target, Game game) {
|
public boolean searchLibrary(TargetCardInLibrary target, Game game) {
|
||||||
//20091005 - 701.14c
|
//20091005 - 701.14c
|
||||||
if (!game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.SEARCH_LIBRARY, playerId, playerId))) {
|
if (!game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.SEARCH_LIBRARY, playerId, playerId))) {
|
||||||
TargetCard newTarget;
|
TargetCardInLibrary newTarget;
|
||||||
if (library.count(target.getFilter(), game) < target.getNumberOfTargets())
|
if (library.count(target.getFilter(), game) < target.getNumberOfTargets())
|
||||||
newTarget = new TargetCardInLibrary(library.count(target.getFilter(), game), target.getMaxNumberOfTargets(), target.getFilter());
|
newTarget = new TargetCardInLibrary(library.count(target.getFilter(), game), target.getMaxNumberOfTargets(), target.getFilter());
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ public class TargetCardInLibrary extends TargetCard<TargetCardInLibrary> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean chooseTarget(Outcome outcome, UUID playerId, Ability source, Game game) {
|
public boolean choose(Outcome outcome, UUID playerId, Game game) {
|
||||||
Player player = game.getPlayer(playerId);
|
Player player = game.getPlayer(playerId);
|
||||||
while (!isChosen() && !doneChosing()) {
|
while (!isChosen() && !doneChosing()) {
|
||||||
chosen = targets.size() >= minNumberOfTargets;
|
chosen = targets.size() >= minNumberOfTargets;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue