* Fixed that continuous effects of copied cards with limited duration stop to work as the copied card stops to exist.

This commit is contained in:
LevelX2 2015-04-10 00:39:06 +02:00
parent 7292a1625c
commit d3dba58358
11 changed files with 113 additions and 38 deletions

View file

@ -28,11 +28,10 @@
package mage.sets.magic2012;
import java.util.UUID;
import mage.constants.*;
import mage.abilities.Ability;
import mage.abilities.common.DiesAttachedTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.ReturnToHandSourceEffect;
import mage.abilities.effects.common.continuous.AddCardSubtypeAttachedEffect;
@ -42,6 +41,12 @@ import mage.abilities.keyword.EnchantAbility;
import mage.abilities.keyword.FirstStrikeAbility;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.constants.AttachmentType;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
@ -56,19 +61,27 @@ public class AngelicDestiny extends CardImpl {
this.expansionSetCode = "M12";
this.subtype.add("Aura");
this.color.setWhite(true);
// Enchant creature
TargetPermanent auraTarget = new TargetCreaturePermanent();
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature));
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEnchantedEffect(4, 4, Duration.WhileOnBattlefield)));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(FlyingAbility.getInstance(), AttachmentType.AURA)));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(FirstStrikeAbility.getInstance(), AttachmentType.AURA)));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new AddCardSubtypeAttachedEffect("Angel", Duration.WhileOnBattlefield, AttachmentType.AURA)));
// Enchanted creature gets +4/+4, has flying and first strike, and is an Angel in addition to its other types.
ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEnchantedEffect(4, 4, Duration.WhileOnBattlefield));
Effect effect = new GainAbilityAttachedEffect(FlyingAbility.getInstance(), AttachmentType.AURA);
effect.setText(", has flying");
ability.addEffect(effect);
effect = new GainAbilityAttachedEffect(FirstStrikeAbility.getInstance(), AttachmentType.AURA);
effect.setText("and first strike");
ability.addEffect(effect);
effect = new AddCardSubtypeAttachedEffect("Angel", Duration.WhileOnBattlefield, AttachmentType.AURA);
effect.setText(", and is an Angel in addition to its other types");
ability.addEffect(effect);
this.addAbility(ability);
// When enchanted creature dies, return Angelic Destiny to its owner's hand.
this.addAbility(new DiesAttachedTriggeredAbility(new ReturnToHandSourceEffect(), "enchanted creature"));
}

View file

@ -62,7 +62,7 @@ public class IsochronScepter extends CardImpl {
this.expansionSetCode = "MRD";
// Imprint - When Isochron Scepter enters the battlefield, you may exile an instant card with converted mana cost 2 or less from your hand.
this.addAbility(new EntersBattlefieldTriggeredAbility(new IsochronScepterImprintEffect(), true, "<i>Imprint - </i>"));
this.addAbility(new EntersBattlefieldTriggeredAbility(new IsochronScepterImprintEffect(), true, "<i>Imprint &mdash; </i>"));
// {2}, {tap}: You may copy the exiled card. If you do, you may cast the copy without paying its mana cost.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new IsochronScepterCopyEffect(), new GenericManaCost(2));

View file

@ -29,6 +29,7 @@
package mage.sets.returntoravnica;
import java.util.UUID;
import mage.MageObject;
import mage.constants.AttachmentType;
import mage.constants.CardType;
import mage.constants.Duration;
@ -64,7 +65,6 @@ public class SoulTithe extends CardImpl {
super(ownerId, 23, "Soul Tithe", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}");
this.expansionSetCode = "RTR";
this.subtype.add("Aura");
this.color.setWhite(true);
// Enchant nonland permanent
TargetPermanent auraTarget = new TargetNonlandPermanent();
@ -106,12 +106,12 @@ class SoulTitheSacrificeSourceUnlessPaysEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Permanent permanent = game.getPermanent(source.getSourceId());
if (player != null && permanent != null) {
MageObject sourceObject = source.getSourceObject(game);
if (player != null && permanent != null && sourceObject != null) {
int cmc = permanent.getManaCost().convertedManaCost();
if (player.chooseUse(Outcome.Benefit, "Pay {" + cmc + "} for " + permanent.getName() + "?", game)) {
if (player.chooseUse(Outcome.Benefit, "Pay {" + cmc + "} for " + permanent.getName() + "? (otherwise you sacrifice it)", game)) {
Cost cost = new GenericManaCost(cmc);
if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false))
{
if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) {
return true;
}
}