Player.isInGame

This commit is contained in:
Hans Mackowiak
2022-07-10 09:49:16 +02:00
parent 840bf26065
commit cd6e322c7c
2 changed files with 11 additions and 7 deletions

View File

@@ -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) {

View File

@@ -549,7 +549,7 @@ public class Player extends GameEntity implements Comparable<Player> {
}
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<Player> {
}
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<Player> {
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<Player> {
}
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<Player> {
}
public void learnLesson(SpellAbility sa, CardZoneTable table, Map<AbilityKey, Object> params) {
if (hasLost()) {
return;
}
// Replacement effects
Map<AbilityKey, Object> repParams = AbilityKey.mapFromAffected(this);
repParams.put(AbilityKey.Cause, sa);