mirror of
https://github.com/correl/mage.git
synced 2024-11-15 19:19:33 +00:00
* Thoughtpicker Witch - Fixed a bug that could produce a null pointer exception.
This commit is contained in:
parent
618ee3698b
commit
964bf63524
1 changed files with 13 additions and 17 deletions
|
@ -58,7 +58,7 @@ import mage.target.common.TargetOpponent;
|
|||
public class ThoughtpickerWitch extends CardImpl {
|
||||
|
||||
public ThoughtpickerWitch(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{B}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{B}");
|
||||
this.subtype.add("Human");
|
||||
this.subtype.add("Wizard");
|
||||
|
||||
|
@ -104,19 +104,15 @@ class ThoughtpickerWitchEffect extends OneShotEffect {
|
|||
Player opponent = game.getPlayer(this.getTargetPointer().getFirst(game, source));
|
||||
if (controller != null && opponent != null) {
|
||||
Cards cards = new CardsImpl();
|
||||
int numLooked = Math.min(2, opponent.getLibrary().size());
|
||||
if (numLooked > 0) {
|
||||
for (int i = 0; i < numLooked; i++) {
|
||||
cards.add(opponent.getLibrary().removeFromTop(game));
|
||||
}
|
||||
cards.addAll(opponent.getLibrary().getTopCards(game, 2));
|
||||
if (cards.size() > 0) {
|
||||
TargetCard target = new TargetCardInLibrary(new FilterCard("card to exile"));
|
||||
controller.choose(Outcome.Exile, cards, target, game);
|
||||
if (controller.choose(Outcome.Exile, cards, target, game)) {
|
||||
Card card = cards.get(target.getFirstTarget(), game);
|
||||
if (card != null) {
|
||||
cards.remove(card);
|
||||
opponent.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.LIBRARY, true);
|
||||
if (cards.size() == 1) {
|
||||
card = cards.get(cards.iterator().next(), game);
|
||||
opponent.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.LIBRARY, true, false);
|
||||
opponent.moveCards(card, Zone.EXILED, source, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
Loading…
Reference in a new issue