mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 21:29:17 -08:00
[M11] fixed Hoarding Dragon not returning card to hand (fixes #7670)
This commit is contained in:
parent
c03571d743
commit
1abeec9595
1 changed files with 9 additions and 6 deletions
|
|
@ -15,7 +15,7 @@ import mage.constants.CardType;
|
|||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterArtifactCard;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCardInLibrary;
|
||||
|
|
@ -41,7 +41,8 @@ public final class HoardingDragon extends CardImpl {
|
|||
this.addAbility(new EntersBattlefieldTriggeredAbility(new HoardingDragonEffect(), true));
|
||||
|
||||
// When Hoarding Dragon dies, you may put the exiled card into its owner's hand.
|
||||
this.addAbility(new DiesSourceTriggeredAbility(new ReturnFromExileEffect(Zone.HAND), false));
|
||||
this.addAbility(new DiesSourceTriggeredAbility(new ReturnFromExileEffect(Zone.HAND)
|
||||
.setText("put the exiled card into its owner's hand"), true));
|
||||
}
|
||||
|
||||
private HoardingDragon(final HoardingDragon card) {
|
||||
|
|
@ -59,7 +60,7 @@ class HoardingDragonEffect extends OneShotEffect {
|
|||
|
||||
HoardingDragonEffect() {
|
||||
super(Outcome.Exile);
|
||||
this.staticText = "you may search your library for an artifact card, exile it, then shuffle your library";
|
||||
this.staticText = "search your library for an artifact card, exile it, then shuffle your library";
|
||||
}
|
||||
|
||||
private HoardingDragonEffect(final HoardingDragonEffect effect) {
|
||||
|
|
@ -70,15 +71,17 @@ class HoardingDragonEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject sourceObject = source.getSourceObject(game);
|
||||
UUID exileId = CardUtil.getExileZoneId(game, source);
|
||||
if (controller == null || sourceObject == null) {
|
||||
return false;
|
||||
}
|
||||
TargetCardInLibrary target = new TargetCardInLibrary(new FilterArtifactCard());
|
||||
TargetCardInLibrary target = new TargetCardInLibrary(StaticFilters.FILTER_CARD_ARTIFACT);
|
||||
controller.searchLibrary(target, source, game);
|
||||
Card card = controller.getLibrary().getCard(target.getFirstTarget(), game);
|
||||
if (card != null) {
|
||||
controller.moveCardToExileWithInfo(card, exileId, sourceObject.getIdName(), source, game, Zone.LIBRARY, true);
|
||||
controller.moveCardsToExile(
|
||||
card, source, game, true,
|
||||
CardUtil.getExileZoneId(game, source), sourceObject.getIdName()
|
||||
);
|
||||
}
|
||||
controller.shuffleLibrary(source, game);
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue