- Added final part to Mwonvuli Beast Tracker.

This commit is contained in:
jeffwadsworth 2012-07-20 13:09:52 -05:00
parent a6e30a20d0
commit bf3d16332d
2 changed files with 25 additions and 4 deletions

View file

@ -72,7 +72,7 @@ public class MwonvuliBeastTracker extends CardImpl<MwonvuliBeastTracker> {
this.toughness = new MageInt(1);
// When Mwonvuli Beast Tracker enters the battlefield, search your library for a creature card with deathtouch, hexproof, reach, or trample and reveal it. Shuffle your library and put that card on top of it.
this.addAbility(new EntersBattlefieldTriggeredAbility(new SearchLibraryPutOnLibraryEffect(new TargetCardInLibrary(filter))));
this.addAbility(new EntersBattlefieldTriggeredAbility(new SearchLibraryPutOnLibraryEffect(new TargetCardInLibrary(filter), true, true)));
}
public MwonvuliBeastTracker(final MwonvuliBeastTracker card) {

View file

@ -36,6 +36,8 @@ import mage.Constants.Zone;
import mage.abilities.Ability;
import mage.abilities.effects.SearchEffect;
import mage.cards.Card;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetCardInLibrary;
@ -45,14 +47,25 @@ import mage.target.common.TargetCardInLibrary;
* @author BetaSteward_at_googlemail.com
*/
public class SearchLibraryPutOnLibraryEffect extends SearchEffect<SearchLibraryPutOnLibraryEffect> {
private boolean reveal;
private boolean forceShuffle;
public SearchLibraryPutOnLibraryEffect(TargetCardInLibrary target) {
this(target, false, true);
setText();
}
public SearchLibraryPutOnLibraryEffect(TargetCardInLibrary target, boolean reveal, boolean forceShuffle) {
super(target, Outcome.DrawCard);
this.reveal = reveal;
this.forceShuffle = forceShuffle;
setText();
}
public SearchLibraryPutOnLibraryEffect(final SearchLibraryPutOnLibraryEffect effect) {
super(effect);
this.reveal = effect.reveal;
}
@Override
@ -72,14 +85,22 @@ public class SearchLibraryPutOnLibraryEffect extends SearchEffect<SearchLibraryP
if (card != null)
cards.add(card);
}
player.shuffleLibrary(game);
Cards foundCards = new CardsImpl();
foundCards.addAll(cards);
if (reveal) {
player.revealCards("Revealed", foundCards, game);
}
if (forceShuffle) {
player.shuffleLibrary(game);
}
for (Card card: cards) {
card.moveToZone(Zone.LIBRARY, source.getId(), game, true);
}
return true;
}
// shuffle anyway
player.shuffleLibrary(game);
// shuffle
if (forceShuffle)
player.shuffleLibrary(game);
return false;
}