[KHM] Implemented Resplendent Marshal (#7419)

This commit is contained in:
Daniel Bomar 2021-01-21 09:40:31 -06:00 committed by GitHub
parent 0099887a80
commit 30b3e2e658
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 121 additions and 0 deletions

View file

@ -0,0 +1,109 @@
package mage.cards.r;
import java.util.UUID;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldOrDiesSourceTriggeredAbility;
import mage.abilities.common.delayed.ReflexiveTriggeredAbility;
import mage.abilities.costs.common.ExileFromGraveCost;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DoWhenCostPaid;
import mage.cards.Card;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.counters.CounterType;
import mage.filter.StaticFilters;
import mage.filter.common.FilterCreatureCard;
import mage.filter.predicate.permanent.AnotherPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCardInYourGraveyard;
/**
*
* @author weirddan455
*/
public final class ResplendentMarshal extends CardImpl {
private static final FilterCreatureCard filter
= new FilterCreatureCard("another creature card from your graveyard");
static {
filter.add(AnotherPredicate.instance);
}
public ResplendentMarshal(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}{W}");
this.subtype.add(SubType.ANGEL);
this.subtype.add(SubType.WARRIOR);
this.power = new MageInt(3);
this.toughness = new MageInt(3);
// Flying
this.addAbility(FlyingAbility.getInstance());
// When Resplendent Marshal enters the battlefield or dies, you may exile another creature card from your graveyard.
// When you do, put a +1/+1 counter on each creature you control other than Resplendent Marshal that shares a creature type with the exiled card.
this.addAbility(new EntersBattlefieldOrDiesSourceTriggeredAbility(
new DoWhenCostPaid(
new ReflexiveTriggeredAbility(new ResplendentMarshalEffect(), false,
"put a +1/+1 counter on each creature you control other than Resplendent Marshal that shares a creature type with the exiled card"),
new ExileFromGraveCost(new TargetCardInYourGraveyard(filter), true),
"Exile another creature card from your graveyard?"
), false
));
}
private ResplendentMarshal(final ResplendentMarshal card) {
super(card);
}
@Override
public ResplendentMarshal copy() {
return new ResplendentMarshal(this);
}
}
class ResplendentMarshalEffect extends OneShotEffect {
public ResplendentMarshalEffect() {
super(Outcome.Benefit);
}
private ResplendentMarshalEffect (final ResplendentMarshalEffect effect) {
super(effect);
}
@Override
public ResplendentMarshalEffect copy() {
return new ResplendentMarshalEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = game.getObject(source.getSourceId());
Card exiledCard = game.getCard(targetPointer.getFirst(game, source));
if (controller != null && sourceObject != null && exiledCard != null) {
for (Permanent permanent : game.getBattlefield().getActivePermanents(
StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE, source.getControllerId(), source.getSourceId(), game)) {
if (permanent.shareCreatureTypes(exiledCard, game)) {
permanent.addCounters(CounterType.P1P1.createInstance(), source, game);
if (!game.isSimulation()) {
game.informPlayers(sourceObject.getLogName() + ": " + controller.getLogName()
+ " puts a +1/+1 counter on " + permanent.getLogName());
}
}
}
return true;
}
return false;
}
}

View file

@ -250,6 +250,7 @@ public final class Kaldheim extends ExpansionSet {
cards.add(new SetCardInfo("Reflections of Littjara", 73, Rarity.RARE, mage.cards.r.ReflectionsOfLittjara.class)); cards.add(new SetCardInfo("Reflections of Littjara", 73, Rarity.RARE, mage.cards.r.ReflectionsOfLittjara.class));
cards.add(new SetCardInfo("Renegade Reaper", 386, Rarity.UNCOMMON, mage.cards.r.RenegadeReaper.class)); cards.add(new SetCardInfo("Renegade Reaper", 386, Rarity.UNCOMMON, mage.cards.r.RenegadeReaper.class));
cards.add(new SetCardInfo("Replicating Ring", 244, Rarity.UNCOMMON, mage.cards.r.ReplicatingRing.class)); cards.add(new SetCardInfo("Replicating Ring", 244, Rarity.UNCOMMON, mage.cards.r.ReplicatingRing.class));
cards.add(new SetCardInfo("Resplendent Marshal", 22, Rarity.MYTHIC, mage.cards.r.ResplendentMarshal.class));
cards.add(new SetCardInfo("Return Upon the Tide", 106, Rarity.UNCOMMON, mage.cards.r.ReturnUponTheTide.class)); cards.add(new SetCardInfo("Return Upon the Tide", 106, Rarity.UNCOMMON, mage.cards.r.ReturnUponTheTide.class));
cards.add(new SetCardInfo("Revitalize", 23, Rarity.COMMON, mage.cards.r.Revitalize.class)); cards.add(new SetCardInfo("Revitalize", 23, Rarity.COMMON, mage.cards.r.Revitalize.class));
cards.add(new SetCardInfo("Rimewood Falls", 266, Rarity.COMMON, mage.cards.r.RimewoodFalls.class)); cards.add(new SetCardInfo("Rimewood Falls", 266, Rarity.COMMON, mage.cards.r.RimewoodFalls.class));

View file

@ -16,6 +16,7 @@ import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import mage.target.common.TargetCardInASingleGraveyard; import mage.target.common.TargetCardInASingleGraveyard;
import mage.target.common.TargetCardInYourGraveyard; import mage.target.common.TargetCardInYourGraveyard;
import mage.target.targetpointer.FixedTarget;
import mage.util.CardUtil; import mage.util.CardUtil;
/** /**
@ -25,6 +26,7 @@ import mage.util.CardUtil;
public class ExileFromGraveCost extends CostImpl { public class ExileFromGraveCost extends CostImpl {
private final List<Card> exiledCards = new ArrayList<>(); private final List<Card> exiledCards = new ArrayList<>();
private boolean setTargetPointer = false;
public ExileFromGraveCost(TargetCardInYourGraveyard target) { public ExileFromGraveCost(TargetCardInYourGraveyard target) {
target.setNotTarget(true); target.setNotTarget(true);
@ -57,9 +59,15 @@ public class ExileFromGraveCost extends CostImpl {
this.text = "exile " + target.getTargetName(); this.text = "exile " + target.getTargetName();
} }
public ExileFromGraveCost(TargetCardInYourGraveyard target, boolean setTargetPointer) {
this(target);
this.setTargetPointer = setTargetPointer;
}
public ExileFromGraveCost(final ExileFromGraveCost cost) { public ExileFromGraveCost(final ExileFromGraveCost cost) {
super(cost); super(cost);
this.exiledCards.addAll(cost.getExiledCards()); this.exiledCards.addAll(cost.getExiledCards());
this.setTargetPointer = cost.setTargetPointer;
} }
@Override @Override
@ -77,6 +85,9 @@ public class ExileFromGraveCost extends CostImpl {
Cards cardsToExile = new CardsImpl(); Cards cardsToExile = new CardsImpl();
cardsToExile.addAll(exiledCards); cardsToExile.addAll(exiledCards);
controller.moveCards(cardsToExile, Zone.EXILED, ability, game); controller.moveCards(cardsToExile, Zone.EXILED, ability, game);
if (setTargetPointer) {
source.getEffects().setTargetPointer(new FixedTarget(targets.getFirstTarget(), game));
}
paid = true; paid = true;
} }