[WOE] Implement The Irencrag (#10998)

This commit is contained in:
Susucre 2023-08-26 22:46:03 +02:00 committed by GitHub
parent fe93d68b1c
commit cde60d38d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 129 additions and 0 deletions

View file

@ -0,0 +1,128 @@
package mage.cards.t;
import mage.MageObjectReference;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.effects.common.AddContinuousEffectToGame;
import mage.abilities.effects.common.continuous.BoostEquippedEffect;
import mage.abilities.keyword.EquipAbility;
import mage.abilities.mana.ColorlessManaAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import java.util.UUID;
/**
* @author Susucr
*/
public final class TheIrencrag extends CardImpl {
private static final FilterPermanent filter = new FilterControlledCreaturePermanent("a legendary creature");
static {
filter.add(SuperType.LEGENDARY.getPredicate());
filter.add(TargetController.YOU.getControllerPredicate());
}
public TheIrencrag(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}");
this.supertype.add(SuperType.LEGENDARY);
// {T}: Add {C}.
this.addAbility(new ColorlessManaAbility());
// Whenever a legendary creature enters the battlefield under your control, you may have The Irencrag become a legendary Equipment artifact named Everflame, Heroes' Legacy. If you do, it gains equip {3} and "Equipped creature gets +3/+3" and loses all other abilities.
this.addAbility(new EntersBattlefieldControlledTriggeredAbility(
Zone.BATTLEFIELD, new AddContinuousEffectToGame(new TheIrencragBecomesContinuousEffect()),
filter, true, SetTargetPointer.NONE, null
));
}
private TheIrencrag(final TheIrencrag card) {
super(card);
}
@Override
public TheIrencrag copy() {
return new TheIrencrag(this);
}
}
class TheIrencragBecomesContinuousEffect extends ContinuousEffectImpl {
public TheIrencragBecomesContinuousEffect() {
super(Duration.WhileOnBattlefield, Outcome.Benefit);
staticText = "{this} become a legendary Equipment artifact named Everflame, Heroes' Legacy. "
+ "If you do, it gains equip {3} and \"Equipped creature gets +3/+3\" and loses all other abilities";
dependencyTypes.add(DependencyType.ArtifactAddingRemoving);
}
protected TheIrencragBecomesContinuousEffect(final TheIrencragBecomesContinuousEffect effect) {
super(effect);
}
@Override
public TheIrencragBecomesContinuousEffect copy() {
return new TheIrencragBecomesContinuousEffect(this);
}
@Override
public void init(Ability source, Game game) {
super.init(source, game);
affectedObjectList.add(new MageObjectReference(source.getSourceId(), game));
}
@Override
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
Permanent permanent = affectedObjectList.get(0).getPermanent(game);
if (permanent == null) {
this.discard();
return false;
}
switch (layer) {
case TextChangingEffects_3:
permanent.setName("Everflame, Heroes' Legacy");
return true;
case TypeChangingEffects_4:
permanent.removeAllCardTypes(game);
permanent.addSuperType(game, SuperType.LEGENDARY);
permanent.addCardType(game, CardType.ARTIFACT);
permanent.retainAllArtifactSubTypes(game);
permanent.addSubType(game, SubType.EQUIPMENT);
return true;
case AbilityAddingRemovingEffects_6:
permanent.removeAllAbilities(source.getSourceId(), game);
permanent.addAbility(
new EquipAbility(3, false),
source.getSourceId(), game
);
permanent.addAbility(
new SimpleStaticAbility(new BoostEquippedEffect(3, 3)),
source.getSourceId(), game
);
return true;
}
return true;
}
@Override
public boolean apply(Game game, Ability source) {
return false;
}
@Override
public boolean hasLayer(Layer layer) {
return layer == Layer.TextChangingEffects_3
|| layer == Layer.TypeChangingEffects_4
|| layer == Layer.AbilityAddingRemovingEffects_6;
}
}

View file

@ -249,6 +249,7 @@ public final class WildsOfEldraine extends ExpansionSet {
cards.add(new SetCardInfo("The End", 87, Rarity.RARE, mage.cards.t.TheEnd.class));
cards.add(new SetCardInfo("The Goose Mother", 204, Rarity.RARE, mage.cards.t.TheGooseMother.class));
cards.add(new SetCardInfo("The Huntsman's Redemption", 176, Rarity.RARE, mage.cards.t.TheHuntsmansRedemption.class));
cards.add(new SetCardInfo("The Irencrag", 248, Rarity.RARE, mage.cards.t.TheIrencrag.class));
cards.add(new SetCardInfo("The Princess Takes Flight", 23, Rarity.UNCOMMON, mage.cards.t.ThePrincessTakesFlight.class));
cards.add(new SetCardInfo("The Witch's Vanity", 119, Rarity.UNCOMMON, mage.cards.t.TheWitchsVanity.class));
cards.add(new SetCardInfo("Threadbind Clique", 239, Rarity.UNCOMMON, mage.cards.t.ThreadbindClique.class));