[WOE] Implement Eriette of the Charmed Apple (#10904)

* WIP

* implemented can't attack effect

* moved logic for "permanents enchanted by Auras" to predicate

* added value hint for ability

* fixed static properties

* changed predicate logic

* fixed issues as per PR comments

* updated predicate name, changed count from static variable

* made DynamicValue static
This commit is contained in:
Vivian Greenslade 2023-08-22 20:54:52 -02:30 committed by GitHub
parent c3d48a9b9c
commit 491f47ddc6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 96 additions and 0 deletions

View file

@ -0,0 +1,65 @@
package mage.cards.e;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.effects.common.LoseLifeOpponentsEffect;
import mage.abilities.effects.common.combat.CantAttackYouAllEffect;
import mage.abilities.hint.ValueHint;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.constants.TargetController;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.EnchantedBySourceControllerPredicate;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
/**
*
* @author Xanderhall
*/
public final class ErietteOfTheCharmedApple extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creatures enchanted by an Aura you control");
private static final DynamicValue count = new PermanentsOnBattlefieldCount(new FilterControlledPermanent(SubType.AURA));
static {
filter.add(EnchantedBySourceControllerPredicate.instance);
}
public ErietteOfTheCharmedApple(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}{B}");
this.supertype.add(SuperType.LEGENDARY);
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.WARLOCK);
this.power = new MageInt(2);
this.toughness = new MageInt(4);
// Each creature that's enchanted by an Aura you control can't attack you or planeswalkers you control.
this.addAbility(new SimpleStaticAbility(new CantAttackYouAllEffect(Duration.WhileOnBattlefield, filter, true)));
// At the beginning of your end step, each opponent loses X life and you gain X life, where X is the number of Auras you control.
Ability ability = new BeginningOfEndStepTriggeredAbility(new LoseLifeOpponentsEffect(count), TargetController.YOU, false);
ability.addEffect(new GainLifeEffect(count));
ability.addHint(new ValueHint("Number of Auras you control", count));
this.addAbility(ability);
}
private ErietteOfTheCharmedApple(final ErietteOfTheCharmedApple card) {
super(card);
}
@Override
public ErietteOfTheCharmedApple copy() {
return new ErietteOfTheCharmedApple(this);
}
}

View file

@ -53,6 +53,7 @@ public final class WildsOfEldraine extends ExpansionSet {
cards.add(new SetCardInfo("Edgewall Inn", 255, Rarity.UNCOMMON, mage.cards.e.EdgewallInn.class));
cards.add(new SetCardInfo("Elvish Archivist", 168, Rarity.RARE, mage.cards.e.ElvishArchivist.class));
cards.add(new SetCardInfo("Embereth Veteran", 127, Rarity.UNCOMMON, mage.cards.e.EmberethVeteran.class));
cards.add(new SetCardInfo("Eriette of the Charmed Apple", 202, Rarity.MYTHIC, mage.cards.e.ErietteOfTheCharmedApple.class));
cards.add(new SetCardInfo("Evolving Wilds", 256, Rarity.COMMON, mage.cards.e.EvolvingWilds.class));
cards.add(new SetCardInfo("Expel the Interlopers", 13, Rarity.RARE, mage.cards.e.ExpelTheInterlopers.class));
cards.add(new SetCardInfo("Faerie Dreamthief", 89, Rarity.UNCOMMON, mage.cards.f.FaerieDreamthief.class));

View file

@ -0,0 +1,30 @@
package mage.filter.predicate.permanent;
import mage.constants.SubType;
import mage.filter.predicate.ObjectSourcePlayer;
import mage.filter.predicate.ObjectSourcePlayerPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import java.util.Objects;
/**
* @author Xanderhall
*/
public enum EnchantedBySourceControllerPredicate implements ObjectSourcePlayerPredicate<Permanent> {
instance;
@Override
public boolean apply(ObjectSourcePlayer<Permanent> input, Game game) {
return input.getObject().getAttachments()
.stream()
.map(game::getPermanent)
.filter(Objects::nonNull)
.anyMatch(p -> p.hasSubtype(SubType.AURA, game) && p.isControlledBy(input.getPlayerId()));
}
@Override
public String toString() {
return "Enchanted by source";
}
}