[BLB] Implement Ygra, Eater of All

This commit is contained in:
PurpleCrowbar 2024-08-10 03:26:54 +01:00
parent 587f65551c
commit bd7aaa34ee
2 changed files with 108 additions and 0 deletions

View file

@ -0,0 +1,106 @@
package mage.cards.y;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.common.ZoneChangeAllTriggeredAbility;
import mage.abilities.costs.common.SacrificeTargetCost;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.keyword.WardAbility;
import mage.abilities.token.FoodAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.counters.CounterType;
import mage.filter.FilterPermanent;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
import java.util.UUID;
/**
* @author PurpleCrowbar
*/
public final class YgraEaterOfAll extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent(SubType.FOOD, "Food");
public YgraEaterOfAll(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{B}{G}");
this.supertype.add(SuperType.LEGENDARY);
this.subtype.add(SubType.ELEMENTAL, SubType.CAT);
this.power = new MageInt(6);
this.toughness = new MageInt(6);
// WardSacrifice a Food.
this.addAbility(new WardAbility(new SacrificeTargetCost(filter), false));
// Other creatures are Food artifacts in addition to their other types and have "{2}, {T}, Sacrifice this permanent: You gain 3 life."
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new YgraEaterOfAllEffect()));
// Whenever a Food is put into a graveyard from the battlefield, put two +1/+1 counters on Ygra, Eater of All.
this.addAbility(new ZoneChangeAllTriggeredAbility(Zone.BATTLEFIELD, Zone.BATTLEFIELD, Zone.GRAVEYARD,
new AddCountersSourceEffect(CounterType.P1P1.createInstance(2)), filter,
"Whenever a Food is put into a graveyard from the battlefield, ", false
));
}
private YgraEaterOfAll(final YgraEaterOfAll card) {
super(card);
}
@Override
public YgraEaterOfAll copy() {
return new YgraEaterOfAll(this);
}
}
class YgraEaterOfAllEffect extends ContinuousEffectImpl {
YgraEaterOfAllEffect() {
super(Duration.WhileOnBattlefield, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.AddAbility);
staticText = "Other creatures are Food artifacts in addition to their other types " +
"and have \"{2}, {T}, Sacrifice this permanent: You gain 3 life.\"";
this.dependencyTypes.add(DependencyType.ArtifactAddingRemoving);
}
private YgraEaterOfAllEffect(final YgraEaterOfAllEffect effect) {
super(effect);
}
@Override
public YgraEaterOfAllEffect copy() {
return new YgraEaterOfAllEffect(this);
}
@Override
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
for (Permanent permanent : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURES, source.getControllerId(), source, game)) {
if (permanent == game.getPermanent(source.getSourceId())) {
continue;
}
switch (layer) {
case TypeChangingEffects_4:
permanent.addCardType(game, CardType.ARTIFACT);
permanent.addSubType(game, SubType.FOOD);
break;
case AbilityAddingRemovingEffects_6:
permanent.addAbility(new FoodAbility(true), source.getSourceId(), game);
break;
}
}
return true;
}
@Override
public boolean apply(Game game, Ability source) {
return false;
}
@Override
public boolean hasLayer(Layer layer) {
return layer == Layer.TypeChangingEffects_4 || layer == Layer.AbilityAddingRemovingEffects_6;
}
}

View file

@ -272,6 +272,8 @@ public final class Bloomburrow extends ExpansionSet {
cards.add(new SetCardInfo("Wick, the Whorled Mind", 120, Rarity.RARE, mage.cards.w.WickTheWhorledMind.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Wick, the Whorled Mind", 314, Rarity.RARE, mage.cards.w.WickTheWhorledMind.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Wildfire Howl", 162, Rarity.UNCOMMON, mage.cards.w.WildfireHowl.class));
cards.add(new SetCardInfo("Ygra, Eater of All", 241, Rarity.MYTHIC, mage.cards.y.YgraEaterOfAll.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Ygra, Eater of All", 294, Rarity.MYTHIC, mage.cards.y.YgraEaterOfAll.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Zoraline, Cosmos Caller", 242, Rarity.RARE, mage.cards.z.ZoralineCosmosCaller.class));
}
}