forked from External/mage
...
This commit is contained in:
parent
df642c2bd5
commit
3fa0e8b8f4
544 changed files with 13327 additions and 3074 deletions
|
|
@ -28,11 +28,12 @@
|
|||
|
||||
package mage.abilities.effects.common;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.Constants.Outcome;
|
||||
import mage.Constants.Zone;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.SearchEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
|
|
@ -44,23 +45,29 @@ import mage.target.common.TargetCardInLibrary;
|
|||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class SearchLibraryRevealPutInHandEffect extends OneShotEffect {
|
||||
|
||||
private TargetCardInLibrary target;
|
||||
public class SearchLibraryRevealPutInHandEffect extends SearchEffect<SearchLibraryRevealPutInHandEffect> {
|
||||
|
||||
public SearchLibraryRevealPutInHandEffect(TargetCardInLibrary target) {
|
||||
super(Outcome.DrawCard);
|
||||
this.target = target;
|
||||
super(target, Outcome.DrawCard);
|
||||
}
|
||||
|
||||
public SearchLibraryRevealPutInHandEffect(final SearchLibraryRevealPutInHandEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game) {
|
||||
Player player = game.getPlayer(this.source.getControllerId());
|
||||
public SearchLibraryRevealPutInHandEffect copy() {
|
||||
return new SearchLibraryRevealPutInHandEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
player.searchLibrary(target, game);
|
||||
if (target.getTargets().size() > 0) {
|
||||
Cards revealed = new CardsImpl(Zone.REVEALED);
|
||||
for (UUID cardId: target.getTargets()) {
|
||||
Card card = player.getLibrary().remove(cardId);
|
||||
Cards revealed = new CardsImpl();
|
||||
for (UUID cardId: (List<UUID>)target.getTargets()) {
|
||||
Card card = player.getLibrary().remove(cardId, game);
|
||||
if (card != null) {
|
||||
player.putInHand(card, game);
|
||||
revealed.add(card);
|
||||
|
|
@ -73,7 +80,7 @@ public class SearchLibraryRevealPutInHandEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getText() {
|
||||
public String getText(Ability source) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Search your library for ");
|
||||
if (target.getNumberOfTargets() == 0 && target.getMaxNumberOfTargets() > 0) {
|
||||
|
|
@ -88,10 +95,10 @@ public class SearchLibraryRevealPutInHandEffect extends OneShotEffect {
|
|||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSource(Ability ability) {
|
||||
super.setSource(ability);
|
||||
target.setAbility(ability);
|
||||
}
|
||||
// @Override
|
||||
// public void setSource(Ability ability) {
|
||||
// super.setSource(ability);
|
||||
// target.setAbility(ability);
|
||||
// }
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue