mirror of
https://github.com/correl/mage.git
synced 2024-11-15 19:19:33 +00:00
* Fixed that cost modification with target check (Icefall Regent) did not work for flashbacked spells (fixes #1405).
This commit is contained in:
parent
956724b5fa
commit
9b683ef481
3 changed files with 123 additions and 140 deletions
|
@ -244,15 +244,15 @@ public class FlashbackTest extends CardTestPlayerBase {
|
||||||
assertGraveyardCount(playerA, "Silent Departure", 1);
|
assertGraveyardCount(playerA, "Silent Departure", 1);
|
||||||
assertGraveyardCount(playerA, "Runic Repetition", 1);
|
assertGraveyardCount(playerA, "Runic Repetition", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAltarsReap() {
|
public void testAltarsReap() {
|
||||||
|
|
||||||
addCard(Zone.LIBRARY, playerA, "Island", 2);
|
addCard(Zone.LIBRARY, playerA, "Island", 2);
|
||||||
addCard(Zone.GRAVEYARD, playerA, "Altar's Reap", 1);
|
addCard(Zone.GRAVEYARD, playerA, "Altar's Reap", 1);
|
||||||
addCard(Zone.BATTLEFIELD, playerA, "Underground Sea", 4);
|
addCard(Zone.BATTLEFIELD, playerA, "Underground Sea", 4);
|
||||||
addCard(Zone.HAND, playerA, "Snapcaster Mage", 1);
|
addCard(Zone.HAND, playerA, "Snapcaster Mage", 1);
|
||||||
|
|
||||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Snapcaster Mage");
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Snapcaster Mage");
|
||||||
setChoice(playerA, "Altar's Reap");
|
setChoice(playerA, "Altar's Reap");
|
||||||
|
|
||||||
|
@ -261,7 +261,48 @@ public class FlashbackTest extends CardTestPlayerBase {
|
||||||
|
|
||||||
setStopAt(1, PhaseStep.END_TURN);
|
setStopAt(1, PhaseStep.END_TURN);
|
||||||
execute();
|
execute();
|
||||||
|
|
||||||
assertGraveyardCount(playerA, "Snapcaster Mage", 1);
|
assertGraveyardCount(playerA, "Snapcaster Mage", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fracturing Gust is bugged. In a match against Affinity, it worked
|
||||||
|
* properly when cast from hand. When I cast it from graveyard c/o
|
||||||
|
* Snapcaster Mage flashback, it destroyed my opponent's Darksteel Citadels,
|
||||||
|
* which it did not do when cast from my hand.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testSnapcasterMageWithIcefallRegent() {
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Island", 2);
|
||||||
|
addCard(Zone.HAND, playerA, "Snapcaster Mage", 1);
|
||||||
|
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2);
|
||||||
|
|
||||||
|
// Destroy target creature. It can't be regenerated.
|
||||||
|
addCard(Zone.GRAVEYARD, playerA, "Terminate");
|
||||||
|
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Berserkers' Onslaught", 1);
|
||||||
|
|
||||||
|
addCard(Zone.BATTLEFIELD, playerB, "Icefall Regent", 1);
|
||||||
|
|
||||||
|
// When Snapcaster Mage enters the battlefield, target instant or sorcery card in your graveyard gains flashback until end of turn. The flashback cost is equal to its mana cost.
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Snapcaster Mage");
|
||||||
|
setChoice(playerA, "Terminate");
|
||||||
|
|
||||||
|
activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Flashback"); // Flashback Terminate
|
||||||
|
addTarget(playerA, "Icefall Regent");
|
||||||
|
setStopAt(1, PhaseStep.END_TURN);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertPermanentCount(playerA, "Snapcaster Mage", 1);
|
||||||
|
assertGraveyardCount(playerB, "Icefall Regent", 1);
|
||||||
|
assertExileCount("Terminate", 1);
|
||||||
|
|
||||||
|
assertTappedCount("Mountain", true, 2);
|
||||||
|
assertTappedCount("Island", true, 2);
|
||||||
|
assertTappedCount("Swamp", true, 2);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,6 +75,7 @@ public class FlashbackAbility extends SpellAbility {
|
||||||
this.timing = timingRule;
|
this.timing = timingRule;
|
||||||
this.usesStack = false;
|
this.usesStack = false;
|
||||||
this.spellAbilityType = SpellAbilityType.BASE_ALTERNATE;
|
this.spellAbilityType = SpellAbilityType.BASE_ALTERNATE;
|
||||||
|
setCostModificationActive(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public FlashbackAbility(final FlashbackAbility ability) {
|
public FlashbackAbility(final FlashbackAbility ability) {
|
||||||
|
@ -195,7 +196,9 @@ class FlashbackEffect extends OneShotEffect {
|
||||||
spellAbility.clear();
|
spellAbility.clear();
|
||||||
// set the payed flashback costs to the spell ability so abilities like Converge or calculation of {X} values work
|
// set the payed flashback costs to the spell ability so abilities like Converge or calculation of {X} values work
|
||||||
spellAbility.getManaCostsToPay().clear();
|
spellAbility.getManaCostsToPay().clear();
|
||||||
spellAbility.getManaCostsToPay().addAll(source.getManaCostsToPay());
|
spellAbility.getManaCostsToPay().addAll(source.getManaCosts());
|
||||||
|
spellAbility.getManaCosts().clear();
|
||||||
|
spellAbility.getManaCosts().addAll(source.getManaCosts());
|
||||||
// needed to get e.g. paid costs from Conflagrate
|
// needed to get e.g. paid costs from Conflagrate
|
||||||
for (Cost cost : source.getCosts()) {
|
for (Cost cost : source.getCosts()) {
|
||||||
if (!(cost instanceof VariableCost)) {
|
if (!(cost instanceof VariableCost)) {
|
||||||
|
@ -205,7 +208,7 @@ class FlashbackEffect extends OneShotEffect {
|
||||||
if (!game.isSimulation()) {
|
if (!game.isSimulation()) {
|
||||||
game.informPlayers(controller.getLogName() + " flashbacks " + card.getLogName());
|
game.informPlayers(controller.getLogName() + " flashbacks " + card.getLogName());
|
||||||
}
|
}
|
||||||
spellAbility.setCostModificationActive(false); // prevents to apply cost modification twice for flashbacked spells
|
// spellAbility.setCostModificationActive(false); // prevents to apply cost modification twice for flashbacked spells
|
||||||
if (controller.cast(spellAbility, game, false)) {
|
if (controller.cast(spellAbility, game, false)) {
|
||||||
ContinuousEffect effect = new FlashbackReplacementEffect();
|
ContinuousEffect effect = new FlashbackReplacementEffect();
|
||||||
effect.setTargetPointer(new FixedTarget(source.getSourceId(), game.getState().getZoneChangeCounter(source.getSourceId())));
|
effect.setTargetPointer(new FixedTarget(source.getSourceId(), game.getState().getZoneChangeCounter(source.getSourceId())));
|
||||||
|
|
|
@ -179,7 +179,9 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
protected Date dateLastAddedToStack; // F10
|
protected Date dateLastAddedToStack; // F10
|
||||||
protected boolean skippedAtLeastOnce; // used to track if passed started in specific phase
|
protected boolean skippedAtLeastOnce; // used to track if passed started in specific phase
|
||||||
/**
|
/**
|
||||||
* This indicates that player passed all turns until his own turn starts (F9). Note! This differs from passedTurn as it doesn't care about spells and abilities in the stack and will pass them as well.
|
* This indicates that player passed all turns until his own turn starts
|
||||||
|
* (F9). Note! This differs from passedTurn as it doesn't care about spells
|
||||||
|
* and abilities in the stack and will pass them as well.
|
||||||
*/
|
*/
|
||||||
protected boolean passedAllTurns; // F9
|
protected boolean passedAllTurns; // F9
|
||||||
protected AbilityType justActivatedType; // used to check if priority can be passed automatically
|
protected AbilityType justActivatedType; // used to check if priority can be passed automatically
|
||||||
|
@ -524,15 +526,13 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
inRange.add(player.getId());
|
inRange.add(player.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else if ((range.getRange() * 2) + 1 >= game.getPlayers().size()) {
|
||||||
else if ((range.getRange() * 2) + 1 >= game.getPlayers().size()) {
|
|
||||||
for (Player player : game.getPlayers().values()) {
|
for (Player player : game.getPlayers().values()) {
|
||||||
if (!player.hasLeft()) {
|
if (!player.hasLeft()) {
|
||||||
inRange.add(player.getId());
|
inRange.add(player.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
inRange.add(playerId);
|
inRange.add(playerId);
|
||||||
PlayerList players = game.getState().getPlayerList(playerId);
|
PlayerList players = game.getState().getPlayerList(playerId);
|
||||||
for (int i = 0; i < range.getRange(); i++) {
|
for (int i = 0; i < range.getRange(); i++) {
|
||||||
|
@ -595,7 +595,8 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* returns true if the player has the control itself - false if the player is controlled by another player
|
* returns true if the player has the control itself - false if the player
|
||||||
|
* is controlled by another player
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ -679,8 +680,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
if (card.getOwnerId().equals(playerId)) {
|
if (card.getOwnerId().equals(playerId)) {
|
||||||
card.setZone(Zone.HAND, game);
|
card.setZone(Zone.HAND, game);
|
||||||
this.hand.add(card);
|
this.hand.add(card);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return game.getPlayer(card.getOwnerId()).putInHand(card, game);
|
return game.getPlayer(card.getOwnerId()).putInHand(card, game);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -741,8 +741,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
discard(card, source, game);
|
discard(card, source, game);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
int possibleAmount = Math.min(getHand().size(), amount);
|
int possibleAmount = Math.min(getHand().size(), amount);
|
||||||
TargetDiscard target = new TargetDiscard(possibleAmount, possibleAmount, new FilterCard(CardUtil.numberToText(possibleAmount, "a") + " card" + (possibleAmount > 1 ? "s" : "")), playerId);
|
TargetDiscard target = new TargetDiscard(possibleAmount, possibleAmount, new FilterCard(CardUtil.numberToText(possibleAmount, "a") + " card" + (possibleAmount > 1 ? "s" : "")), playerId);
|
||||||
choose(Outcome.Discard, target, source == null ? null : source.getSourceId(), game);
|
choose(Outcome.Discard, target, source == null ? null : source.getSourceId(), game);
|
||||||
|
@ -836,8 +835,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
Permanent attachedTo = game.getPermanent(permanent.getAttachedTo());
|
Permanent attachedTo = game.getPermanent(permanent.getAttachedTo());
|
||||||
if (attachedTo != null) {
|
if (attachedTo != null) {
|
||||||
attachedTo.removeAttachment(permanent.getId(), game);
|
attachedTo.removeAttachment(permanent.getId(), game);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
Player attachedToPlayer = game.getPlayer(permanent.getAttachedTo());
|
Player attachedToPlayer = game.getPlayer(permanent.getAttachedTo());
|
||||||
if (attachedToPlayer != null) {
|
if (attachedToPlayer != null) {
|
||||||
attachedToPlayer.removeAttachment(permanent, game);
|
attachedToPlayer.removeAttachment(permanent, game);
|
||||||
|
@ -858,8 +856,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
public boolean putInGraveyard(Card card, Game game, boolean fromBattlefield) {
|
public boolean putInGraveyard(Card card, Game game, boolean fromBattlefield) {
|
||||||
if (card.getOwnerId().equals(playerId)) {
|
if (card.getOwnerId().equals(playerId)) {
|
||||||
this.graveyard.add(card);
|
this.graveyard.add(card);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return game.getPlayer(card.getOwnerId()).putInGraveyard(card, game, fromBattlefield);
|
return game.getPlayer(card.getOwnerId()).putInGraveyard(card, game, fromBattlefield);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -878,8 +875,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
for (UUID objectId : cards) {
|
for (UUID objectId : cards) {
|
||||||
moveObjectToLibrary(objectId, source == null ? null : source.getSourceId(), game, false, false);
|
moveObjectToLibrary(objectId, source == null ? null : source.getSourceId(), game, false, false);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
TargetCard target = new TargetCard(Zone.ALL, new FilterCard("card to put on the bottom of your library (last one chosen will be bottommost)"));
|
TargetCard target = new TargetCard(Zone.ALL, new FilterCard("card to put on the bottom of your library (last one chosen will be bottommost)"));
|
||||||
target.setRequired(true);
|
target.setRequired(true);
|
||||||
while (isInGame() && cards.size() > 1) {
|
while (isInGame() && cards.size() > 1) {
|
||||||
|
@ -915,8 +911,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
for (UUID cardId : cards) {
|
for (UUID cardId : cards) {
|
||||||
moveObjectToLibrary(cardId, sourceId, game, true, false);
|
moveObjectToLibrary(cardId, sourceId, game, true, false);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
TargetCard target = new TargetCard(Zone.LIBRARY, new FilterCard("card to put on the top of your library (last one chosen will be topmost)"));
|
TargetCard target = new TargetCard(Zone.LIBRARY, new FilterCard("card to put on the top of your library (last one chosen will be topmost)"));
|
||||||
target.setRequired(true);
|
target.setRequired(true);
|
||||||
while (isInGame() && cards.size() > 1) {
|
while (isInGame() && cards.size() > 1) {
|
||||||
|
@ -940,8 +935,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
Zone fromZone = game.getState().getZone(objectId);
|
Zone fromZone = game.getState().getZone(objectId);
|
||||||
if ((mageObject instanceof Permanent)) {
|
if ((mageObject instanceof Permanent)) {
|
||||||
return this.moveCardToLibraryWithInfo((Permanent) mageObject, sourceId, game, fromZone, toTop, withName);
|
return this.moveCardToLibraryWithInfo((Permanent) mageObject, sourceId, game, fromZone, toTop, withName);
|
||||||
}
|
} else if (mageObject instanceof Card) {
|
||||||
else if (mageObject instanceof Card) {
|
|
||||||
return this.moveCardToLibraryWithInfo((Card) mageObject, sourceId, game, fromZone, toTop, withName);
|
return this.moveCardToLibraryWithInfo((Card) mageObject, sourceId, game, fromZone, toTop, withName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -983,8 +977,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
boolean result;
|
boolean result;
|
||||||
if (card.getCardType().contains(CardType.LAND)) {
|
if (card.getCardType().contains(CardType.LAND)) {
|
||||||
result = playLand(card, game, ignoreTiming);
|
result = playLand(card, game, ignoreTiming);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
result = cast(card.getSpellAbility(), game, noMana);
|
result = cast(card.getSpellAbility(), game, noMana);
|
||||||
}
|
}
|
||||||
if (result == false) {
|
if (result == false) {
|
||||||
|
@ -1016,8 +1009,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
Costs<Cost> costs = getCastSourceIdCosts();
|
Costs<Cost> costs = getCastSourceIdCosts();
|
||||||
if (alternateCosts == null) {
|
if (alternateCosts == null) {
|
||||||
noMana = true;
|
noMana = true;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
spellAbility.getManaCosts().clear();
|
spellAbility.getManaCosts().clear();
|
||||||
spellAbility.getManaCostsToPay().clear();
|
spellAbility.getManaCostsToPay().clear();
|
||||||
spellAbility.getManaCosts().add(alternateCosts.copy());
|
spellAbility.getManaCosts().add(alternateCosts.copy());
|
||||||
|
@ -1111,8 +1103,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
if (storedBookmark == -1 || storedBookmark > bookmark) { // e.g. usefull for undo Nykthos, Shrine to Nyx
|
if (storedBookmark == -1 || storedBookmark > bookmark) { // e.g. usefull for undo Nykthos, Shrine to Nyx
|
||||||
setStoredBookmark(bookmark);
|
setStoredBookmark(bookmark);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
resetStoredBookmark(game);
|
resetStoredBookmark(game);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -1141,10 +1132,9 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
}
|
}
|
||||||
restoreState(bookmark, ability.getRule(), game);
|
restoreState(bookmark, ability.getRule(), game);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
int bookmark = game.bookmarkState();
|
int bookmark = game.bookmarkState();
|
||||||
if (ability.activate(game, false)) {
|
if (ability.activate(game, ability instanceof FlashbackAbility)) {
|
||||||
ability.resolve(game);
|
ability.resolve(game);
|
||||||
game.removeBookmark(bookmark);
|
game.removeBookmark(bookmark);
|
||||||
resetStoredBookmark(game);
|
resetStoredBookmark(game);
|
||||||
|
@ -1192,8 +1182,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
if (ability instanceof PlayLandAbility) {
|
if (ability instanceof PlayLandAbility) {
|
||||||
Card card = game.getCard(ability.getSourceId());
|
Card card = game.getCard(ability.getSourceId());
|
||||||
result = playLand(card, game, false);
|
result = playLand(card, game, false);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (!ability.canActivate(this.playerId, game)) {
|
if (!ability.canActivate(this.playerId, game)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1208,8 +1197,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
case SPELL:
|
case SPELL:
|
||||||
if (ability instanceof FlashbackAbility) {
|
if (ability instanceof FlashbackAbility) {
|
||||||
result = playAbility(ability.copy(), game);
|
result = playAbility(ability.copy(), game);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
result = cast((SpellAbility) ability, game, false);
|
result = cast((SpellAbility) ability, game, false);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1255,8 +1243,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
}
|
}
|
||||||
if (!ability.isUsesStack()) {
|
if (!ability.isUsesStack()) {
|
||||||
ability.resolve(game);
|
ability.resolve(game);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
game.fireEvent(new GameEvent(EventType.TRIGGERED_ABILITY, ability.getId(), ability.getSourceId(), ability.getControllerId()));
|
game.fireEvent(new GameEvent(EventType.TRIGGERED_ABILITY, ability.getId(), ability.getSourceId(), ability.getControllerId()));
|
||||||
}
|
}
|
||||||
game.removeBookmark(bookmark);
|
game.removeBookmark(bookmark);
|
||||||
|
@ -1277,8 +1264,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
useable.clear();
|
useable.clear();
|
||||||
useable.put(ability.getId(), (SpellAbility) ability);
|
useable.put(ability.getId(), (SpellAbility) ability);
|
||||||
return useable;
|
return useable;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// Fuse only allowed from hand
|
// Fuse only allowed from hand
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1307,12 +1293,10 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
if (((ActivatedAbility) ability).canActivate(playerId, game)) {
|
if (((ActivatedAbility) ability).canActivate(playerId, game)) {
|
||||||
useable.put(ability.getId(), (ActivatedAbility) ability);
|
useable.put(ability.getId(), (ActivatedAbility) ability);
|
||||||
}
|
}
|
||||||
}
|
} else if (canPlay(((ActivatedAbility) ability), availableMana, object, game)) {
|
||||||
else if (canPlay(((ActivatedAbility) ability), availableMana, object, game)) {
|
|
||||||
useable.put(ability.getId(), (ActivatedAbility) ability);
|
useable.put(ability.getId(), (ActivatedAbility) ability);
|
||||||
}
|
}
|
||||||
}
|
} else if (ability instanceof AlternativeSourceCosts) {
|
||||||
else if (ability instanceof AlternativeSourceCosts) {
|
|
||||||
if (object.getCardType().contains(CardType.LAND)) {
|
if (object.getCardType().contains(CardType.LAND)) {
|
||||||
for (Ability ability2 : object.getAbilities().copy()) {
|
for (Ability ability2 : object.getAbilities().copy()) {
|
||||||
if (ability2 instanceof PlayLandAbility) {
|
if (ability2 instanceof PlayLandAbility) {
|
||||||
|
@ -1370,8 +1354,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
// Left Half
|
// Left Half
|
||||||
if (card.getCardType().contains(CardType.INSTANT)) {
|
if (card.getCardType().contains(CardType.INSTANT)) {
|
||||||
flashbackAbility = new FlashbackAbility(((SplitCard) card).getLeftHalfCard().getManaCost(), TimingRule.INSTANT);
|
flashbackAbility = new FlashbackAbility(((SplitCard) card).getLeftHalfCard().getManaCost(), TimingRule.INSTANT);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
flashbackAbility = new FlashbackAbility(((SplitCard) card).getLeftHalfCard().getManaCost(), TimingRule.SORCERY);
|
flashbackAbility = new FlashbackAbility(((SplitCard) card).getLeftHalfCard().getManaCost(), TimingRule.SORCERY);
|
||||||
}
|
}
|
||||||
flashbackAbility.setSourceId(card.getId());
|
flashbackAbility.setSourceId(card.getId());
|
||||||
|
@ -1384,8 +1367,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
// Right Half
|
// Right Half
|
||||||
if (card.getCardType().contains(CardType.INSTANT)) {
|
if (card.getCardType().contains(CardType.INSTANT)) {
|
||||||
flashbackAbility = new FlashbackAbility(((SplitCard) card).getRightHalfCard().getManaCost(), TimingRule.INSTANT);
|
flashbackAbility = new FlashbackAbility(((SplitCard) card).getRightHalfCard().getManaCost(), TimingRule.INSTANT);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
flashbackAbility = new FlashbackAbility(((SplitCard) card).getRightHalfCard().getManaCost(), TimingRule.SORCERY);
|
flashbackAbility = new FlashbackAbility(((SplitCard) card).getRightHalfCard().getManaCost(), TimingRule.SORCERY);
|
||||||
}
|
}
|
||||||
flashbackAbility.setSourceId(card.getId());
|
flashbackAbility.setSourceId(card.getId());
|
||||||
|
@ -1396,8 +1378,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
useable.put(flashbackAbility.getId(), flashbackAbility);
|
useable.put(flashbackAbility.getId(), flashbackAbility);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
useable.put(ability.getId(), ability);
|
useable.put(ability.getId(), ability);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1453,8 +1434,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
public void revealCards(String name, Cards cards, Game game, boolean postToLog) {
|
public void revealCards(String name, Cards cards, Game game, boolean postToLog) {
|
||||||
if (postToLog) {
|
if (postToLog) {
|
||||||
game.getState().getRevealed().add(name, cards);
|
game.getState().getRevealed().add(name, cards);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
game.getState().getRevealed().update(name, cards);
|
game.getState().getRevealed().update(name, cards);
|
||||||
}
|
}
|
||||||
if (postToLog && !game.isSimulation()) {
|
if (postToLog && !game.isSimulation()) {
|
||||||
|
@ -1586,8 +1566,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// player selected an permanent that is restricted by another effect, disallow it (so AI can select another one)
|
// player selected an permanent that is restricted by another effect, disallow it (so AI can select another one)
|
||||||
filter.add(Predicates.not(new PermanentIdPredicate(selectedPermanent.getId())));
|
filter.add(Predicates.not(new PermanentIdPredicate(selectedPermanent.getId())));
|
||||||
if (this.isHuman() && !game.isSimulation()) {
|
if (this.isHuman() && !game.isSimulation()) {
|
||||||
|
@ -1625,8 +1604,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
//20091005 - 502.2
|
//20091005 - 502.2
|
||||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(playerId)) {
|
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(playerId)) {
|
||||||
boolean untap = true;
|
boolean untap = true;
|
||||||
|
@ -1721,8 +1699,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
// rule 118.5
|
// rule 118.5
|
||||||
if (life > this.life) {
|
if (life > this.life) {
|
||||||
gainLife(life - this.life, game);
|
gainLife(life - this.life, game);
|
||||||
}
|
} else if (life < this.life) {
|
||||||
else if (life < this.life) {
|
|
||||||
loseLife(this.life - life, game);
|
loseLife(this.life - life, game);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1822,31 +1799,26 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
StackObject stackObject = game.getStack().getStackObject(sourceId);
|
StackObject stackObject = game.getStack().getStackObject(sourceId);
|
||||||
if (stackObject != null) {
|
if (stackObject != null) {
|
||||||
source = stackObject.getStackAbility().getSourceObject(game);
|
source = stackObject.getStackAbility().getSourceObject(game);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
source = game.getObject(sourceId);
|
source = game.getObject(sourceId);
|
||||||
}
|
}
|
||||||
if (source instanceof Spell) {
|
if (source instanceof Spell) {
|
||||||
sourceAbilities = ((Spell) source).getAbilities(game);
|
sourceAbilities = ((Spell) source).getAbilities(game);
|
||||||
sourceControllerId = ((Spell) source).getControllerId();
|
sourceControllerId = ((Spell) source).getControllerId();
|
||||||
}
|
} else if (source instanceof Card) {
|
||||||
else if (source instanceof Card) {
|
|
||||||
sourceAbilities = ((Card) source).getAbilities(game);
|
sourceAbilities = ((Card) source).getAbilities(game);
|
||||||
sourceControllerId = ((Card) source).getOwnerId();
|
sourceControllerId = ((Card) source).getOwnerId();
|
||||||
}
|
} else if (source instanceof CommandObject) {
|
||||||
else if (source instanceof CommandObject) {
|
|
||||||
sourceControllerId = ((CommandObject) source).getControllerId();
|
sourceControllerId = ((CommandObject) source).getControllerId();
|
||||||
sourceAbilities = ((CommandObject) source).getAbilities();
|
sourceAbilities = ((CommandObject) source).getAbilities();
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sourceAbilities = ((Permanent) source).getAbilities(game);
|
sourceAbilities = ((Permanent) source).getAbilities(game);
|
||||||
sourceControllerId = ((Permanent) source).getControllerId();
|
sourceControllerId = ((Permanent) source).getControllerId();
|
||||||
}
|
}
|
||||||
if (sourceAbilities != null && sourceAbilities.containsKey(InfectAbility.getInstance().getId())) {
|
if (sourceAbilities != null && sourceAbilities.containsKey(InfectAbility.getInstance().getId())) {
|
||||||
addCounters(CounterType.POISON.createInstance(actualDamage), game);
|
addCounters(CounterType.POISON.createInstance(actualDamage), game);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
GameEvent damageToLifeLossEvent = new GameEvent(EventType.DAMAGE_CAUSES_LIFE_LOSS, playerId, sourceId, playerId, actualDamage, combatDamage);
|
GameEvent damageToLifeLossEvent = new GameEvent(EventType.DAMAGE_CAUSES_LIFE_LOSS, playerId, sourceId, playerId, actualDamage, combatDamage);
|
||||||
if (!game.replaceEvent(damageToLifeLossEvent)) {
|
if (!game.replaceEvent(damageToLifeLossEvent)) {
|
||||||
this.loseLife(damageToLifeLossEvent.getAmount(), game);
|
this.loseLife(damageToLifeLossEvent.getAmount(), game);
|
||||||
|
@ -2163,8 +2135,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
this.loses = true;
|
this.loses = true;
|
||||||
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.LOST, null, null, playerId));
|
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.LOST, null, null, playerId));
|
||||||
game.informPlayers(this.getLogName() + " has lost the game.");
|
game.informPlayers(this.getLogName() + " has lost the game.");
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
logger.debug(this.getName() + " has already won - stop lost");
|
logger.debug(this.getName() + " has already won - stop lost");
|
||||||
}
|
}
|
||||||
// for draw - first all players that have lost have to be set to lost
|
// for draw - first all players that have lost have to be set to lost
|
||||||
|
@ -2219,8 +2190,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
this.wins = true;
|
this.wins = true;
|
||||||
game.end();
|
game.end();
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
logger.debug("player won -> but already lost before: " + this.getName());
|
logger.debug("player won -> but already lost before: " + this.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2245,8 +2215,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
public boolean hasWon() {
|
public boolean hasWon() {
|
||||||
if (!this.loses) {
|
if (!this.loses) {
|
||||||
return this.wins;
|
return this.wins;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2274,8 +2243,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
if (blocker != null && group != null && group.canBlock(blocker, game)) {
|
if (blocker != null && group != null && group.canBlock(blocker, game)) {
|
||||||
group.addBlocker(blockerId, playerId, game);
|
group.addBlocker(blockerId, playerId, game);
|
||||||
game.getCombat().addBlockingGroup(blockerId, attackerId, playerId, game);
|
game.getCombat().addBlockingGroup(blockerId, attackerId, playerId, game);
|
||||||
}
|
} else if (this.isHuman() && !game.isSimulation()) {
|
||||||
else if (this.isHuman() && !game.isSimulation()) {
|
|
||||||
game.informPlayer(this, "You can't block this creature.");
|
game.informPlayer(this, "You can't block this creature.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2293,8 +2261,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
if (targetPlayerId.equals(playerId)) {
|
if (targetPlayerId.equals(playerId)) {
|
||||||
searchInfo = getLogName() + " searches his or her library";
|
searchInfo = getLogName() + " searches his or her library";
|
||||||
searchedLibrary = library;
|
searchedLibrary = library;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
Player targetPlayer = game.getPlayer(targetPlayerId);
|
Player targetPlayer = game.getPlayer(targetPlayerId);
|
||||||
if (targetPlayer != null) {
|
if (targetPlayer != null) {
|
||||||
searchInfo = getLogName() + " searches the library of " + targetPlayer.getLogName();
|
searchInfo = getLogName() + " searches the library of " + targetPlayer.getLogName();
|
||||||
|
@ -2314,8 +2281,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
int librarySearchLimit = event.getAmount();
|
int librarySearchLimit = event.getAmount();
|
||||||
if (librarySearchLimit == Integer.MAX_VALUE) {
|
if (librarySearchLimit == Integer.MAX_VALUE) {
|
||||||
count = searchedLibrary.count(target.getFilter(), game);
|
count = searchedLibrary.count(target.getFilter(), game);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
newTarget.setCardLimit(librarySearchLimit);
|
newTarget.setCardLimit(librarySearchLimit);
|
||||||
count = Math.min(searchedLibrary.count(target.getFilter(), game), librarySearchLimit);
|
count = Math.min(searchedLibrary.count(target.getFilter(), game), librarySearchLimit);
|
||||||
}
|
}
|
||||||
|
@ -2408,8 +2374,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
if (canAdd) {
|
if (canAdd) {
|
||||||
if (withCost) {
|
if (withCost) {
|
||||||
sourceWithCosts.add(manaAbilities);
|
sourceWithCosts.add(manaAbilities);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sourceWithoutManaCosts.add(manaAbilities);
|
sourceWithoutManaCosts.add(manaAbilities);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2513,8 +2478,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
ManaOptions abilityOptions = copy.getManaCostsToPay().getOptions();
|
ManaOptions abilityOptions = copy.getManaCostsToPay().getOptions();
|
||||||
if (abilityOptions.isEmpty()) {
|
if (abilityOptions.isEmpty()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (available == null) {
|
if (available == null) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -2562,8 +2526,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
|
|
||||||
if (manaCosts.size() == 0) {
|
if (manaCosts.size() == 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (available == null) {
|
if (available == null) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -2594,8 +2557,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
|
|
||||||
if (manaCosts.size() == 0) {
|
if (manaCosts.size() == 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
for (Mana mana : manaCosts.getOptions()) {
|
for (Mana mana : manaCosts.getOptions()) {
|
||||||
for (Mana avail : available) {
|
for (Mana avail : available) {
|
||||||
if (mana.enough(avail)) {
|
if (mana.enough(avail)) {
|
||||||
|
@ -2632,8 +2594,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
|
|
||||||
if (manaCosts.size() == 0) {
|
if (manaCosts.size() == 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
for (Mana mana : manaCosts.getOptions()) {
|
for (Mana mana : manaCosts.getOptions()) {
|
||||||
for (Mana avail : available) {
|
for (Mana avail : available) {
|
||||||
if (mana.enough(avail)) {
|
if (mana.enough(avail)) {
|
||||||
|
@ -2670,14 +2631,12 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
playable.add(ability);
|
playable.add(ability);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else if (ability instanceof AlternativeSourceCosts) {
|
||||||
else if (ability instanceof AlternativeSourceCosts) {
|
|
||||||
if (card.getCardType().contains(CardType.LAND)) {
|
if (card.getCardType().contains(CardType.LAND)) {
|
||||||
if (canLandPlayAlternateSourceCostsAbility(card, availableMana, ability, game)) { // e.g. Land with Morph
|
if (canLandPlayAlternateSourceCostsAbility(card, availableMana, ability, game)) { // e.g. Land with Morph
|
||||||
playable.add(ability);
|
playable.add(ability);
|
||||||
}
|
}
|
||||||
}
|
} else if (card.getCardType().contains(CardType.CREATURE)) { // e.g. makes a card available for play by Morph if the card may not be cast normally
|
||||||
else if (card.getCardType().contains(CardType.CREATURE)) { // e.g. makes a card available for play by Morph if the card may not be cast normally
|
|
||||||
if (!playable.contains(card.getSpellAbility())) {
|
if (!playable.contains(card.getSpellAbility())) {
|
||||||
if (((AlternativeSourceCosts) ability).isAvailable(card.getSpellAbility(), game)) {
|
if (((AlternativeSourceCosts) ability).isAvailable(card.getSpellAbility(), game)) {
|
||||||
playable.add(card.getSpellAbility());
|
playable.add(card.getSpellAbility());
|
||||||
|
@ -2695,8 +2654,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
boolean possible = false;
|
boolean possible = false;
|
||||||
if (ability.getZone().match(Zone.GRAVEYARD)) {
|
if (ability.getZone().match(Zone.GRAVEYARD)) {
|
||||||
possible = true;
|
possible = true;
|
||||||
}
|
} else if (ability.getZone().match(Zone.HAND) && (ability instanceof SpellAbility || ability instanceof PlayLandAbility)) {
|
||||||
else if (ability.getZone().match(Zone.HAND) && (ability instanceof SpellAbility || ability instanceof PlayLandAbility)) {
|
|
||||||
if (asThoughtCast || canPlayCardsFromGraveyard()) {
|
if (asThoughtCast || canPlayCardsFromGraveyard()) {
|
||||||
possible = true;
|
possible = true;
|
||||||
}
|
}
|
||||||
|
@ -2847,7 +2805,8 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Skip "silent" phase step when players are not allowed to cast anything. E.g. players can't play or cast anything during declaring attackers.
|
* Skip "silent" phase step when players are not allowed to cast anything.
|
||||||
|
* E.g. players can't play or cast anything during declaring attackers.
|
||||||
*
|
*
|
||||||
* @param game
|
* @param game
|
||||||
* @return
|
* @return
|
||||||
|
@ -2879,17 +2838,14 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
|
|
||||||
if (ability.isModal()) {
|
if (ability.isModal()) {
|
||||||
addModeOptions(options, ability, game);
|
addModeOptions(options, ability, game);
|
||||||
}
|
} else if (ability.getTargets().getUnchosen().size() > 0) {
|
||||||
else if (ability.getTargets().getUnchosen().size() > 0) {
|
|
||||||
// TODO: Handle other variable costs than mana costs
|
// TODO: Handle other variable costs than mana costs
|
||||||
if (ability.getManaCosts().getVariableCosts().size() > 0) {
|
if (ability.getManaCosts().getVariableCosts().size() > 0) {
|
||||||
addVariableXOptions(options, ability, 0, game);
|
addVariableXOptions(options, ability, 0, game);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
addTargetOptions(options, ability, 0, game);
|
addTargetOptions(options, ability, 0, game);
|
||||||
}
|
}
|
||||||
}
|
} else if (ability.getCosts().getTargets().getUnchosen().size() > 0) {
|
||||||
else if (ability.getCosts().getTargets().getUnchosen().size() > 0) {
|
|
||||||
addCostTargetOptions(options, ability, 0, game);
|
addCostTargetOptions(options, ability, 0, game);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2906,15 +2862,12 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
if (newOption.getTargets().getUnchosen().size() > 0) {
|
if (newOption.getTargets().getUnchosen().size() > 0) {
|
||||||
if (newOption.getManaCosts().getVariableCosts().size() > 0) {
|
if (newOption.getManaCosts().getVariableCosts().size() > 0) {
|
||||||
addVariableXOptions(options, newOption, 0, game);
|
addVariableXOptions(options, newOption, 0, game);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
addTargetOptions(options, newOption, 0, game);
|
addTargetOptions(options, newOption, 0, game);
|
||||||
}
|
}
|
||||||
}
|
} else if (newOption.getCosts().getTargets().getUnchosen().size() > 0) {
|
||||||
else if (newOption.getCosts().getTargets().getUnchosen().size() > 0) {
|
|
||||||
addCostTargetOptions(options, newOption, 0, game);
|
addCostTargetOptions(options, newOption, 0, game);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
options.add(newOption);
|
options.add(newOption);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2932,19 +2885,16 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
int amount = target.getTargetAmount(targetId);
|
int amount = target.getTargetAmount(targetId);
|
||||||
newOption.getTargets().get(targetNum).addTarget(targetId, amount, newOption, game, true);
|
newOption.getTargets().get(targetNum).addTarget(targetId, amount, newOption, game, true);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
for (UUID targetId : target.getTargets()) {
|
for (UUID targetId : target.getTargets()) {
|
||||||
newOption.getTargets().get(targetNum).addTarget(targetId, newOption, game, true);
|
newOption.getTargets().get(targetNum).addTarget(targetId, newOption, game, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (targetNum < option.getTargets().size() - 2) {
|
if (targetNum < option.getTargets().size() - 2) {
|
||||||
addTargetOptions(options, newOption, targetNum + 1, game);
|
addTargetOptions(options, newOption, targetNum + 1, game);
|
||||||
}
|
} else if (option.getCosts().getTargets().size() > 0) {
|
||||||
else if (option.getCosts().getTargets().size() > 0) {
|
|
||||||
addCostTargetOptions(options, newOption, 0, game);
|
addCostTargetOptions(options, newOption, 0, game);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
options.add(newOption);
|
options.add(newOption);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2956,8 +2906,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
newOption.getCosts().getTargets().get(targetNum).addTarget(targetId, option, game, true);
|
newOption.getCosts().getTargets().get(targetNum).addTarget(targetId, option, game, true);
|
||||||
if (targetNum < option.getCosts().getTargets().size() - 1) {
|
if (targetNum < option.getCosts().getTargets().size() - 1) {
|
||||||
addCostTargetOptions(options, newOption, targetNum + 1, game);
|
addCostTargetOptions(options, newOption, targetNum + 1, game);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
options.add(newOption);
|
options.add(newOption);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3165,16 +3114,14 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
cardList.add(permanent);
|
cardList.add(permanent);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
Card card = game.getCard(cardId);
|
Card card = game.getCard(cardId);
|
||||||
if (card == null) {
|
if (card == null) {
|
||||||
Spell spell = game.getState().getStack().getSpell(cardId);
|
Spell spell = game.getState().getStack().getSpell(cardId);
|
||||||
if (spell != null) {
|
if (spell != null) {
|
||||||
if (!spell.isCopy()) {
|
if (!spell.isCopy()) {
|
||||||
card = spell.getCard();
|
card = spell.getCard();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// If a spell is returned to its owner's hand, it's removed from the stack and thus will not resolve
|
// If a spell is returned to its owner's hand, it's removed from the stack and thus will not resolve
|
||||||
game.getStack().remove(spell);
|
game.getStack().remove(spell);
|
||||||
game.informPlayers(spell.getLogName() + " was removed from the stack");
|
game.informPlayers(spell.getLogName() + " was removed from the stack");
|
||||||
|
@ -3272,8 +3219,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
Permanent permanent;
|
Permanent permanent;
|
||||||
if (card instanceof MeldCard) {
|
if (card instanceof MeldCard) {
|
||||||
permanent = new PermanentMeld(card, event.getPlayerId(), game);// controlling player can be replaced so use event player now
|
permanent = new PermanentMeld(card, event.getPlayerId(), game);// controlling player can be replaced so use event player now
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
permanent = new PermanentCard(card, event.getPlayerId(), game);// controlling player can be replaced so use event player now
|
permanent = new PermanentCard(card, event.getPlayerId(), game);// controlling player can be replaced so use event player now
|
||||||
}
|
}
|
||||||
permanents.add(permanent);
|
permanents.add(permanent);
|
||||||
|
@ -3293,8 +3239,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
game.getContinuousEffects().setController(permanent.getId(), permanent.getControllerId());
|
game.getContinuousEffects().setController(permanent.getId(), permanent.getControllerId());
|
||||||
if (permanent.entersBattlefield(source.getSourceId(), game, fromZone, true)) {
|
if (permanent.entersBattlefield(source.getSourceId(), game, fromZone, true)) {
|
||||||
permanentsEntered.add(permanent);
|
permanentsEntered.add(permanent);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// revert controller to owner if permanent does not enter
|
// revert controller to owner if permanent does not enter
|
||||||
game.getContinuousEffects().setController(permanent.getId(), permanent.getOwnerId());
|
game.getContinuousEffects().setController(permanent.getId(), permanent.getOwnerId());
|
||||||
game.getPermanentsEntering().remove(permanent.getId());
|
game.getPermanentsEntering().remove(permanent.getId());
|
||||||
|
@ -3314,8 +3259,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
game.informPlayers(this.getLogName() + " puts " + (faceDown ? "a card face down " : permanent.getLogName())
|
game.informPlayers(this.getLogName() + " puts " + (faceDown ? "a card face down " : permanent.getLogName())
|
||||||
+ " from " + fromZone.toString().toLowerCase(Locale.ENGLISH) + " onto the Battlefield");
|
+ " from " + fromZone.toString().toLowerCase(Locale.ENGLISH) + " onto the Battlefield");
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
game.getPermanentsEntering().remove(permanent.getId());
|
game.getPermanentsEntering().remove(permanent.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3349,8 +3293,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
for (Card card : cards) {
|
for (Card card : cards) {
|
||||||
if (card instanceof Spell) {
|
if (card instanceof Spell) {
|
||||||
fromZone = game.getState().getZone(((Spell) card).getSourceId());
|
fromZone = game.getState().getZone(((Spell) card).getSourceId());
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
fromZone = game.getState().getZone(card.getId());
|
fromZone = game.getState().getZone(card.getId());
|
||||||
}
|
}
|
||||||
boolean hideCard = fromZone.equals(Zone.HAND) || fromZone.equals(Zone.LIBRARY);
|
boolean hideCard = fromZone.equals(Zone.HAND) || fromZone.equals(Zone.LIBRARY);
|
||||||
|
@ -3468,8 +3411,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
movedCards.add(card);
|
movedCards.add(card);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
for (Card card : cards.getCards(game)) {
|
for (Card card : cards.getCards(game)) {
|
||||||
if (choosingPlayer.moveCardToGraveyardWithInfo(card, sourceId, game, fromZone)) {
|
if (choosingPlayer.moveCardToGraveyardWithInfo(card, sourceId, game, fromZone)) {
|
||||||
movedCards.add(card);
|
movedCards.add(card);
|
||||||
|
@ -3495,8 +3437,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
.append(fromZone != null ? "from " + fromZone.toString().toLowerCase(Locale.ENGLISH) + " " : "");
|
.append(fromZone != null ? "from " + fromZone.toString().toLowerCase(Locale.ENGLISH) + " " : "");
|
||||||
if (card.getOwnerId().equals(getId())) {
|
if (card.getOwnerId().equals(getId())) {
|
||||||
sb.append("into his or her graveyard");
|
sb.append("into his or her graveyard");
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sb.append("it into its owner's graveyard");
|
sb.append("it into its owner's graveyard");
|
||||||
}
|
}
|
||||||
game.informPlayers(sb.toString());
|
game.informPlayers(sb.toString());
|
||||||
|
@ -3522,8 +3463,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
sb.append("to the ").append(toTop ? "top" : "bottom");
|
sb.append("to the ").append(toTop ? "top" : "bottom");
|
||||||
if (card.getOwnerId().equals(getId())) {
|
if (card.getOwnerId().equals(getId())) {
|
||||||
sb.append(" of his or her library");
|
sb.append(" of his or her library");
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
Player player = game.getPlayer(card.getOwnerId());
|
Player player = game.getPlayer(card.getOwnerId());
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
sb.append(" of ").append(player.getLogName()).append("'s library");
|
sb.append(" of ").append(player.getLogName()).append("'s library");
|
||||||
|
@ -3655,8 +3595,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
String text;
|
String text;
|
||||||
if (cards.size() == 1) {
|
if (cards.size() == 1) {
|
||||||
text = "card if you want to put it to the bottom of your library (Scry)";
|
text = "card if you want to put it to the bottom of your library (Scry)";
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
text = "cards you want to put on the bottom of your library (Scry)";
|
text = "cards you want to put on the bottom of your library (Scry)";
|
||||||
}
|
}
|
||||||
TargetCard target = new TargetCard(0, cards.size(), Zone.LIBRARY, new FilterCard(text));
|
TargetCard target = new TargetCard(0, cards.size(), Zone.LIBRARY, new FilterCard(text));
|
||||||
|
|
Loading…
Reference in a new issue