mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
[KTK] Taigam's Scheming - Fixed wrong handling and tooltip text.
This commit is contained in:
parent
1240d9b57b
commit
7f13b7ba26
1 changed files with 78 additions and 3 deletions
|
@ -27,14 +27,23 @@
|
|||
*/
|
||||
package mage.sets.khansoftarkir;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.dynamicvalue.common.StaticValue;
|
||||
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetCard;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -49,7 +58,7 @@ public class TaigamsScheming extends CardImpl {
|
|||
this.color.setBlue(true);
|
||||
|
||||
// Look at the top five cards of your library. Put any number of them into your graveyard and the rest back on top of your library in any order
|
||||
this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect(new StaticValue(5) , false, new StaticValue(5), new FilterCard(), Zone.GRAVEYARD, true, false, true));
|
||||
this.getSpellAbility().addEffect(new TaigamsSchemingEffect());
|
||||
}
|
||||
|
||||
public TaigamsScheming(final TaigamsScheming card) {
|
||||
|
@ -61,3 +70,69 @@ public class TaigamsScheming extends CardImpl {
|
|||
return new TaigamsScheming(this);
|
||||
}
|
||||
}
|
||||
|
||||
class TaigamsSchemingEffect extends OneShotEffect {
|
||||
|
||||
public TaigamsSchemingEffect() {
|
||||
super(Outcome.Benefit);
|
||||
this.staticText = "Look at the top five cards of your library. Put any number of them into your graveyard and the rest back on top of your library in any order";
|
||||
}
|
||||
|
||||
public TaigamsSchemingEffect(final TaigamsSchemingEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TaigamsSchemingEffect copy() {
|
||||
return new TaigamsSchemingEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
if (controller != null && sourceObject != null) {
|
||||
boolean topCardRevealed = controller.isTopCardRevealed();
|
||||
controller.setTopCardRevealed(false);
|
||||
// get cards from top
|
||||
Cards cards = new CardsImpl();
|
||||
int count = Math.min(controller.getLibrary().size(), 5);
|
||||
if (count > 0) {
|
||||
cards.addAll(controller.getLibrary().getTopCards(game, count));
|
||||
controller.lookAtCards(sourceObject.getLogName(), cards, game);
|
||||
// pick cards going to graveyard
|
||||
TargetCard target = new TargetCard(0,5, Zone.LIBRARY, new FilterCard("cards to put into your graveyard"));
|
||||
if (controller.choose(Outcome.Detriment, cards, target, game)) {
|
||||
for (UUID cardId : (List<UUID>)target.getTargets()) {
|
||||
Card card = cards.get(cardId, game);
|
||||
if (card != null) {
|
||||
cards.remove(card);
|
||||
controller.moveCardToGraveyardWithInfo(card, source.getSourceId(), game, Zone.LIBRARY);
|
||||
}
|
||||
}
|
||||
}
|
||||
// The rest goes back to library in any order
|
||||
if (cards.size() > 0) {
|
||||
game.informPlayers(controller.getName() + " puts " + cards.size() + " card" + (cards.size() ==1 ? "":"s") + " back to his or her library");
|
||||
target = new TargetCard(Zone.LIBRARY, new FilterCard("card to put on your library (last chosen will be on top)"));
|
||||
while (controller.isInGame() && cards.size() > 1) {
|
||||
controller.choose(Outcome.Neutral, cards, target, game);
|
||||
Card card = cards.get(target.getFirstTarget(), game);
|
||||
if (card != null) {
|
||||
cards.remove(card);
|
||||
card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, true);
|
||||
}
|
||||
target.clearChosen();
|
||||
}
|
||||
if (cards.size() == 1) {
|
||||
Card card = cards.get(cards.iterator().next(), game);
|
||||
card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
controller.setTopCardRevealed(topCardRevealed);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue