mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
Implemented Legion's End
This commit is contained in:
parent
dd82423702
commit
b770c63fb3
2 changed files with 113 additions and 0 deletions
112
Mage.Sets/src/mage/cards/l/LegionsEnd.java
Normal file
112
Mage.Sets/src/mage/cards/l/LegionsEnd.java
Normal file
|
@ -0,0 +1,112 @@
|
|||
package mage.cards.l;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.ComparisonType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterOpponentsCreaturePermanent;
|
||||
import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class LegionsEnd extends CardImpl {
|
||||
|
||||
private static final FilterPermanent filter
|
||||
= new FilterOpponentsCreaturePermanent("creature an opponent controls with converted mana cost 2 or less");
|
||||
|
||||
static {
|
||||
filter.add(new ConvertedManaCostPredicate(ComparisonType.FEWER_THAN, 3));
|
||||
}
|
||||
|
||||
public LegionsEnd(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{B}");
|
||||
|
||||
// Exile target creature an opponent controls with converted mana cost 2 or less and all other creatures that player controls with the same name as that creature. Then that player reveals their hand and exiles all cards with that name from their hand and graveyard.
|
||||
this.getSpellAbility().addEffect(new LegionsEndEffect());
|
||||
this.getSpellAbility().addTarget(new TargetPermanent(filter));
|
||||
}
|
||||
|
||||
private LegionsEnd(final LegionsEnd card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LegionsEnd copy() {
|
||||
return new LegionsEnd(this);
|
||||
}
|
||||
}
|
||||
|
||||
class LegionsEndEffect extends OneShotEffect {
|
||||
|
||||
LegionsEndEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "Exile target creature an opponent controls with converted mana cost 2 or less " +
|
||||
"and all other creatures that player controls with the same name as that creature. " +
|
||||
"Then that player reveals their hand and exiles all cards with that name from their hand and graveyard.";
|
||||
}
|
||||
|
||||
private LegionsEndEffect(final LegionsEndEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LegionsEndEffect copy() {
|
||||
return new LegionsEndEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(source.getFirstTarget());
|
||||
if (permanent == null) {
|
||||
return false;
|
||||
}
|
||||
Player player = game.getPlayer(permanent.getControllerId());
|
||||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
String name = permanent.getName();
|
||||
if (name == null || name.equals("")) {
|
||||
player.revealCards(source, player.getHand(), game);
|
||||
return player.moveCards(permanent, Zone.EXILED, source, game);
|
||||
}
|
||||
Cards cards = new CardsImpl();
|
||||
game
|
||||
.getBattlefield()
|
||||
.getAllActivePermanents(player.getId())
|
||||
.stream()
|
||||
.filter(perm -> name.equals(perm.getName()))
|
||||
.forEach(perm -> cards.add(perm));
|
||||
|
||||
player.revealCards(source, player.getHand(), game);
|
||||
|
||||
player
|
||||
.getHand()
|
||||
.getCards(game)
|
||||
.stream()
|
||||
.filter(card -> name.equals(card.getName()))
|
||||
.forEach(card -> cards.add(card));
|
||||
|
||||
player
|
||||
.getGraveyard()
|
||||
.getCards(game)
|
||||
.stream()
|
||||
.filter(card -> name.equals(card.getName()))
|
||||
.forEach(card -> cards.add(card));
|
||||
|
||||
return player.moveCards(cards, Zone.EXILED, source, game);
|
||||
}
|
||||
}
|
|
@ -87,6 +87,7 @@ public final class CoreSet2020 extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Kaalia, Zenith Seeker", 210, Rarity.MYTHIC, mage.cards.k.KaaliaZenithSeeker.class));
|
||||
cards.add(new SetCardInfo("Kykar, Wind's Fury", 212, Rarity.MYTHIC, mage.cards.k.KykarWindsFury.class));
|
||||
cards.add(new SetCardInfo("Lavakin Brawler", 147, Rarity.COMMON, mage.cards.l.LavakinBrawler.class));
|
||||
cards.add(new SetCardInfo("Legion's End", 106, Rarity.RARE, mage.cards.l.LegionsEnd.class));
|
||||
cards.add(new SetCardInfo("Leyline of Abundance", 179, Rarity.RARE, mage.cards.l.LeylineOfAbundance.class));
|
||||
cards.add(new SetCardInfo("Leyline of Anticipation", 64, Rarity.RARE, mage.cards.l.LeylineOfAnticipation.class));
|
||||
cards.add(new SetCardInfo("Leyline of Sanctity", 26, Rarity.RARE, mage.cards.l.LeylineOfSanctity.class));
|
||||
|
|
Loading…
Reference in a new issue