mirror of
https://github.com/magefree/mage.git
synced 2026-01-09 12:22:10 -08:00
[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:
parent
c3d48a9b9c
commit
491f47ddc6
3 changed files with 96 additions and 0 deletions
65
Mage.Sets/src/mage/cards/e/ErietteOfTheCharmedApple.java
Normal file
65
Mage.Sets/src/mage/cards/e/ErietteOfTheCharmedApple.java
Normal 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);
|
||||
}
|
||||
}
|
||||
|
|
@ -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));
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue