mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38: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)) {
|
if (!checkETBEffects(card, spell, null)) {
|
||||||
return AiPlayDecision.BadEtbEffects;
|
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;
|
return AiPlayDecision.BadEtbEffects;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1096,7 +1097,8 @@ public class AiController {
|
|||||||
CardCollection landsWannaPlay = getLandsToPlay();
|
CardCollection landsWannaPlay = getLandsToPlay();
|
||||||
if (landsWannaPlay != null && !landsWannaPlay.isEmpty() && player.canPlayLand(null)) {
|
if (landsWannaPlay != null && !landsWannaPlay.isEmpty() && player.canPlayLand(null)) {
|
||||||
Card land = chooseBestLandToPlay(landsWannaPlay);
|
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);
|
game.PLAY_LAND_SURROGATE.setHostCard(land);
|
||||||
final List<SpellAbility> abilities = new ArrayList<SpellAbility>();
|
final List<SpellAbility> abilities = new ArrayList<SpellAbility>();
|
||||||
abilities.add(game.PLAY_LAND_SURROGATE);
|
abilities.add(game.PLAY_LAND_SURROGATE);
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ public class ComputerUtilCost {
|
|||||||
amount = AbilityUtils.calculateAmount(source, payLife.getAmount(), sourceAbility);
|
amount = AbilityUtils.calculateAmount(source, payLife.getAmount(), sourceAbility);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ai.getLife() - amount) < remainingLife) {
|
if (ai.getLife() - amount < remainingLife && !ai.cantLoseForZeroOrLessLife()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -322,6 +322,9 @@ public class ComputerUtilCost {
|
|||||||
|
|
||||||
for (final CostPart part : cost.getCostParts()) {
|
for (final CostPart part : cost.getCostParts()) {
|
||||||
if (part instanceof CostPayLife) {
|
if (part instanceof CostPayLife) {
|
||||||
|
if (!ai.cantLoseForZeroOrLessLife()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
final int remainingLife = ai.getLife();
|
final int remainingLife = ai.getLife();
|
||||||
final int lifeCost = ((CostPayLife) part).convertAmount();
|
final int lifeCost = ((CostPayLife) part).convertAmount();
|
||||||
if ((remainingLife - lifeCost) < 10) {
|
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));
|
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()) {
|
for (Entry<ZoneType, CardCollectionView> kv : playerCards.entrySet()) {
|
||||||
if (kv.getKey() == ZoneType.Battlefield) {
|
if (kv.getKey() == ZoneType.Battlefield) {
|
||||||
List<Card> cards = new ArrayList<Card>();
|
List<Card> cards = new ArrayList<Card>();
|
||||||
|
|||||||
Reference in New Issue
Block a user