mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
[CLB] Implemented Split the Spoils
This commit is contained in:
parent
5830c0baa8
commit
80b3e282a7
2 changed files with 97 additions and 0 deletions
96
Mage.Sets/src/mage/cards/s/SplitTheSpoils.java
Normal file
96
Mage.Sets/src/mage/cards/s/SplitTheSpoils.java
Normal file
|
@ -0,0 +1,96 @@
|
|||
package mage.cards.s;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.*;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetCard;
|
||||
import mage.target.common.TargetCardInYourGraveyard;
|
||||
import mage.target.common.TargetOpponent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class SplitTheSpoils extends CardImpl {
|
||||
|
||||
public SplitTheSpoils(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{G}");
|
||||
|
||||
// Exile up to five target permanent cards from your graveyard and separate them into two piles. An opponent chooses one of those piles. Put that pile into your hand and the other into your graveyard.
|
||||
this.getSpellAbility().addEffect(new SplitTheSpoilsEffect());
|
||||
this.getSpellAbility().addTarget(new TargetCardInYourGraveyard(
|
||||
0, 5, StaticFilters.FILTER_CARD_PERMANENT
|
||||
));
|
||||
}
|
||||
|
||||
private SplitTheSpoils(final SplitTheSpoils card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SplitTheSpoils copy() {
|
||||
return new SplitTheSpoils(this);
|
||||
}
|
||||
}
|
||||
|
||||
class SplitTheSpoilsEffect extends OneShotEffect {
|
||||
|
||||
SplitTheSpoilsEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "exile up to five target permanent cards from your graveyard and separate them into two piles. " +
|
||||
"An opponent chooses one of those piles. Put that pile into your hand and the other into your graveyard";
|
||||
}
|
||||
|
||||
private SplitTheSpoilsEffect(final SplitTheSpoilsEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SplitTheSpoilsEffect copy() {
|
||||
return new SplitTheSpoilsEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
Cards cards = new CardsImpl(getTargetPointer().getTargets(game, source));
|
||||
if (player == null || cards.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
player.moveCards(cards, Zone.EXILED, source, game);
|
||||
TargetCard target = new TargetCardInYourGraveyard(0, 5);
|
||||
target.withChooseHint("To put in pile 1").setNotTarget(true);
|
||||
player.choose(outcome, cards, target, game);
|
||||
List<Card> pile1 = new ArrayList<>();
|
||||
target.getTargets()
|
||||
.stream()
|
||||
.map(game::getCard)
|
||||
.filter(Objects::nonNull)
|
||||
.forEach(pile1::add);
|
||||
List<Card> pile2 = new ArrayList<>();
|
||||
cards.removeIf(target.getTargets()::contains);
|
||||
pile2.addAll(cards.getCards(game));
|
||||
TargetOpponent targetOpponent = new TargetOpponent();
|
||||
targetOpponent.setNotTarget(true);
|
||||
if (game.getPlayer(targetOpponent.getFirstTarget()).choosePile(
|
||||
outcome, "Choose a pile to go to hand (the other goes to graveyard)", pile1, pile2, game
|
||||
)) {
|
||||
player.moveCards(new CardsImpl(pile1), Zone.HAND, source, game);
|
||||
player.moveCards(new CardsImpl(pile2), Zone.GRAVEYARD, source, game);
|
||||
} else {
|
||||
player.moveCards(new CardsImpl(pile2), Zone.HAND, source, game);
|
||||
player.moveCards(new CardsImpl(pile1), Zone.GRAVEYARD, source, game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -287,6 +287,7 @@ public final class CommanderLegendsBattleForBaldursGate extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Solemn Doomguide", 672, Rarity.RARE, mage.cards.s.SolemnDoomguide.class));
|
||||
cards.add(new SetCardInfo("Spectacular Showdown", 679, Rarity.RARE, mage.cards.s.SpectacularShowdown.class));
|
||||
cards.add(new SetCardInfo("Spire Garden", 361, Rarity.RARE, mage.cards.s.SpireGarden.class));
|
||||
cards.add(new SetCardInfo("Split the Spoils", 257, Rarity.UNCOMMON, mage.cards.s.SplitTheSpoils.class));
|
||||
cards.add(new SetCardInfo("Steadfast Unicorn", 44, Rarity.COMMON, mage.cards.s.SteadfastUnicorn.class));
|
||||
cards.add(new SetCardInfo("Stick Together", 661, Rarity.RARE, mage.cards.s.StickTogether.class));
|
||||
cards.add(new SetCardInfo("Stirge", 150, Rarity.COMMON, mage.cards.s.Stirge.class));
|
||||
|
|
Loading…
Reference in a new issue