From cd6e322c7cdb8e3a08aaa7234e25e0571e5ecb92 Mon Sep 17 00:00:00 2001 From: Hans Mackowiak Date: Sun, 10 Jul 2022 09:49:16 +0200 Subject: [PATCH] Player.isInGame --- .../forge/game/ability/effects/BondEffect.java | 2 +- .../src/main/java/forge/game/player/Player.java | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/forge-game/src/main/java/forge/game/ability/effects/BondEffect.java b/forge-game/src/main/java/forge/game/ability/effects/BondEffect.java index 3f03faa106e..4bde78949a4 100644 --- a/forge-game/src/main/java/forge/game/ability/effects/BondEffect.java +++ b/forge-game/src/main/java/forge/game/ability/effects/BondEffect.java @@ -21,7 +21,7 @@ public class BondEffect extends SpellAbilityEffect { // gameCard is LKI in that case, the card is not in game anymore // or the timestamp did change // this should check Self too - if (gameCard == null || !tgtC.equalsWithGameTimestamp(gameCard)) { + if (gameCard == null || !tgtC.equalsWithTimestamp(gameCard)) { continue; } if (gameCard.isPaired() || !gameCard.isCreature() || !gameCard.isInPlay() || gameCard.getController() != p) { diff --git a/forge-game/src/main/java/forge/game/player/Player.java b/forge-game/src/main/java/forge/game/player/Player.java index 17032b0e41b..78827701494 100644 --- a/forge-game/src/main/java/forge/game/player/Player.java +++ b/forge-game/src/main/java/forge/game/player/Player.java @@ -549,7 +549,7 @@ public class Player extends GameEntity implements Comparable { } public final boolean canGainLife() { - return !hasLost() && !StaticAbilityCantGainLosePayLife.anyCantGainLife(this); + return isInGame() && !StaticAbilityCantGainLosePayLife.anyCantGainLife(this); } public final int loseLife(int toLose, final boolean damage, final boolean manaBurn) { @@ -616,7 +616,7 @@ public class Player extends GameEntity implements Comparable { } public final boolean canLoseLife() { - return !hasLost() && !StaticAbilityCantGainLosePayLife.anyCantLoseLife(this); + return isInGame() && !StaticAbilityCantGainLosePayLife.anyCantLoseLife(this); } public final boolean canPayLife(final int lifePayment, final boolean effect, SpellAbility cause) { @@ -1987,6 +1987,10 @@ public class Player extends GameEntity implements Comparable { return getOutcome() != null && getOutcome().lossState == null; } + public final boolean isInGame() { + return getOutcome() == null; + } + public final boolean hasMetalcraft() { return CardLists.count(getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.ARTIFACTS) >= 3; } @@ -2545,10 +2549,7 @@ public class Player extends GameEntity implements Comparable { } public boolean isSkippingCombat() { - if (hasLost()) { - return true; - } - return false; + return !isInGame(); } public int getStartingHandSize() { @@ -3488,6 +3489,9 @@ public class Player extends GameEntity implements Comparable { } public void learnLesson(SpellAbility sa, CardZoneTable table, Map params) { + if (hasLost()) { + return; + } // Replacement effects Map repParams = AbilityKey.mapFromAffected(this); repParams.put(AbilityKey.Cause, sa);