mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 04:08:01 +00:00
- The AI will no longer sacrifice the sourcecard of a GainLife ability unless it has 5 or less life.
This commit is contained in:
@@ -326,7 +326,7 @@ public class AbilityFactoryAlterLife {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (abCost != null && life > 5) {
|
if (abCost != null && life > 5) {
|
||||||
if (!CostUtil.checkSacrificeCost(abCost, source)) {
|
if (!CostUtil.checkSacrificeCost(abCost, source, false)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -348,7 +348,8 @@ public class AbilityFactoryAlterLife {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Don't use lifegain before main 2 if possible
|
// Don't use lifegain before main 2 if possible
|
||||||
if (Singletons.getModel().getGameState().getPhaseHandler().getPhase().isBefore(PhaseType.MAIN2) && !params.containsKey("ActivationPhases")) {
|
if (Singletons.getModel().getGameState().getPhaseHandler().getPhase().isBefore(PhaseType.MAIN2)
|
||||||
|
&& !params.containsKey("ActivationPhases")) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -47,6 +47,21 @@ public class CostUtil {
|
|||||||
* @return true, if successful
|
* @return true, if successful
|
||||||
*/
|
*/
|
||||||
public static boolean checkSacrificeCost(final Cost cost, final Card source) {
|
public static boolean checkSacrificeCost(final Cost cost, final Card source) {
|
||||||
|
return checkSacrificeCost(cost, source, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check sacrifice cost.
|
||||||
|
*
|
||||||
|
* @param cost
|
||||||
|
* the cost
|
||||||
|
* @param source
|
||||||
|
* the source
|
||||||
|
* @param important
|
||||||
|
* is the gain important enough?
|
||||||
|
* @return true, if successful
|
||||||
|
*/
|
||||||
|
public static boolean checkSacrificeCost(final Cost cost, final Card source, final boolean important) {
|
||||||
if (cost == null) {
|
if (cost == null) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -57,6 +72,9 @@ public class CostUtil {
|
|||||||
final String type = sac.getType();
|
final String type = sac.getType();
|
||||||
|
|
||||||
if (type.equals("CARDNAME")) {
|
if (type.equals("CARDNAME")) {
|
||||||
|
if (!important) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
CardList auras = new CardList(source.getEnchantedBy());
|
CardList auras = new CardList(source.getEnchantedBy());
|
||||||
if (!auras.getController(source.getController()).isEmpty()) {
|
if (!auras.getController(source.getController()).isEmpty()) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user