mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
* Unbreathing Horde - Fixed that the creature came onto battlefield with one counter less than intended.
This commit is contained in:
parent
9129bda9b7
commit
005a805973
5 changed files with 144 additions and 136 deletions
|
@ -96,6 +96,10 @@ class OblivionSowerEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
|
/*
|
||||||
|
8/25/2015: Oblivion Sower’s ability allows you to put any land cards the player owns from exile onto the battlefield, regardless of how those cards were exiled.
|
||||||
|
8/25/2015: Cards that are face down in exile have no characteristics. Such cards can’t be put onto the battlefield with Oblivion Sower’s ability.
|
||||||
|
*/
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source));
|
Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||||
if (controller != null && targetPlayer != null) {
|
if (controller != null && targetPlayer != null) {
|
||||||
|
|
|
@ -104,7 +104,7 @@ class UnbreathingHordeEffect1 extends OneShotEffect {
|
||||||
Player player = game.getPlayer(source.getControllerId());
|
Player player = game.getPlayer(source.getControllerId());
|
||||||
Permanent permanent = game.getPermanentEntering(source.getSourceId());
|
Permanent permanent = game.getPermanentEntering(source.getSourceId());
|
||||||
if (permanent != null && player != null) {
|
if (permanent != null && player != null) {
|
||||||
int amount = game.getBattlefield().countAll(filter1, source.getControllerId(), game) - 1;
|
int amount = game.getBattlefield().countAll(filter1, source.getControllerId(), game);
|
||||||
amount += player.getGraveyard().count(filter2, game);
|
amount += player.getGraveyard().count(filter2, game);
|
||||||
if (amount > 0) {
|
if (amount > 0) {
|
||||||
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
|
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
|
||||||
|
|
|
@ -49,6 +49,7 @@ import mage.target.TargetSpell;
|
||||||
public class MoltenInfluence extends CardImpl {
|
public class MoltenInfluence extends CardImpl {
|
||||||
|
|
||||||
private static final FilterSpell filter = new FilterSpell("instant or sorcery spell");
|
private static final FilterSpell filter = new FilterSpell("instant or sorcery spell");
|
||||||
|
|
||||||
static {
|
static {
|
||||||
Predicates.or(
|
Predicates.or(
|
||||||
new CardTypePredicate(CardType.INSTANT),
|
new CardTypePredicate(CardType.INSTANT),
|
||||||
|
@ -59,7 +60,6 @@ public class MoltenInfluence extends CardImpl {
|
||||||
super(ownerId, 207, "Molten Influence", Rarity.RARE, new CardType[]{CardType.INSTANT}, "{1}{R}");
|
super(ownerId, 207, "Molten Influence", Rarity.RARE, new CardType[]{CardType.INSTANT}, "{1}{R}");
|
||||||
this.expansionSetCode = "ODY";
|
this.expansionSetCode = "ODY";
|
||||||
|
|
||||||
|
|
||||||
// Counter target instant or sorcery spell unless its controller has Molten Influence deal 4 damage to him or her.
|
// Counter target instant or sorcery spell unless its controller has Molten Influence deal 4 damage to him or her.
|
||||||
this.getSpellAbility().addTarget(new TargetSpell(filter));
|
this.getSpellAbility().addTarget(new TargetSpell(filter));
|
||||||
this.getSpellAbility().addEffect(new MoltenInfluenceEffect());
|
this.getSpellAbility().addEffect(new MoltenInfluenceEffect());
|
||||||
|
@ -80,7 +80,7 @@ class MoltenInfluenceEffect extends OneShotEffect {
|
||||||
|
|
||||||
public MoltenInfluenceEffect() {
|
public MoltenInfluenceEffect() {
|
||||||
super(Outcome.Detriment);
|
super(Outcome.Detriment);
|
||||||
this.staticText = "Counter target instant or sorcery spell unless its controller has Molten Influence deal 4 damage to him or her";
|
this.staticText = "Counter target instant or sorcery spell unless its controller has {this} deal 4 damage to him or her";
|
||||||
}
|
}
|
||||||
|
|
||||||
public MoltenInfluenceEffect(final MoltenInfluenceEffect effect) {
|
public MoltenInfluenceEffect(final MoltenInfluenceEffect effect) {
|
||||||
|
|
|
@ -0,0 +1,65 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
* permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
|
* conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
* provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* The views and conclusions contained in the software and documentation are those of the
|
||||||
|
* authors and should not be interpreted as representing official policies, either expressed
|
||||||
|
* or implied, of BetaSteward_at_googlemail.com.
|
||||||
|
*/
|
||||||
|
package org.mage.test.cards.replacement.entersBattlefield;
|
||||||
|
|
||||||
|
import mage.constants.PhaseStep;
|
||||||
|
import mage.constants.Zone;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author LevelX2
|
||||||
|
*/
|
||||||
|
public class UnbreathingHordeTest extends CardTestPlayerBase {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* That the +1/+1 counters are added to Living Lore before state based
|
||||||
|
* actions take place
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testCountersAdded() {
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3);
|
||||||
|
// Unbreathing Horde enters the battlefield with a +1/+1 counter on it for each other Zombie you control and each Zombie card in your graveyard.
|
||||||
|
// If Unbreathing Horde would be dealt damage, prevent that damage and remove a +1/+1 counter from it.
|
||||||
|
addCard(Zone.HAND, playerA, "Unbreathing Horde"); //{2}{B} - 0/0
|
||||||
|
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Dross Crocodile", 2);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerB, "Dross Crocodile", 2);
|
||||||
|
addCard(Zone.GRAVEYARD, playerA, "Dross Crocodile", 2);
|
||||||
|
addCard(Zone.GRAVEYARD, playerB, "Dross Crocodile", 2);
|
||||||
|
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Unbreathing Horde");
|
||||||
|
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertPermanentCount(playerA, "Unbreathing Horde", 1);
|
||||||
|
assertPowerToughness(playerA, "Unbreathing Horde", 4, 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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,8 +1132,7 @@ 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, false)) {
|
||||||
ability.resolve(game);
|
ability.resolve(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