mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
- Fixed AI stopping to play lands and permanents when life <= 0.
This commit is contained in:
@@ -1081,7 +1081,8 @@ public class AiController {
|
||||
if (!checkETBEffects(card, spell, null)) {
|
||||
return AiPlayDecision.BadEtbEffects;
|
||||
}
|
||||
if (ComputerUtil.damageFromETB(player, card) >= player.getLife() && player.canLoseLife()) {
|
||||
if (ComputerUtil.damageFromETB(player, card) >= player.getLife() && !player.cantLoseForZeroOrLessLife()
|
||||
&& player.canLoseLife()) {
|
||||
return AiPlayDecision.BadEtbEffects;
|
||||
}
|
||||
}
|
||||
@@ -1096,7 +1097,8 @@ public class AiController {
|
||||
CardCollection landsWannaPlay = getLandsToPlay();
|
||||
if (landsWannaPlay != null && !landsWannaPlay.isEmpty() && player.canPlayLand(null)) {
|
||||
Card land = chooseBestLandToPlay(landsWannaPlay);
|
||||
if (ComputerUtil.damageFromETB(player, land) < player.getLife() || !player.canLoseLife()) {
|
||||
if (ComputerUtil.damageFromETB(player, land) < player.getLife() || !player.canLoseLife()
|
||||
|| player.cantLoseForZeroOrLessLife() ) {
|
||||
game.PLAY_LAND_SURROGATE.setHostCard(land);
|
||||
final List<SpellAbility> abilities = new ArrayList<SpellAbility>();
|
||||
abilities.add(game.PLAY_LAND_SURROGATE);
|
||||
|
||||
@@ -177,7 +177,7 @@ public class ComputerUtilCost {
|
||||
amount = AbilityUtils.calculateAmount(source, payLife.getAmount(), sourceAbility);
|
||||
}
|
||||
|
||||
if ((ai.getLife() - amount) < remainingLife) {
|
||||
if (ai.getLife() - amount < remainingLife && !ai.cantLoseForZeroOrLessLife()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -322,6 +322,9 @@ public class ComputerUtilCost {
|
||||
|
||||
for (final CostPart part : cost.getCostParts()) {
|
||||
if (part instanceof CostPayLife) {
|
||||
if (!ai.cantLoseForZeroOrLessLife()) {
|
||||
continue;
|
||||
}
|
||||
final int remainingLife = ai.getLife();
|
||||
final int lifeCost = ((CostPayLife) part).convertAmount();
|
||||
if ((remainingLife - lifeCost) < 10) {
|
||||
|
||||
@@ -212,7 +212,7 @@ public abstract class GameState {
|
||||
playerCards.put(kv.getKey(), processCardsForZone(value.isEmpty() ? new String[0] : value.split(";"), p));
|
||||
}
|
||||
|
||||
if (life > 0) p.setLife(life, null);
|
||||
if (life >= 0) p.setLife(life, null);
|
||||
for (Entry<ZoneType, CardCollectionView> kv : playerCards.entrySet()) {
|
||||
if (kv.getKey() == ZoneType.Battlefield) {
|
||||
List<Card> cards = new ArrayList<Card>();
|
||||
|
||||
Reference in New Issue
Block a user