[STX] Implemented Reflective Golem

This commit is contained in:
Evan Kranzler 2021-04-10 16:07:52 -04:00
parent 4528663f1a
commit 9568dec3a8
3 changed files with 103 additions and 1 deletions

View file

@ -87,7 +87,6 @@ class BeamsplitterMageTriggeredAbility extends TriggeredAbilityImpl {
if (spell == null || !spell.isInstantOrSorcery()) {
return false;
}
boolean targetsSource = false;
if (spell.getSpellAbilities()
.stream()
.map(AbilityImpl::getModes)

View file

@ -0,0 +1,102 @@
package mage.cards.r;
import mage.MageInt;
import mage.abilities.AbilityImpl;
import mage.abilities.Mode;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.common.CopyTargetSpellEffect;
import mage.abilities.effects.common.DoIfCostPaid;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.stack.Spell;
import mage.target.Target;
import mage.target.targetpointer.FixedTarget;
import java.util.Collection;
import java.util.Objects;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class ReflectiveGolem extends CardImpl {
public ReflectiveGolem(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{3}");
this.subtype.add(SubType.GOLEM);
this.power = new MageInt(2);
this.toughness = new MageInt(3);
// Whenever you cast an instant or sorcery spell that targets only Reflective Golem, you may pay {2}. If you do, copy that spell. You may choose new targets for the copy.
this.addAbility(new ReflectiveGolemTriggeredAbility());
}
private ReflectiveGolem(final ReflectiveGolem card) {
super(card);
}
@Override
public ReflectiveGolem copy() {
return new ReflectiveGolem(this);
}
}
class ReflectiveGolemTriggeredAbility extends TriggeredAbilityImpl {
ReflectiveGolemTriggeredAbility() {
super(Zone.BATTLEFIELD, new DoIfCostPaid(new CopyTargetSpellEffect(), new GenericManaCost(2)), false);
}
private ReflectiveGolemTriggeredAbility(final ReflectiveGolemTriggeredAbility ability) {
super(ability);
}
@Override
public ReflectiveGolemTriggeredAbility copy() {
return new ReflectiveGolemTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.SPELL_CAST;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (!isControlledBy(event.getPlayerId())) {
return false;
}
Spell spell = game.getSpellOrLKIStack(event.getTargetId());
if (spell == null || !spell.isInstantOrSorcery()) {
return false;
}
if (spell.getSpellAbilities()
.stream()
.map(AbilityImpl::getModes)
.flatMap(m -> m.getSelectedModes().stream().map(m::get))
.filter(Objects::nonNull)
.map(Mode::getTargets)
.flatMap(Collection::stream)
.filter(t -> !t.isNotTarget())
.map(Target::getTargets)
.flatMap(Collection::stream)
.anyMatch(uuid -> !getSourceId().equals(uuid) && uuid != null)) {
return false;
}
this.getEffects().setTargetPointer(new FixedTarget(spell, game));
return true;
}
@Override
public String getRule() {
return "Whenever you cast an instant or sorcery spell that targets only {this}, " +
"you may pay {2}. If you do, copy that spell. You may choose new targets for the copy.";
}
}

View file

@ -209,6 +209,7 @@ public final class StrixhavenSchoolOfMages extends ExpansionSet {
cards.add(new SetCardInfo("Reckless Amplimancer", 141, Rarity.COMMON, mage.cards.r.RecklessAmplimancer.class));
cards.add(new SetCardInfo("Reconstruct History", 222, Rarity.UNCOMMON, mage.cards.r.ReconstructHistory.class));
cards.add(new SetCardInfo("Reduce to Memory", 25, Rarity.UNCOMMON, mage.cards.r.ReduceToMemory.class));
cards.add(new SetCardInfo("Reflective Golem", 257, Rarity.UNCOMMON, mage.cards.r.ReflectiveGolem.class));
cards.add(new SetCardInfo("Reject", 50, Rarity.COMMON, mage.cards.r.Reject.class));
cards.add(new SetCardInfo("Relic Sloth", 223, Rarity.COMMON, mage.cards.r.RelicSloth.class));
cards.add(new SetCardInfo("Resculpt", 51, Rarity.COMMON, mage.cards.r.Resculpt.class));