mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
* See the Truth - Fixed some problems of the implementation (#6646).
This commit is contained in:
parent
98feb0dd95
commit
146c9571ca
1 changed files with 18 additions and 19 deletions
|
@ -1,7 +1,6 @@
|
|||
package mage.cards.s;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.condition.common.CastFromHandSourceCondition;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
|
@ -13,9 +12,10 @@ import mage.constants.Zone;
|
|||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCardInLibrary;
|
||||
import mage.watchers.common.CastFromHandWatcher;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.game.stack.Spell;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
|
@ -27,7 +27,6 @@ public final class SeeTheTruth extends CardImpl {
|
|||
|
||||
// Look at the top three cards of your library. Put one of those cards into your hand and the rest on the bottom of your library in any order. If this spell was cast from anywhere other than your hand, put each of those cards into your hand instead.
|
||||
this.getSpellAbility().addEffect(new SeeTheTruthEffect());
|
||||
this.getSpellAbility().addWatcher(new CastFromHandWatcher());
|
||||
}
|
||||
|
||||
private SeeTheTruth(final SeeTheTruth card) {
|
||||
|
@ -44,10 +43,10 @@ class SeeTheTruthEffect extends OneShotEffect {
|
|||
|
||||
SeeTheTruthEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "Look at the top three cards of your library. " +
|
||||
"Put one of those cards into your hand and the rest on the bottom of your library in any order. " +
|
||||
"If this spell was cast from anywhere other than your hand, " +
|
||||
"put each of those cards into your hand instead.";
|
||||
staticText = "Look at the top three cards of your library. "
|
||||
+ "Put one of those cards into your hand and the rest on the bottom of your library in any order. "
|
||||
+ "If this spell was cast from anywhere other than your hand, "
|
||||
+ "put each of those cards into your hand instead.";
|
||||
}
|
||||
|
||||
private SeeTheTruthEffect(final SeeTheTruthEffect effect) {
|
||||
|
@ -62,21 +61,21 @@ class SeeTheTruthEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player == null) {
|
||||
Spell sourceSpell = game.getStack().getSpell(source.getId()); // Use id to get the correct spell in case of copied spells
|
||||
if (player == null || sourceSpell == null) {
|
||||
return false;
|
||||
}
|
||||
Cards cards = new CardsImpl(player.getLibrary().getTopCards(game, 3));
|
||||
if (cards.size() < 1) {
|
||||
return false;
|
||||
}
|
||||
if (CastFromHandSourceCondition.instance.apply(game, source)) {
|
||||
TargetCardInLibrary target = new TargetCardInLibrary();
|
||||
player.choose(outcome, cards, target, game);
|
||||
cards.removeIf(target.getFirstTarget()::equals);
|
||||
player.moveCards(game.getCard(target.getFirstTarget()), Zone.HAND, source, game);
|
||||
player.putCardsOnBottomOfLibrary(cards, game, source, true);
|
||||
} else {
|
||||
player.moveCards(cards, Zone.HAND, source, game);
|
||||
if (!cards.isEmpty()) {
|
||||
if (sourceSpell.isCopy() || Zone.HAND.equals(sourceSpell.getFromZone())) { // A copied spell was NOT cast at all
|
||||
TargetCardInLibrary target = new TargetCardInLibrary(new FilterCard("card to put into your hand"));
|
||||
player.chooseTarget(outcome, cards, target, source, game);
|
||||
cards.removeIf(target.getFirstTarget()::equals);
|
||||
player.moveCards(game.getCard(target.getFirstTarget()), Zone.HAND, source, game);
|
||||
player.putCardsOnBottomOfLibrary(cards, game, source, true);
|
||||
} else {
|
||||
player.moveCards(cards, Zone.HAND, source, game);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue