Implemented Crystalline Resonance

This commit is contained in:
Evan Kranzler 2020-04-07 20:52:03 -04:00
parent 357d1873db
commit 2d11f69d0e
6 changed files with 186 additions and 88 deletions

View file

@ -0,0 +1,76 @@
package mage.cards.c;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.CycleControllerTriggeredAbility;
import mage.abilities.effects.common.CopyPermanentEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.filter.FilterPermanent;
import mage.filter.StaticFilters;
import mage.filter.predicate.permanent.AnotherPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.TargetPermanent;
import mage.util.functions.ApplyToPermanent;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class CrystallineResonance extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent("another permanent");
static {
filter.add(AnotherPredicate.instance);
}
public CrystallineResonance(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{U}");
// Whenever you cycle a card, you may have Crystalline Resonance become a copy of another target permanent until your next turn, except it has this ability.
this.addAbility(this.createAbility());
}
private CrystallineResonance(final CrystallineResonance card) {
super(card);
}
@Override
public CrystallineResonance copy() {
return new CrystallineResonance(this);
}
static Ability createAbility() {
Ability ability = new CycleControllerTriggeredAbility(
new CopyPermanentEffect(
StaticFilters.FILTER_PERMANENT_CREATURE,
new CrystallineResonanceApplier(), true
).setDuration(Duration.UntilYourNextTurn).setText(
"have {this} become a copy of another target permanent until your next turn, " +
"except it has this ability"
), true
);
ability.addTarget(new TargetPermanent(filter));
return ability;
}
}
class CrystallineResonanceApplier extends ApplyToPermanent {
@Override
public boolean apply(Game game, Permanent permanent, Ability source, UUID copyToObjectId) {
permanent.getAbilities().add(CrystallineResonance.createAbility());
return true;
}
@Override
public boolean apply(Game game, MageObject mageObject, Ability source, UUID copyToObjectId) {
mageObject.getAbilities().add(CrystallineResonance.createAbility());
return true;
}
}

View file

@ -28,7 +28,7 @@ public final class DrannithStinger extends CardImpl {
// Whenever you cycle another card, Drannith Stinger deals 1 damage to each opponent.
this.addAbility(new CycleControllerTriggeredAbility(
new DamagePlayersEffect(1, TargetController.OPPONENT)
new DamagePlayersEffect(1, TargetController.OPPONENT), false, true
));
// Cycling {1}

View file

@ -27,7 +27,7 @@ public final class FlourishingFox extends CardImpl {
// Whenever you cycle another card, put a +1/+1 counter on Flourishing Fox.
this.addAbility(new CycleControllerTriggeredAbility(
new AddCountersSourceEffect(CounterType.P1P1.createInstance())
new AddCountersSourceEffect(CounterType.P1P1.createInstance()), false, true
));
// Cycling {1}

View file

@ -71,6 +71,7 @@ public final class Commander2020Edition extends ExpansionSet {
cards.add(new SetCardInfo("Commander's Sphere", 240, Rarity.COMMON, mage.cards.c.CommandersSphere.class));
cards.add(new SetCardInfo("Crop Rotation", 169, Rarity.COMMON, mage.cards.c.CropRotation.class));
cards.add(new SetCardInfo("Cryptic Trilobite", 21, Rarity.RARE, mage.cards.c.CrypticTrilobite.class));
cards.add(new SetCardInfo("Crystalline Resonance", 31, Rarity.RARE, mage.cards.c.CrystallineResonance.class));
cards.add(new SetCardInfo("Curious Herd", 59, Rarity.RARE, mage.cards.c.CuriousHerd.class));
cards.add(new SetCardInfo("Daring Fiendbonder", 41, Rarity.RARE, mage.cards.d.DaringFiendbonder.class));
cards.add(new SetCardInfo("Deadly Tempest", 131, Rarity.RARE, mage.cards.d.DeadlyTempest.class));