1
0
Fork 0
mirror of https://github.com/correl/mage.git synced 2025-04-02 11:25:59 -09:00

[BRO] Implemented Legions to Ashes

This commit is contained in:
Daniel Bomar 2022-11-08 13:50:20 -06:00
parent cbf53f68a4
commit b57dccf10a
No known key found for this signature in database
GPG key ID: C86C8658F4023918
2 changed files with 80 additions and 0 deletions
Mage.Sets/src/mage

View file

@ -0,0 +1,79 @@
package mage.cards.l;
import java.util.HashSet;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.FilterPermanent;
import mage.filter.StaticFilters;
import mage.filter.predicate.mageobject.NamePredicate;
import mage.filter.predicate.permanent.ControllerIdPredicate;
import mage.filter.predicate.permanent.TokenPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetNonlandPermanent;
/**
*
* @author weirddan455
*/
public final class LegionsToAshes extends CardImpl {
public LegionsToAshes(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{W}{B}");
// Exile target nonland permanent an opponent controls and all tokens that player controls with the same name as that permanent.
this.getSpellAbility().addEffect(new LegionsToAshesEffect());
this.getSpellAbility().addTarget(new TargetNonlandPermanent(StaticFilters.FILTER_OPPONENTS_PERMANENT_NON_LAND));
}
private LegionsToAshes(final LegionsToAshes card) {
super(card);
}
@Override
public LegionsToAshes copy() {
return new LegionsToAshes(this);
}
}
class LegionsToAshesEffect extends OneShotEffect {
public LegionsToAshesEffect() {
super(Outcome.Exile);
this.staticText = "Exile target nonland permanent an opponent controls and all tokens that player controls with the same name as that permanent.";
}
private LegionsToAshesEffect(final LegionsToAshesEffect effect) {
super(effect);
}
@Override
public LegionsToAshesEffect copy() {
return new LegionsToAshesEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent targetPermanent = game.getPermanent(source.getFirstTarget());
if (controller == null || targetPermanent == null) {
return false;
}
FilterPermanent filter = new FilterPermanent();
filter.add(TokenPredicate.TRUE);
filter.add(new ControllerIdPredicate(targetPermanent.getControllerId()));
filter.add(new NamePredicate(targetPermanent.getName()));
HashSet<Permanent> toExile = new HashSet<>(game.getBattlefield().getActivePermanents(filter, controller.getId(), source, game));
toExile.add(targetPermanent);
controller.moveCards(toExile, Zone.EXILED, source, game);
return true;
}
}

View file

@ -153,6 +153,7 @@ public final class TheBrothersWar extends ExpansionSet {
cards.add(new SetCardInfo("Koilos Roc", 55, Rarity.COMMON, mage.cards.k.KoilosRoc.class));
cards.add(new SetCardInfo("Lat-Nam Adept", 56, Rarity.COMMON, mage.cards.l.LatNamAdept.class));
cards.add(new SetCardInfo("Lay Down Arms", 11, Rarity.UNCOMMON, mage.cards.l.LayDownArms.class));
cards.add(new SetCardInfo("Legions to Ashes", 215, Rarity.RARE, mage.cards.l.LegionsToAshes.class));
cards.add(new SetCardInfo("Levitating Statue", 236, Rarity.UNCOMMON, mage.cards.l.LevitatingStatue.class));
cards.add(new SetCardInfo("Liberator, Urza's Battlethopter", 237, Rarity.RARE, mage.cards.l.LiberatorUrzasBattlethopter.class));
cards.add(new SetCardInfo("Llanowar Wastes", 264, Rarity.RARE, mage.cards.l.LlanowarWastes.class));