forked from External/mage
Merge pull request 'master' (#49) from External/mage:master into master
All checks were successful
/ build_release (push) Successful in 17m0s
All checks were successful
/ build_release (push) Successful in 17m0s
Reviewed-on: #49
This commit is contained in:
commit
0171e2bbff
43 changed files with 2344 additions and 236 deletions
|
|
@ -6,21 +6,29 @@ import mage.abilities.effects.OneShotEffect;
|
|||
import mage.constants.Outcome;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class PutOnTopOrBottomLibraryTargetEffect extends OneShotEffect {
|
||||
|
||||
private final int position;
|
||||
private final boolean textOwnerOf;
|
||||
|
||||
public PutOnTopOrBottomLibraryTargetEffect(boolean textOwnerOf) {
|
||||
this(1, textOwnerOf);
|
||||
}
|
||||
|
||||
public PutOnTopOrBottomLibraryTargetEffect(int position, boolean textOwnerOf) {
|
||||
super(Outcome.ReturnToHand);
|
||||
this.position = position;
|
||||
this.textOwnerOf = textOwnerOf;
|
||||
}
|
||||
|
||||
private PutOnTopOrBottomLibraryTargetEffect(final PutOnTopOrBottomLibraryTargetEffect effect) {
|
||||
super(effect);
|
||||
this.position = effect.position;
|
||||
this.textOwnerOf = effect.textOwnerOf;
|
||||
}
|
||||
|
||||
|
|
@ -35,10 +43,14 @@ public class PutOnTopOrBottomLibraryTargetEffect extends OneShotEffect {
|
|||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
String message = position > 1 ? "into your library " + CardUtil.numberToOrdinalText(position) + " from the top or on the" : "on the top or";
|
||||
boolean onTop = player.chooseUse(
|
||||
Outcome.Detriment, "Put the targeted object on the top or bottom of your library?",
|
||||
Outcome.Detriment, "Put the targeted object " + message + " bottom of your library?",
|
||||
null, "Top", "Bottom", source, game
|
||||
);
|
||||
if (onTop && position > 1) {
|
||||
return new PutIntoLibraryNFromTopTargetEffect(position).apply(game, source);
|
||||
}
|
||||
return new PutOnLibraryTargetEffect(onTop).apply(game, source);
|
||||
}
|
||||
|
||||
|
|
@ -47,8 +59,23 @@ public class PutOnTopOrBottomLibraryTargetEffect extends OneShotEffect {
|
|||
if (staticText != null && !staticText.isEmpty()) {
|
||||
return staticText;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String targetText = getTargetPointer().describeTargets(mode.getTargets(), "that permanent");
|
||||
return (textOwnerOf ? "the owner of " + targetText : targetText + "'s owner") +
|
||||
" puts it on their choice of the top or bottom of their library";
|
||||
if (textOwnerOf) {
|
||||
sb.append("the owner of ");
|
||||
sb.append(targetText);
|
||||
} else {
|
||||
sb.append(targetText);
|
||||
sb.append("'s owner");
|
||||
}
|
||||
sb.append(" puts it");
|
||||
if (position > 1) {
|
||||
sb.append("into their library ");
|
||||
sb.append(CardUtil.numberToOrdinalText(position));
|
||||
sb.append(" from the top or on the bottom");
|
||||
} else {
|
||||
sb.append("on their choice of the top or bottom of their library");
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,92 @@
|
|||
package mage.abilities.effects.common.search;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.PutCards;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetCard;
|
||||
import mage.target.TargetPlayer;
|
||||
import mage.target.common.TargetCardInLibrary;
|
||||
import mage.target.common.TargetCardWithDifferentNameInLibrary;
|
||||
import mage.target.common.TargetOpponent;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class SearchLibraryForFourDifferentCardsEffect extends OneShotEffect {
|
||||
|
||||
private final FilterCard filter;
|
||||
private final PutCards putCards;
|
||||
private final boolean useTargetPointer;
|
||||
private static final FilterCard filter2 = new FilterCard("cards to put in graveyard");
|
||||
|
||||
public SearchLibraryForFourDifferentCardsEffect(FilterCard filter, PutCards putCards, boolean useTargetPointer) {
|
||||
super(Outcome.Benefit);
|
||||
this.filter = filter;
|
||||
this.putCards = putCards;
|
||||
this.useTargetPointer = useTargetPointer;
|
||||
staticText = "search your library for up to four " + filter +
|
||||
" with different names and reveal them. " + (useTargetPointer ? "Target" : "An") +
|
||||
" opponent chooses two of those cards. Put the chosen cards into your graveyard and the rest " +
|
||||
putCards.getMessage(false, false) + ", then shuffle";
|
||||
}
|
||||
|
||||
private SearchLibraryForFourDifferentCardsEffect(final SearchLibraryForFourDifferentCardsEffect effect) {
|
||||
super(effect);
|
||||
this.filter = effect.filter;
|
||||
this.putCards = effect.putCards;
|
||||
this.useTargetPointer = effect.useTargetPointer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SearchLibraryForFourDifferentCardsEffect copy() {
|
||||
return new SearchLibraryForFourDifferentCardsEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
TargetCardInLibrary targetCards = new TargetCardWithDifferentNameInLibrary(0, 4, filter);
|
||||
player.searchLibrary(targetCards, source, game);
|
||||
Cards cards = new CardsImpl(targetCards.getTargets());
|
||||
cards.retainZone(Zone.LIBRARY, game);
|
||||
player.revealCards(source, cards, game);
|
||||
if (cards.isEmpty()) {
|
||||
player.shuffleLibrary(source, game);
|
||||
return true;
|
||||
}
|
||||
|
||||
Cards toGrave = new CardsImpl();
|
||||
if (cards.size() > 2) {
|
||||
Player opponent;
|
||||
if (useTargetPointer) {
|
||||
opponent = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||
} else {
|
||||
TargetPlayer target = new TargetOpponent(true);
|
||||
player.choose(outcome, target, source, game);
|
||||
opponent = game.getPlayer(target.getFirstTarget());
|
||||
}
|
||||
if (opponent != null) {
|
||||
TargetCard targetDiscard = new TargetCard(2, Zone.LIBRARY, filter2);
|
||||
opponent.choose(Outcome.Discard, cards, targetDiscard, source, game);
|
||||
toGrave.addAll(targetDiscard.getTargets());
|
||||
}
|
||||
} else {
|
||||
toGrave.addAll(cards);
|
||||
}
|
||||
cards.removeAll(toGrave);
|
||||
player.moveCards(toGrave, Zone.GRAVEYARD, source, game);
|
||||
putCards.moveCards(player, cards, source, game);
|
||||
player.shuffleLibrary(source, game);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
package mage.game.permanent.token;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.keyword.FirebendingAbility;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class DragonFirebendingToken extends TokenImpl {
|
||||
|
||||
public DragonFirebendingToken() {
|
||||
super("Dragon Token", "4/4 red Dragon creature token with flying and firebending 4");
|
||||
cardType.add(CardType.CREATURE);
|
||||
color.setRed(true);
|
||||
subtype.add(SubType.DRAGON);
|
||||
power = new MageInt(4);
|
||||
toughness = new MageInt(4);
|
||||
addAbility(FlyingAbility.getInstance());
|
||||
addAbility(new FirebendingAbility(4));
|
||||
}
|
||||
|
||||
private DragonFirebendingToken(final DragonFirebendingToken token) {
|
||||
super(token);
|
||||
}
|
||||
|
||||
public DragonFirebendingToken copy() {
|
||||
return new DragonFirebendingToken(this);
|
||||
}
|
||||
}
|
||||
|
|
@ -2897,6 +2897,7 @@
|
|||
|Generate|TOK:TLA|Clue|3||ClueArtifactToken|
|
||||
|Generate|TOK:TLA|Clue|4||ClueArtifactToken|
|
||||
|Generate|TOK:TLA|Clue|5||ClueArtifactToken|
|
||||
|Generate|TOK:TLA|Dragon|||DragonFirebendingToken|
|
||||
|Generate|TOK:TLA|Food|1||FoodToken|
|
||||
|Generate|TOK:TLA|Food|2||FoodToken|
|
||||
|Generate|TOK:TLA|Food|3||FoodToken|
|
||||
|
|
@ -2989,4 +2990,4 @@
|
|||
|Generate|TOK:PL24|Dragon|||DragonToken|
|
||||
|
||||
# PL25
|
||||
|Generate|TOK:PL25|Snake|||SnakeToken|
|
||||
|Generate|TOK:PL25|Snake|||SnakeToken|
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue