- Another little update to lifeInDanger.

This commit is contained in:
jendave
2011-08-07 00:10:32 +00:00
parent a97d845062
commit 8f69e6eaa4

View File

@@ -696,11 +696,14 @@ public class CombatUtil {
//Checks if the life of the attacked Player/Planeswalker is in danger //Checks if the life of the attacked Player/Planeswalker is in danger
public static boolean lifeInDanger(Combat combat) { public static boolean lifeInDanger(Combat combat) {
// life in danger only cares about the player's life. Not about a Planeswalkers life // life in danger only cares about the player's life. Not about a Planeswalkers life
if(AllZone.ComputerPlayer.cantLose() || AllZone.ComputerPlayer.cantLoseForZeroOrLessLife()) if(AllZone.ComputerPlayer.cantLose())
return false; return false;
return (lifeThatWouldRemain(combat) < Math.min(4, AllZone.ComputerPlayer.getLife()) if (lifeThatWouldRemain(combat) < Math.min(4, AllZone.ComputerPlayer.getLife())
|| resultingPoison(combat) > Math.max(7,AllZone.ComputerPlayer.getPoisonCounters())); && !AllZone.ComputerPlayer.cantLoseForZeroOrLessLife())
return true;
return (resultingPoison(combat) > Math.max(7,AllZone.ComputerPlayer.getPoisonCounters()));
} }
//Checks if the life of the attacked Player would be reduced //Checks if the life of the attacked Player would be reduced
@@ -712,8 +715,13 @@ public class CombatUtil {
//Checks if the life of the attacked Player/Planeswalker is in danger //Checks if the life of the attacked Player/Planeswalker is in danger
public static boolean lifeInSeriousDanger(Combat combat) { public static boolean lifeInSeriousDanger(Combat combat) {
// life in danger only cares about the player's life. Not about a Planeswalkers life // life in danger only cares about the player's life. Not about a Planeswalkers life
if(AllZone.ComputerPlayer.cantLose())
return false;
return (lifeThatWouldRemain(combat) < 1 || resultingPoison(combat) > 9); if (lifeThatWouldRemain(combat) < 1 && !AllZone.ComputerPlayer.cantLoseForZeroOrLessLife())
return true;
return (resultingPoison(combat) > 9);
} }
// This calculates the amount of damage a blockgang can deal to the attacker (first strike not supported) // This calculates the amount of damage a blockgang can deal to the attacker (first strike not supported)