[STX] Implement Selfless Glyphweaver (#7754)

* [STX] Implement Selfless Glyphweaver

* static filter, choose on resolution
This commit is contained in:
htrajan 2021-04-17 09:47:28 -07:00 committed by GitHub
parent af0178962d
commit 37a58299a6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 95 additions and 0 deletions

View file

@ -0,0 +1,94 @@
package mage.cards.s;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.ExileSourceCost;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DestroyAllEffect;
import mage.abilities.effects.common.continuous.GainAbilityControlledEffect;
import mage.abilities.keyword.IndestructibleAbility;
import mage.cards.CardSetInfo;
import mage.cards.ModalDoubleFacesCard;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.filter.FilterPermanent;
import mage.filter.StaticFilters;
import mage.filter.common.FilterCreatureOrPlaneswalkerPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.permanent.PermanentIdPredicate;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreatureOrPlaneswalker;
import java.util.UUID;
/**
*
* @author htrajan
*/
public final class SelflessGlyphweaver extends ModalDoubleFacesCard {
public SelflessGlyphweaver(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, new SubType[]{SubType.HUMAN, SubType.CLERIC}, "{2}{W}",
"Deadly Vanity", new CardType[]{CardType.SORCERY}, new SubType[]{}, "{5}{B}{B}{B}");
// 1.
// Selfless Glyphweaver
// Creature - Human Cleric
this.getLeftHalfCard().setPT(2, 3);
// Exile Selfless Glyphweaver: Creatures you control gain indestructible until end of turn.
this.getLeftHalfCard().addAbility(new SimpleActivatedAbility(new GainAbilityControlledEffect(IndestructibleAbility.getInstance(), Duration.EndOfTurn, StaticFilters.FILTER_PERMANENT_CREATURES), new ExileSourceCost()));
// 2.
// Deadly Vanity
// Sorcery
// Choose a creature or planeswalker, then destroy all other creatures and planeswalkers.
this.getRightHalfCard().getSpellAbility().addEffect(new DeadlyVanityEffect());
}
private SelflessGlyphweaver(final SelflessGlyphweaver card) {
super(card);
}
@Override
public SelflessGlyphweaver copy() {
return new SelflessGlyphweaver(this);
}
}
class DeadlyVanityEffect extends OneShotEffect {
DeadlyVanityEffect() {
super(Outcome.Benefit);
staticText = "choose a creature or planeswalker, then destroy all other creatures and planeswalkers";
}
DeadlyVanityEffect(DeadlyVanityEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
TargetPermanent target = new TargetCreatureOrPlaneswalker();
target.setNotTarget(true);
Player controller = game.getPlayer(source.getControllerId());
controller.choose(outcome, target, source.getId(), game);
FilterPermanent filter = new FilterCreatureOrPlaneswalkerPermanent();
UUID targetId = target.getFirstTarget();
if (targetId != null) {
filter.add(Predicates.not(new PermanentIdPredicate(targetId)));
}
return new DestroyAllEffect(filter).apply(game, source);
}
@Override
public DeadlyVanityEffect copy() {
return new DeadlyVanityEffect(this);
}
}

View file

@ -241,6 +241,7 @@ public final class StrixhavenSchoolOfMages extends ExpansionSet {
cards.add(new SetCardInfo("Scurrid Colony", 142, Rarity.COMMON, mage.cards.s.ScurridColony.class));
cards.add(new SetCardInfo("Secret Rendezvous", 26, Rarity.UNCOMMON, mage.cards.s.SecretRendezvous.class));
cards.add(new SetCardInfo("Sedgemoor Witch", 86, Rarity.RARE, mage.cards.s.SedgemoorWitch.class));
cards.add(new SetCardInfo("Selfless Glyphweaver", 157, Rarity.RARE, mage.cards.s.SelflessGlyphweaver.class));
cards.add(new SetCardInfo("Semester's End", 27, Rarity.RARE, mage.cards.s.SemestersEnd.class));
cards.add(new SetCardInfo("Serpentine Curve", 52, Rarity.COMMON, mage.cards.s.SerpentineCurve.class));
cards.add(new SetCardInfo("Shadewing Laureate", 229, Rarity.UNCOMMON, mage.cards.s.ShadewingLaureate.class));