mirror of
https://github.com/correl/mage.git
synced 2025-04-13 09:11:06 -09:00
[AFR] Implemented Feign Death
This commit is contained in:
parent
3e51cc346a
commit
d93bcc12cd
5 changed files with 163 additions and 9 deletions
Mage.Sets/src/mage
Mage/src/main/java/mage/abilities/effects/common
41
Mage.Sets/src/mage/cards/f/FeignDeath.java
Normal file
41
Mage.Sets/src/mage/cards/f/FeignDeath.java
Normal file
|
@ -0,0 +1,41 @@
|
|||
package mage.cards.f;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.abilities.common.DiesSourceTriggeredAbility;
|
||||
import mage.abilities.effects.common.ReturnSourceFromGraveyardToBattlefieldWithCounterEffect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.counters.CounterType;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author weirddan455
|
||||
*/
|
||||
public final class FeignDeath extends CardImpl {
|
||||
|
||||
public FeignDeath(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{B}");
|
||||
|
||||
// Until end of turn, target creature gains "When this creature dies, return it to the battlefield tapped under its owner's control with a +1/+1 counter on it."
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
|
||||
this.getSpellAbility().addEffect(new GainAbilityTargetEffect(
|
||||
new DiesSourceTriggeredAbility(new ReturnSourceFromGraveyardToBattlefieldWithCounterEffect(CounterType.P1P1.createInstance(), true)),
|
||||
Duration.EndOfTurn,
|
||||
"Until end of turn, target creature gains \"When this creature dies, return it to the battlefield tapped under its owner's control with a +1/+1 counter on it.\""
|
||||
));
|
||||
}
|
||||
|
||||
private FeignDeath(final FeignDeath card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FeignDeath copy() {
|
||||
return new FeignDeath(this);
|
||||
}
|
||||
}
|
|
@ -57,6 +57,7 @@ public final class AdventuresInTheForgottenRealms extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Elturgard Ranger", 182, Rarity.COMMON, mage.cards.e.ElturgardRanger.class));
|
||||
cards.add(new SetCardInfo("Evolving Wilds", 256, Rarity.COMMON, mage.cards.e.EvolvingWilds.class));
|
||||
cards.add(new SetCardInfo("Fates' Reversal", 102, Rarity.COMMON, mage.cards.f.FatesReversal.class));
|
||||
cards.add(new SetCardInfo("Feign Death", 103, Rarity.COMMON, mage.cards.f.FeignDeath.class));
|
||||
cards.add(new SetCardInfo("Fifty Feet of Rope", 244, Rarity.UNCOMMON, mage.cards.f.FiftyFeetOfRope.class));
|
||||
cards.add(new SetCardInfo("Find the Path", 183, Rarity.COMMON, mage.cards.f.FindThePath.class));
|
||||
cards.add(new SetCardInfo("Flumph", 15, Rarity.RARE, mage.cards.f.Flumph.class));
|
||||
|
|
|
@ -11,6 +11,10 @@ import mage.game.events.EntersTheBattlefieldEvent;
|
|||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author weirddan455
|
||||
*/
|
||||
public class ReturnFromGraveyardToBattlefieldWithCounterTargetEffect extends ReturnFromGraveyardToBattlefieldTargetEffect {
|
||||
|
||||
private final Counter counter;
|
||||
|
@ -39,7 +43,7 @@ public class ReturnFromGraveyardToBattlefieldWithCounterTargetEffect extends Ret
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
AddCounterReplacementEffect counterEffect = new AddCounterReplacementEffect(counter);
|
||||
AddCounterTargetReplacementEffect counterEffect = new AddCounterTargetReplacementEffect(counter);
|
||||
game.addEffect(counterEffect, source);
|
||||
return super.apply(game, source);
|
||||
}
|
||||
|
@ -71,23 +75,23 @@ public class ReturnFromGraveyardToBattlefieldWithCounterTargetEffect extends Ret
|
|||
}
|
||||
}
|
||||
|
||||
class AddCounterReplacementEffect extends ReplacementEffectImpl {
|
||||
class AddCounterTargetReplacementEffect extends ReplacementEffectImpl {
|
||||
|
||||
private final Counter counter;
|
||||
|
||||
public AddCounterReplacementEffect(Counter counter) {
|
||||
public AddCounterTargetReplacementEffect(Counter counter) {
|
||||
super(Duration.EndOfStep, Outcome.BoostCreature);
|
||||
this.counter = counter;
|
||||
}
|
||||
|
||||
private AddCounterReplacementEffect(final AddCounterReplacementEffect effect) {
|
||||
private AddCounterTargetReplacementEffect(final AddCounterTargetReplacementEffect effect) {
|
||||
super(effect);
|
||||
this.counter = effect.counter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AddCounterReplacementEffect copy() {
|
||||
return new AddCounterReplacementEffect(this);
|
||||
public AddCounterTargetReplacementEffect copy() {
|
||||
return new AddCounterTargetReplacementEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -21,9 +21,9 @@ import mage.target.targetpointer.FixedTarget;
|
|||
*/
|
||||
public class ReturnSourceFromGraveyardToBattlefieldEffect extends OneShotEffect {
|
||||
|
||||
private boolean tapped;
|
||||
private boolean ownerControl;
|
||||
private boolean haste;
|
||||
protected final boolean tapped;
|
||||
protected final boolean ownerControl;
|
||||
private final boolean haste;
|
||||
|
||||
public ReturnSourceFromGraveyardToBattlefieldEffect() {
|
||||
this(false);
|
||||
|
|
|
@ -0,0 +1,108 @@
|
|||
package mage.abilities.effects.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.counters.Counter;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.EntersTheBattlefieldEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author weirddan455
|
||||
*/
|
||||
public class ReturnSourceFromGraveyardToBattlefieldWithCounterEffect extends ReturnSourceFromGraveyardToBattlefieldEffect {
|
||||
|
||||
private final Counter counter;
|
||||
|
||||
public ReturnSourceFromGraveyardToBattlefieldWithCounterEffect(Counter counter, boolean tapped) {
|
||||
super(tapped);
|
||||
this.counter = counter;
|
||||
setText();
|
||||
}
|
||||
|
||||
private ReturnSourceFromGraveyardToBattlefieldWithCounterEffect(final ReturnSourceFromGraveyardToBattlefieldWithCounterEffect effect) {
|
||||
super(effect);
|
||||
this.counter = effect.counter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReturnSourceFromGraveyardToBattlefieldWithCounterEffect copy() {
|
||||
return new ReturnSourceFromGraveyardToBattlefieldWithCounterEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
AddCounterSourceReplacementEffect counterEffect = new AddCounterSourceReplacementEffect(counter);
|
||||
game.addEffect(counterEffect, source);
|
||||
return super.apply(game, source);
|
||||
}
|
||||
|
||||
private void setText() {
|
||||
StringBuilder sb = new StringBuilder("return it to the battlefield");
|
||||
if (tapped) {
|
||||
sb.append(" tapped");
|
||||
}
|
||||
if (ownerControl) {
|
||||
sb.append(" under its owner's control");
|
||||
}
|
||||
sb.append(" with ");
|
||||
if (counter.getCount() == 1) {
|
||||
sb.append('a');
|
||||
} else {
|
||||
sb.append(counter.getCount());
|
||||
}
|
||||
sb.append(' ');
|
||||
sb.append(counter.getName());
|
||||
sb.append(" counter");
|
||||
if (counter.getCount() != 1) {
|
||||
sb.append('s');
|
||||
}
|
||||
sb.append(" on it");
|
||||
staticText = sb.toString();
|
||||
}
|
||||
}
|
||||
|
||||
class AddCounterSourceReplacementEffect extends ReplacementEffectImpl {
|
||||
|
||||
private final Counter counter;
|
||||
|
||||
public AddCounterSourceReplacementEffect(Counter counter) {
|
||||
super(Duration.EndOfStep, Outcome.BoostCreature);
|
||||
this.counter = counter;
|
||||
}
|
||||
|
||||
private AddCounterSourceReplacementEffect(final AddCounterSourceReplacementEffect effect) {
|
||||
super(effect);
|
||||
this.counter = effect.counter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AddCounterSourceReplacementEffect copy() {
|
||||
return new AddCounterSourceReplacementEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checksEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
return event.getTargetId().equals(source.getSourceId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||
if (creature == null) {
|
||||
return false;
|
||||
}
|
||||
creature.addCounters(counter.copy(), source.getControllerId(), source, game, event.getAppliedEffects());
|
||||
discard();
|
||||
return false;
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue