* Some fixes to Liting Refrain, Dying Wish and Violet Pall.

This commit is contained in:
LevelX2 2015-08-07 21:31:22 +02:00
parent ddceaa3e54
commit 21cfe0611c
4 changed files with 95 additions and 37 deletions

View file

@ -28,17 +28,21 @@
package mage.sets.gatecrash;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.common.DiesAttachedTriggeredAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.effects.common.LoseLifeTargetEffect;
import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.TargetPermanent;
import mage.target.TargetPlayer;
import mage.target.common.TargetControlledCreaturePermanent;
@ -62,9 +66,8 @@ public class DyingWish extends CardImpl {
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
// When enchanted creature dies, target player loses X life and you gain X life, where X is its power.
DynamicValue attachedPower = new AttachedPermanentPowerCount();
DynamicValue attachedPower = new DyingWishAttachedPermanentPowerCount();
ability = new DiesAttachedTriggeredAbility(new LoseLifeTargetEffect(attachedPower), "enchanted creature");
ability.addEffect(new GainLifeEffect(attachedPower));
ability.addTarget(new TargetPlayer());
@ -80,3 +83,38 @@ public class DyingWish extends CardImpl {
return new DyingWish(this);
}
}
class DyingWishAttachedPermanentPowerCount implements DynamicValue {
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
Permanent attachmentPermanent = game.getPermanent(sourceAbility.getSourceId());
if (attachmentPermanent == null) {
attachmentPermanent = (Permanent) game.getLastKnownInformation(sourceAbility.getSourceId(), Zone.BATTLEFIELD, sourceAbility.getSourceObjectZoneChangeCounter());
}
if (attachmentPermanent != null && attachmentPermanent.getAttachedTo() != null) {
if (effect.getValue("attachedTo") != null) {
Permanent attached = (Permanent) effect.getValue("attachedTo");
if (attached != null) {
return attached.getPower().getValue();
}
}
}
return 0;
}
@Override
public DynamicValue copy() {
return new DyingWishAttachedPermanentPowerCount();
}
@Override
public String toString() {
return "X";
}
@Override
public String getMessage() {
return "its power";
}
}

View file

@ -28,15 +28,18 @@
package mage.sets.morningtide;
import java.util.UUID;
import mage.MageInt;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.ObjectColor;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.game.permanent.token.Token;
import mage.target.common.TargetCreaturePermanent;
/**
@ -58,7 +61,7 @@ public class VioletPall extends CardImpl {
this.getSpellAbility().addEffect(new DestroyTargetEffect());
this.getSpellAbility().addTarget(new TargetCreaturePermanent(filter));
this.getSpellAbility().addEffect(new CreateTokenEffect(new FaerieToken(), 1));
this.getSpellAbility().addEffect(new CreateTokenEffect(new VioletPallFaerieToken(), 1));
}
public VioletPall(final VioletPall card) {
@ -70,3 +73,17 @@ public class VioletPall extends CardImpl {
return new VioletPall(this);
}
}
class VioletPallFaerieToken extends Token {
VioletPallFaerieToken() {
super("Faerie Rogue", "1/1 black Faerie Rogue creature token with flying");
cardType.add(CardType.CREATURE);
color.setBlack(true);
subtype.add("Faerie");
subtype.add("Rogue");
power = new MageInt(1);
toughness = new MageInt(1);
this.addAbility(FlyingAbility.getInstance());
}
}

View file

@ -55,7 +55,7 @@ public class LiltingRefrain extends CardImpl {
// At the beginning of your upkeep, you may put a verse counter on Lilting Refrain.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new AddCountersSourceEffect(CounterType.VERSE.createInstance()), TargetController.YOU, true));
// Sacrifice Lilting Refrain: Counter target spell unless its controller pays {X}, where X is the number of verse counters on Lilting Refrain.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CounterUnlessPaysEffect(new CountersCount(CounterType.VERSE)), new SacrificeSourceCost());
ability.addTarget(new TargetSpell());
@ -70,4 +70,4 @@ public class LiltingRefrain extends CardImpl {
public LiltingRefrain copy() {
return new LiltingRefrain(this);
}
}
}