mirror of
https://github.com/magefree/mage.git
synced 2026-01-25 20:59:14 -08:00
* Fixed some game locking loops if a player concedes while resolving an effect (e.g. Scry, Discard). Some changes to game log for info about moving cards to library.
This commit is contained in:
parent
dad109b88e
commit
8bd3109c87
19 changed files with 43 additions and 44 deletions
|
|
@ -167,6 +167,9 @@ class CascadeEffect extends OneShotEffect<CascadeEffect> {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Card card;
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
ExileZone exile = game.getExile().createZone(source.getSourceId(), player.getName() + " Cascade");
|
||||
Card stackCard = game.getCard(targetPointer.getFirst(game, source));
|
||||
if (stackCard == null) {
|
||||
|
|
@ -179,7 +182,7 @@ class CascadeEffect extends OneShotEffect<CascadeEffect> {
|
|||
break;
|
||||
}
|
||||
|
||||
card.moveToExile(exile.getId(), exile.getName(), source.getId(), game);
|
||||
player.moveCardToExileWithInfo(card, source.getId(), exile.getName(), source.getSourceId(), game, Zone.LIBRARY);
|
||||
} while (card.getCardType().contains(CardType.LAND) || card.getManaCost().convertedManaCost() >= sourceCost);
|
||||
|
||||
if (card != null) {
|
||||
|
|
@ -192,7 +195,7 @@ class CascadeEffect extends OneShotEffect<CascadeEffect> {
|
|||
while (exile.size() > 0) {
|
||||
card = exile.getRandom(game);
|
||||
exile.remove(card.getId());
|
||||
card.moveToZone(Zone.LIBRARY, source.getId(), game, false);
|
||||
player.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.EXILED, false, false);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -42,12 +42,10 @@ import mage.constants.Rarity;
|
|||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.Filter;
|
||||
import mage.filter.common.FilterCreatureCard;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
import mage.filter.predicate.mageobject.PowerPredicate;
|
||||
import mage.filter.predicate.mageobject.SubtypePredicate;
|
||||
import mage.filter.predicate.permanent.ControllerPredicate;
|
||||
import mage.game.Game;
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ class PainfulMemoriesEffect extends OneShotEffect<PainfulMemoriesEffect> {
|
|||
if (you.choose(Outcome.Benefit, targetPlayer.getHand(), target, game)) {
|
||||
Card card = targetPlayer.getHand().get(target.getFirstTarget(), game);
|
||||
if (card != null) {
|
||||
return targetPlayer.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.HAND, true);
|
||||
return targetPlayer.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.HAND, true, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -311,13 +311,13 @@ class JaceArchitectOfThoughtEffect2 extends OneShotEffect<JaceArchitectOfThought
|
|||
Card card = cardsToLibrary.get(targetCard.getFirstTarget(), game);
|
||||
if (card != null) {
|
||||
cardsToLibrary.remove(card);
|
||||
player.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.LIBRARY, false);
|
||||
player.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.LIBRARY, false, false);
|
||||
}
|
||||
target.clearChosen();
|
||||
}
|
||||
if (cardsToLibrary.size() == 1) {
|
||||
Card card = cardsToLibrary.get(cardsToLibrary.iterator().next(), game);
|
||||
player.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.LIBRARY, false);
|
||||
player.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.LIBRARY, false, false);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,14 +99,13 @@ class AgonizingMemoriesEffect extends OneShotEffect<AgonizingMemoriesEffect> {
|
|||
}
|
||||
|
||||
private void chooseCardInHandAndPutOnTopOfLibrary(Game game, Ability source, Player you, Player targetPlayer) {
|
||||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
if (targetPlayer.getHand().size() > 0) {
|
||||
TargetCard target = new TargetCard(Zone.PICK, new FilterCard("card to put on the top of library (last chosen will be on top)"));
|
||||
target.setRequired(true);
|
||||
if (you.choose(Outcome.Benefit, targetPlayer.getHand(), target, game)) {
|
||||
Card card = targetPlayer.getHand().get(target.getFirstTarget(), game);
|
||||
if (card != null) {
|
||||
targetPlayer.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.HAND, true);
|
||||
targetPlayer.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.HAND, true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ class GomazoaEffect extends OneShotEffect<GomazoaEffect> {
|
|||
List<UUID> players = new ArrayList<>();
|
||||
Permanent gomazoa = game.getPermanent(source.getSourceId());
|
||||
if (gomazoa != null) {
|
||||
controller.moveCardToLibraryWithInfo(gomazoa, source.getSourceId(), game, Zone.BATTLEFIELD, true);
|
||||
controller.moveCardToLibraryWithInfo(gomazoa, source.getSourceId(), game, Zone.BATTLEFIELD, true, true);
|
||||
players.add(gomazoa.getOwnerId());
|
||||
}
|
||||
|
||||
|
|
@ -123,7 +123,7 @@ class GomazoaEffect extends OneShotEffect<GomazoaEffect> {
|
|||
players.add(blockedByGomazoa.getOwnerId());
|
||||
Player owner = game.getPlayer(blockedByGomazoa.getOwnerId());
|
||||
if (owner != null) {
|
||||
owner.moveCardToLibraryWithInfo(blockedByGomazoa, source.getSourceId(), game, Zone.BATTLEFIELD, true);
|
||||
owner.moveCardToLibraryWithInfo(blockedByGomazoa, source.getSourceId(), game, Zone.BATTLEFIELD, true, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue