mirror of
https://github.com/correl/mage.git
synced 2025-03-13 01:09:53 -09:00
* Fixed a problem that you can see the second card from top of libraray while able to cancel the cast of the top card (fixes #3196).
This commit is contained in:
parent
db4dc81d5f
commit
eb9a18c07a
3 changed files with 17 additions and 4 deletions
Mage/src/main/java/mage
abilities/effects/common/continuous
game/stack
|
@ -32,7 +32,6 @@ import mage.abilities.Ability;
|
|||
import mage.abilities.effects.AsThoughEffectImpl;
|
||||
import mage.cards.Card;
|
||||
import mage.constants.AsThoughEffectType;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.filter.FilterCard;
|
||||
|
|
|
@ -34,7 +34,10 @@ import mage.constants.Duration;
|
|||
import mage.constants.Layer;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubLayer;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.game.stack.StackObject;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
|
@ -70,11 +73,11 @@ public class PlayWithTheTopCardRevealedEffect extends ContinuousEffectImpl {
|
|||
if (allPlayers) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
if (player != null && !isCastFromPlayersLibrary(game, playerId)) {
|
||||
player.setTopCardRevealed(true);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
} else if (!isCastFromPlayersLibrary(game, controller.getId())) {
|
||||
controller.setTopCardRevealed(true);
|
||||
}
|
||||
return true;
|
||||
|
@ -82,6 +85,16 @@ public class PlayWithTheTopCardRevealedEffect extends ContinuousEffectImpl {
|
|||
return false;
|
||||
}
|
||||
|
||||
boolean isCastFromPlayersLibrary(Game game, UUID playerId) {
|
||||
if (!game.getStack().isEmpty()) {
|
||||
StackObject stackObject = game.getStack().getLast();
|
||||
return stackObject instanceof Spell
|
||||
&& !((Spell) stackObject).isDoneActivatingManaAbilities()
|
||||
&& Zone.LIBRARY.equals(((Spell) stackObject).getFromZone());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlayWithTheTopCardRevealedEffect copy() {
|
||||
return new PlayWithTheTopCardRevealedEffect(this);
|
||||
|
|
|
@ -138,6 +138,7 @@ public class Spell extends StackObjImpl implements Card {
|
|||
}
|
||||
|
||||
public boolean activate(Game game, boolean noMana) {
|
||||
setDoneActivatingManaAbilities(false); // Used for e.g. improvise
|
||||
if (!spellAbilities.get(0).activate(game, noMana)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -157,7 +158,7 @@ public class Spell extends StackObjImpl implements Card {
|
|||
}
|
||||
}
|
||||
}
|
||||
setDoneActivatingManaAbilities(false); // can be activated again maybe during the resolution of the spell (e.g. Metallic Rebuke)
|
||||
setDoneActivatingManaAbilities(true); // can be activated again maybe during the resolution of the spell (e.g. Metallic Rebuke)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue