[ONE] Implement Evolving Adaptive (#9990)

Co-authored-by: Daniel Eberhard <daniel.h.e@gmx.de>
Co-authored-by: PurpleCrowbar <26198472+PurpleCrowbar@users.noreply.github.com>
This commit is contained in:
Merlingilb 2023-02-19 20:53:09 +01:00 committed by GitHub
parent e17b409593
commit 7f118e2290
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 96 additions and 0 deletions

View file

@ -0,0 +1,95 @@
package mage.cards.e;
import mage.MageInt;
import mage.abilities.common.*;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.CountersSourceCount;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.counters.CounterType;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AnotherPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import java.util.UUID;
public class EvolvingAdaptive extends CardImpl {
private static final DynamicValue oilCounters = new CountersSourceCount(CounterType.OIL);
public EvolvingAdaptive(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{G}");
this.addSubType(SubType.PHYREXIAN);
this.addSubType(SubType.WARRIOR);
this.power = new MageInt(0);
this.toughness = new MageInt(0);
//Evolving Adaptive enters the battlefield with an oil counter on it.
this.addAbility(new EntersBattlefieldAbility(
new AddCountersSourceEffect(CounterType.OIL.createInstance()),
"with an oil counter on it"
));
//Evolving Adaptive gets +1/+1 for each oil counter on it.
this.addAbility(new SimpleStaticAbility(new BoostSourceEffect(oilCounters, oilCounters, Duration.WhileOnBattlefield)
.setText("{this} gets +1/+1 for each oil counter on it")));
//Whenever another creature enters the battlefield under your control, if that creature has greater power or
//toughness than Evolving Adaptive, put an oil counter on Evolving Adaptive.
this.addAbility(new EvolvingAdaptiveTriggeredAbility());
}
private EvolvingAdaptive(final EvolvingAdaptive card) {
super(card);
}
@Override
public EvolvingAdaptive copy() {
return new EvolvingAdaptive(this);
}
}
class EvolvingAdaptiveTriggeredAbility extends EntersBattlefieldControlledTriggeredAbility {
private static final FilterPermanent filter = new FilterCreaturePermanent("another creature");
static {
filter.add(AnotherPredicate.instance);
}
public EvolvingAdaptiveTriggeredAbility() {
super(new AddCountersSourceEffect(CounterType.OIL.createInstance()), filter);
this.setTriggerPhrase("Whenever another creature enters the battlefield under your " +
"control, if that creature has greater power or toughness than {this}, ");
}
public EvolvingAdaptiveTriggeredAbility(final EntersBattlefieldControlledTriggeredAbility ability) {
super(ability);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent enteringCreature = game.getPermanent(event.getSourceId());
Permanent permanent = getSourcePermanentIfItStillExists(game);
if (permanent != null){
if (!(enteringCreature.getPower().getValue() > permanent.getPower().getValue()) &&
!(enteringCreature.getToughness().getValue() > permanent.getToughness().getValue())) {
return false;
}
}
return super.checkTrigger(event, game);
}
@Override
public EvolvingAdaptiveTriggeredAbility copy() {
return new EvolvingAdaptiveTriggeredAbility(this);
}
}

View file

@ -75,6 +75,7 @@ public final class PhyrexiaAllWillBeOne extends ExpansionSet {
cards.add(new SetCardInfo("Encroaching Mycosynth", 47, Rarity.RARE, mage.cards.e.EncroachingMycosynth.class));
cards.add(new SetCardInfo("Escaped Experiment", 48, Rarity.COMMON, mage.cards.e.EscapedExperiment.class));
cards.add(new SetCardInfo("Evolved Spinoderm", 166, Rarity.RARE, mage.cards.e.EvolvedSpinoderm.class));
cards.add(new SetCardInfo("Evolving Adaptive", 167, Rarity.UNCOMMON, mage.cards.e.EvolvingAdaptive.class));
cards.add(new SetCardInfo("Expand the Sphere", 168, Rarity.UNCOMMON, mage.cards.e.ExpandTheSphere.class));
cards.add(new SetCardInfo("Experimental Augury", 49, Rarity.COMMON, mage.cards.e.ExperimentalAugury.class));
cards.add(new SetCardInfo("Exuberant Fuseling", 129, Rarity.COMMON, mage.cards.e.ExuberantFuseling.class));