mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
Fixed Hoarding Dragon
This commit is contained in:
parent
ee4fb2bc50
commit
3b024f312e
1 changed files with 12 additions and 15 deletions
|
@ -35,14 +35,14 @@ import mage.Constants.Rarity;
|
||||||
import mage.Constants.Zone;
|
import mage.Constants.Zone;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
|
||||||
import mage.abilities.common.DiesTriggeredAbility;
|
import mage.abilities.common.DiesTriggeredAbility;
|
||||||
|
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.abilities.effects.common.ReturnFromExileEffect;
|
import mage.abilities.effects.common.ReturnFromExileEffect;
|
||||||
import mage.abilities.keyword.FlyingAbility;
|
import mage.abilities.keyword.FlyingAbility;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.filter.FilterCard;
|
import mage.filter.common.FilterArtifactCard;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.common.TargetCardInLibrary;
|
import mage.target.common.TargetCardInLibrary;
|
||||||
|
@ -53,12 +53,6 @@ import mage.target.common.TargetCardInLibrary;
|
||||||
*/
|
*/
|
||||||
public class HoardingDragon extends CardImpl<HoardingDragon> {
|
public class HoardingDragon extends CardImpl<HoardingDragon> {
|
||||||
|
|
||||||
private static final FilterCard filter = new FilterCard();
|
|
||||||
|
|
||||||
static {
|
|
||||||
filter.getCardType().add(CardType.ARTIFACT);
|
|
||||||
}
|
|
||||||
|
|
||||||
public HoardingDragon(UUID ownerId) {
|
public HoardingDragon(UUID ownerId) {
|
||||||
super(ownerId, 144, "Hoarding Dragon", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{3}{R}{R}");
|
super(ownerId, 144, "Hoarding Dragon", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{3}{R}{R}");
|
||||||
this.expansionSetCode = "M11";
|
this.expansionSetCode = "M11";
|
||||||
|
@ -68,8 +62,12 @@ public class HoardingDragon extends CardImpl<HoardingDragon> {
|
||||||
this.toughness = new MageInt(4);
|
this.toughness = new MageInt(4);
|
||||||
|
|
||||||
this.addAbility(FlyingAbility.getInstance());
|
this.addAbility(FlyingAbility.getInstance());
|
||||||
|
|
||||||
|
// When Hoarding Dragon enters the battlefield, you may search your library for an artifact card, exile it, then shuffle your library.
|
||||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new HoardingDragonEffect(this.getId()), true));
|
this.addAbility(new EntersBattlefieldTriggeredAbility(new HoardingDragonEffect(this.getId()), true));
|
||||||
this.addAbility(new DiesTriggeredAbility(new ReturnFromExileEffect(this.getId(), Zone.BATTLEFIELD), false));
|
|
||||||
|
// When Hoarding Dragon dies, you may put the exiled card into its owner's hand.
|
||||||
|
this.addAbility(new DiesTriggeredAbility(new ReturnFromExileEffect(this.getId(), Zone.HAND), false));
|
||||||
}
|
}
|
||||||
|
|
||||||
public HoardingDragon(final HoardingDragon card) {
|
public HoardingDragon(final HoardingDragon card) {
|
||||||
|
@ -85,31 +83,30 @@ public class HoardingDragon extends CardImpl<HoardingDragon> {
|
||||||
|
|
||||||
class HoardingDragonEffect extends OneShotEffect<HoardingDragonEffect> {
|
class HoardingDragonEffect extends OneShotEffect<HoardingDragonEffect> {
|
||||||
|
|
||||||
protected UUID exileId;
|
private UUID exileId;
|
||||||
protected TargetCardInLibrary target;
|
|
||||||
|
|
||||||
public HoardingDragonEffect(UUID exileId) {
|
public HoardingDragonEffect(UUID exileId) {
|
||||||
super(Outcome.Exile);
|
super(Outcome.Exile);
|
||||||
this.exileId = exileId;
|
this.exileId = exileId;
|
||||||
target = new TargetCardInLibrary();
|
this.staticText = "When {this} enters the battlefield, you may search your library for an artifact card, exile it, then shuffle your library";
|
||||||
staticText = "When {this} enters the battlefield, you may search your library for an artifact card, exile it, then shuffle your library";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public HoardingDragonEffect(final HoardingDragonEffect effect) {
|
public HoardingDragonEffect(final HoardingDragonEffect effect) {
|
||||||
super(effect);
|
super(effect);
|
||||||
this.exileId = effect.exileId;
|
this.exileId = effect.exileId;
|
||||||
this.target = effect.target.copy();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player player = game.getPlayer(source.getControllerId());
|
Player player = game.getPlayer(source.getControllerId());
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
|
TargetCardInLibrary target = new TargetCardInLibrary(new FilterArtifactCard());
|
||||||
if (player.searchLibrary(target, game)) {
|
if (player.searchLibrary(target, game)) {
|
||||||
if (target.getTargets().size() > 0) {
|
if (target.getTargets().size() > 0) {
|
||||||
Card card = player.getLibrary().getCard(target.getFirstTarget(), game);
|
Card card = player.getLibrary().getCard(target.getFirstTarget(), game);
|
||||||
if (card != null)
|
if (card != null) {
|
||||||
card.moveToExile(exileId, "Hoarding Dragon exile", source.getSourceId(), game);
|
card.moveToExile(exileId, "Hoarding Dragon exile", source.getSourceId(), game);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
player.shuffleLibrary(game);
|
player.shuffleLibrary(game);
|
||||||
|
|
Loading…
Reference in a new issue