mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
refactor cards to new common class
"When a [] enters, you may return this card from your graveyard to the battlefield enchanting that creature"
This commit is contained in:
parent
99189ea7a3
commit
566839ceeb
7 changed files with 100 additions and 252 deletions
|
|
@ -1,27 +1,21 @@
|
|||
|
||||
package mage.cards.d;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldAllTriggeredAbility;
|
||||
import mage.abilities.common.EntersBattlefieldAnyReturnSourceFromGraveyardAttachedToItTriggeredAbility;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.mana.ColoredManaCost;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.effects.common.continuous.BoostEnchantedEffect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect;
|
||||
import mage.abilities.keyword.EnchantAbility;
|
||||
import mage.abilities.keyword.HasteAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.mageobject.ManaValuePredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
|
|
@ -54,7 +48,7 @@ public final class DragonBreath extends CardImpl {
|
|||
this.addAbility(new SimpleActivatedAbility(new BoostEnchantedEffect(1, 0, Duration.EndOfTurn), new ColoredManaCost(ColoredManaSymbol.R)));
|
||||
|
||||
// When a creature with converted mana cost 6 or greater enters the battlefield, you may return Dragon Breath from your graveyard to the battlefield attached to that creature.
|
||||
this.addAbility(new EntersBattlefieldAllTriggeredAbility(Zone.GRAVEYARD, new DragonBreathEffect(), filter, true, SetTargetPointer.PERMANENT));
|
||||
this.addAbility(new EntersBattlefieldAnyReturnSourceFromGraveyardAttachedToItTriggeredAbility(filter));
|
||||
}
|
||||
|
||||
private DragonBreath(final DragonBreath card) {
|
||||
|
|
@ -66,35 +60,3 @@ public final class DragonBreath extends CardImpl {
|
|||
return new DragonBreath(this);
|
||||
}
|
||||
}
|
||||
|
||||
class DragonBreathEffect extends OneShotEffect {
|
||||
|
||||
DragonBreathEffect() {
|
||||
super(Outcome.Benefit);
|
||||
this.staticText = "return {this} from your graveyard to the battlefield attached to that creature";
|
||||
}
|
||||
|
||||
private DragonBreathEffect(final DragonBreathEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DragonBreathEffect copy() {
|
||||
return new DragonBreathEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Card sourceCard = source.getSourceCardIfItStillExists(game);
|
||||
Permanent permanent = game.getPermanent(this.getTargetPointer().getFirst(game, source));
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (sourceCard != null && permanent != null && controller != null) {
|
||||
game.getState().setValue("attachTo:" + sourceCard.getId(), permanent);
|
||||
if (controller.moveCards(sourceCard, Zone.BATTLEFIELD, source, game)) {
|
||||
permanent.addAttachment(sourceCard.getId(), source, game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,28 +1,23 @@
|
|||
|
||||
package mage.cards.d;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldAllTriggeredAbility;
|
||||
import mage.abilities.common.EntersBattlefieldAnyReturnSourceFromGraveyardAttachedToItTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.effects.common.continuous.BoostEnchantedEffect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect;
|
||||
import mage.abilities.keyword.EnchantAbility;
|
||||
import mage.abilities.keyword.TrampleAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.mageobject.ManaValuePredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author escplan9 (Derek Monturo - dmontur1 at gmail dot com)
|
||||
|
|
@ -46,11 +41,13 @@ public final class DragonFangs extends CardImpl {
|
|||
this.addAbility(ability);
|
||||
|
||||
// Enchanted creature gets +1/+1 and has trample.
|
||||
this.addAbility(new SimpleStaticAbility(new BoostEnchantedEffect(1, 1, Duration.WhileOnBattlefield)));
|
||||
this.addAbility(new SimpleStaticAbility(new GainAbilityAttachedEffect(TrampleAbility.getInstance(), AttachmentType.AURA)));
|
||||
ability = new SimpleStaticAbility(new BoostEnchantedEffect(1, 1, Duration.WhileOnBattlefield));
|
||||
ability.addEffect(new GainAbilityAttachedEffect(TrampleAbility.getInstance(), AttachmentType.AURA)
|
||||
.setText("and has trample"));
|
||||
this.addAbility(ability);
|
||||
|
||||
// When a creature with converted mana cost 6 or greater enters the battlefield, you may return Dragon Fangs from your graveyard to the battlefield attached to that creature.
|
||||
this.addAbility(new EntersBattlefieldAllTriggeredAbility(Zone.GRAVEYARD, new DragonFangsEffect(), filter, true, SetTargetPointer.PERMANENT));
|
||||
this.addAbility(new EntersBattlefieldAnyReturnSourceFromGraveyardAttachedToItTriggeredAbility(filter));
|
||||
}
|
||||
|
||||
private DragonFangs(final DragonFangs card) {
|
||||
|
|
@ -62,35 +59,3 @@ public final class DragonFangs extends CardImpl {
|
|||
return new DragonFangs(this);
|
||||
}
|
||||
}
|
||||
|
||||
class DragonFangsEffect extends OneShotEffect {
|
||||
|
||||
DragonFangsEffect() {
|
||||
super(Outcome.Benefit);
|
||||
this.staticText = "return {this} from your graveyard to the battlefield attached to that creature";
|
||||
}
|
||||
|
||||
private DragonFangsEffect(final DragonFangsEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DragonFangsEffect copy() {
|
||||
return new DragonFangsEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Card sourceCard = source.getSourceCardIfItStillExists(game);
|
||||
Permanent permanent = game.getPermanent(this.getTargetPointer().getFirst(game, source));
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (sourceCard != null && permanent != null && controller != null) {
|
||||
game.getState().setValue("attachTo:" + sourceCard.getId(), permanent);
|
||||
if (controller.moveCards(sourceCard, Zone.BATTLEFIELD, source, game)) {
|
||||
permanent.addAttachment(sourceCard.getId(), source, game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,28 +1,23 @@
|
|||
|
||||
package mage.cards.d;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldAllTriggeredAbility;
|
||||
import mage.abilities.common.EntersBattlefieldAnyReturnSourceFromGraveyardAttachedToItTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.effects.common.continuous.BoostEnchantedEffect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect;
|
||||
import mage.abilities.keyword.EnchantAbility;
|
||||
import mage.abilities.keyword.VigilanceAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.mageobject.ManaValuePredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author escplan9 (Derek Monturo - dmontur1 at gmail dot com)
|
||||
|
|
@ -45,12 +40,14 @@ public final class DragonScales extends CardImpl {
|
|||
Ability ability = new EnchantAbility(auraTarget);
|
||||
this.addAbility(ability);
|
||||
|
||||
// Enchanted creature gets +1/+2 and has vigilance.
|
||||
this.addAbility(new SimpleStaticAbility(new BoostEnchantedEffect(1, 2, Duration.WhileOnBattlefield)));
|
||||
this.addAbility(new SimpleStaticAbility(new GainAbilityAttachedEffect(VigilanceAbility.getInstance(), AttachmentType.AURA)));
|
||||
// Enchanted creature gets +1/+2 and has vigilance.
|
||||
ability = new SimpleStaticAbility(new BoostEnchantedEffect(1, 2, Duration.WhileOnBattlefield));
|
||||
ability.addEffect(new GainAbilityAttachedEffect(VigilanceAbility.getInstance(), AttachmentType.AURA)
|
||||
.setText("and has vigilance"));
|
||||
this.addAbility(ability);
|
||||
|
||||
// When a creature with converted mana cost 6 or greater enters the battlefield, you may return Dragon Scales from your graveyard to the battlefield attached to that creature.
|
||||
this.addAbility(new EntersBattlefieldAllTriggeredAbility(Zone.GRAVEYARD, new DragonScalesEffect(), filter, true, SetTargetPointer.PERMANENT));
|
||||
this.addAbility(new EntersBattlefieldAnyReturnSourceFromGraveyardAttachedToItTriggeredAbility(filter));
|
||||
}
|
||||
|
||||
private DragonScales(final DragonScales card) {
|
||||
|
|
@ -62,35 +59,3 @@ public final class DragonScales extends CardImpl {
|
|||
return new DragonScales(this);
|
||||
}
|
||||
}
|
||||
|
||||
class DragonScalesEffect extends OneShotEffect {
|
||||
|
||||
DragonScalesEffect() {
|
||||
super(Outcome.Benefit);
|
||||
this.staticText = "return {this} from your graveyard to the battlefield attached to that creature";
|
||||
}
|
||||
|
||||
private DragonScalesEffect(final DragonScalesEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DragonScalesEffect copy() {
|
||||
return new DragonScalesEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Card sourceCard = source.getSourceCardIfItStillExists(game);
|
||||
Permanent permanent = game.getPermanent(this.getTargetPointer().getFirst(game, source));
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (sourceCard != null && permanent != null && controller != null) {
|
||||
game.getState().setValue("attachTo:" + sourceCard.getId(), permanent);
|
||||
if (controller.moveCards(sourceCard, Zone.BATTLEFIELD, source, game)) {
|
||||
permanent.addAttachment(sourceCard.getId(), source, game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,28 +1,23 @@
|
|||
|
||||
package mage.cards.d;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldAllTriggeredAbility;
|
||||
import mage.abilities.common.EntersBattlefieldAnyReturnSourceFromGraveyardAttachedToItTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.effects.common.continuous.BoostEnchantedEffect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect;
|
||||
import mage.abilities.keyword.EnchantAbility;
|
||||
import mage.abilities.keyword.FearAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.mageobject.ManaValuePredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author escplan9 (Derek Monturo - dmontur1 at gmail dot com)
|
||||
|
|
@ -46,11 +41,13 @@ public final class DragonShadow extends CardImpl {
|
|||
this.addAbility(ability);
|
||||
|
||||
// Enchanted creature gets +1/+0 and has fear.
|
||||
this.addAbility(new SimpleStaticAbility(new BoostEnchantedEffect(1, 0, Duration.WhileOnBattlefield)));
|
||||
this.addAbility(new SimpleStaticAbility(new GainAbilityAttachedEffect(FearAbility.getInstance(), AttachmentType.AURA)));
|
||||
ability = new SimpleStaticAbility(new BoostEnchantedEffect(1, 0, Duration.WhileOnBattlefield));
|
||||
ability.addEffect(new GainAbilityAttachedEffect(FearAbility.getInstance(), AttachmentType.AURA)
|
||||
.setText("and has fear"));
|
||||
this.addAbility(ability);
|
||||
|
||||
// When a creature with converted mana cost 6 or greater enters the battlefield, you may return Dragon Breath from your graveyard to the battlefield attached to that creature.
|
||||
this.addAbility(new EntersBattlefieldAllTriggeredAbility(Zone.GRAVEYARD, new DragonShadowEffect(), filter, true, SetTargetPointer.PERMANENT));
|
||||
this.addAbility(new EntersBattlefieldAnyReturnSourceFromGraveyardAttachedToItTriggeredAbility(filter));
|
||||
}
|
||||
|
||||
private DragonShadow(final DragonShadow card) {
|
||||
|
|
@ -62,35 +59,3 @@ public final class DragonShadow extends CardImpl {
|
|||
return new DragonShadow(this);
|
||||
}
|
||||
}
|
||||
|
||||
class DragonShadowEffect extends OneShotEffect {
|
||||
|
||||
DragonShadowEffect() {
|
||||
super(Outcome.Benefit);
|
||||
this.staticText = "return {this} from your graveyard to the battlefield attached to that creature";
|
||||
}
|
||||
|
||||
private DragonShadowEffect(final DragonShadowEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DragonShadowEffect copy() {
|
||||
return new DragonShadowEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Card sourceCard = source.getSourceCardIfItStillExists(game);
|
||||
Permanent permanent = game.getPermanent(this.getTargetPointer().getFirst(game, source));
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (sourceCard != null && permanent != null && controller != null) {
|
||||
game.getState().setValue("attachTo:" + sourceCard.getId(), permanent);
|
||||
if (controller.moveCards(sourceCard, Zone.BATTLEFIELD, source, game)) {
|
||||
permanent.addAttachment(sourceCard.getId(), source, game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,24 +3,19 @@ package mage.cards.d;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldAllTriggeredAbility;
|
||||
import mage.abilities.common.EntersBattlefieldAnyReturnSourceFromGraveyardAttachedToItTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect;
|
||||
import mage.abilities.keyword.CyclingAbility;
|
||||
import mage.abilities.keyword.EnchantAbility;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.mageobject.ManaValuePredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
|
|
@ -52,7 +47,7 @@ public final class DragonWings extends CardImpl {
|
|||
this.addAbility(new CyclingAbility(new ManaCostsImpl<>("{1}{U}")));
|
||||
|
||||
// When a creature with converted mana cost 6 or greater enters the battlefield, you may return Dragon Breath from your graveyard to the battlefield attached to that creature.
|
||||
this.addAbility(new EntersBattlefieldAllTriggeredAbility(Zone.GRAVEYARD, new DragonWingsEffect(), filter, true, SetTargetPointer.PERMANENT));
|
||||
this.addAbility(new EntersBattlefieldAnyReturnSourceFromGraveyardAttachedToItTriggeredAbility(filter));
|
||||
}
|
||||
|
||||
private DragonWings(final DragonWings card) {
|
||||
|
|
@ -64,35 +59,3 @@ public final class DragonWings extends CardImpl {
|
|||
return new DragonWings(this);
|
||||
}
|
||||
}
|
||||
|
||||
class DragonWingsEffect extends OneShotEffect {
|
||||
|
||||
DragonWingsEffect() {
|
||||
super(Outcome.Benefit);
|
||||
this.staticText = "return {this} from your graveyard to the battlefield attached to that creature";
|
||||
}
|
||||
|
||||
private DragonWingsEffect(final DragonWingsEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DragonWingsEffect copy() {
|
||||
return new DragonWingsEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Card sourceCard = source.getSourceCardIfItStillExists(game);
|
||||
Permanent permanent = game.getPermanent(this.getTargetPointer().getFirst(game, source));
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (sourceCard != null && permanent != null && controller != null) {
|
||||
game.getState().setValue("attachTo:" + sourceCard.getId(), permanent);
|
||||
if (controller.moveCards(sourceCard, Zone.BATTLEFIELD, source, game)) {
|
||||
permanent.addAttachment(sourceCard.getId(), source, game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,22 +1,18 @@
|
|||
package mage.cards.s;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
|
||||
import mage.abilities.common.EntersBattlefieldAnyReturnSourceFromGraveyardAttachedToItTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.effects.common.continuous.BoostEnchantedEffect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect;
|
||||
import mage.abilities.keyword.EnchantAbility;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.filter.common.FilterControlledPermanent;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
|
|
@ -27,7 +23,7 @@ import java.util.UUID;
|
|||
*/
|
||||
public final class SmokeShroud extends CardImpl {
|
||||
|
||||
private static final FilterPermanent filter = new FilterPermanent(SubType.NINJA, "a Ninja");
|
||||
private static final FilterPermanent filter = new FilterControlledPermanent(SubType.NINJA, "a Ninja you control");
|
||||
|
||||
public SmokeShroud(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{U}");
|
||||
|
|
@ -49,10 +45,7 @@ public final class SmokeShroud extends CardImpl {
|
|||
this.addAbility(ability);
|
||||
|
||||
// When a Ninja you control enters, you may return Smoke Shroud from your graveyard to the battlefield attached to that creature.
|
||||
this.addAbility(new EntersBattlefieldControlledTriggeredAbility(
|
||||
Zone.GRAVEYARD, new SmokeShroudEffect(), filter, true,
|
||||
SetTargetPointer.PERMANENT
|
||||
).setTriggerPhrase("When a Ninja you control enters, "));
|
||||
this.addAbility(new EntersBattlefieldAnyReturnSourceFromGraveyardAttachedToItTriggeredAbility(filter));
|
||||
}
|
||||
|
||||
private SmokeShroud(final SmokeShroud card) {
|
||||
|
|
@ -64,35 +57,3 @@ public final class SmokeShroud extends CardImpl {
|
|||
return new SmokeShroud(this);
|
||||
}
|
||||
}
|
||||
|
||||
class SmokeShroudEffect extends OneShotEffect {
|
||||
|
||||
SmokeShroudEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "return {this} from your graveyard to the battlefield attached to that creature";
|
||||
}
|
||||
|
||||
private SmokeShroudEffect(final SmokeShroudEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SmokeShroudEffect copy() {
|
||||
return new SmokeShroudEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Card sourceCard = source.getSourceCardIfItStillExists(game);
|
||||
Permanent permanent = game.getPermanent(this.getTargetPointer().getFirst(game, source));
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (sourceCard != null && permanent != null && controller != null) {
|
||||
game.getState().setValue("attachTo:" + sourceCard.getId(), permanent);
|
||||
if (controller.moveCards(sourceCard, Zone.BATTLEFIELD, source, game)) {
|
||||
permanent.addAttachment(sourceCard.getId(), source, game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,67 @@
|
|||
package mage.abilities.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SetTargetPointer;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
/**
|
||||
* "When a [filter] enters, you may return this card from your graveyard to the battlefield attached to that creature"
|
||||
*
|
||||
* @author xenohedron
|
||||
*/
|
||||
public class EntersBattlefieldAnyReturnSourceFromGraveyardAttachedToItTriggeredAbility extends EntersBattlefieldAllTriggeredAbility {
|
||||
|
||||
public EntersBattlefieldAnyReturnSourceFromGraveyardAttachedToItTriggeredAbility(FilterPermanent filter) {
|
||||
super(Zone.GRAVEYARD, new ReturnSourceAttachedToItEffect(), filter, true, SetTargetPointer.PERMANENT);
|
||||
setTriggerPhrase("When " + CardUtil.addArticle(filter.getMessage()) + " enters, ");
|
||||
}
|
||||
|
||||
protected EntersBattlefieldAnyReturnSourceFromGraveyardAttachedToItTriggeredAbility(final EntersBattlefieldAnyReturnSourceFromGraveyardAttachedToItTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntersBattlefieldAnyReturnSourceFromGraveyardAttachedToItTriggeredAbility copy() {
|
||||
return new EntersBattlefieldAnyReturnSourceFromGraveyardAttachedToItTriggeredAbility(this);
|
||||
}
|
||||
}
|
||||
|
||||
class ReturnSourceAttachedToItEffect extends OneShotEffect {
|
||||
|
||||
ReturnSourceAttachedToItEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "return this card from your graveyard to the battlefield attached to that creature";
|
||||
}
|
||||
|
||||
private ReturnSourceAttachedToItEffect(final ReturnSourceAttachedToItEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReturnSourceAttachedToItEffect copy() {
|
||||
return new ReturnSourceAttachedToItEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Card sourceCard = source.getSourceCardIfItStillExists(game);
|
||||
Permanent permanent = game.getPermanent(this.getTargetPointer().getFirst(game, source));
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (sourceCard != null && permanent != null && controller != null) {
|
||||
game.getState().setValue("attachTo:" + sourceCard.getId(), permanent);
|
||||
if (controller.moveCards(sourceCard, Zone.BATTLEFIELD, source, game)) {
|
||||
permanent.addAttachment(sourceCard.getId(), source, game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue