mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
Merge branch 'master' into 'master'
Improve ProtectAi for cards that sacrifice themselves as a part of cost payment. See merge request core-developers/forge!2453
This commit is contained in:
@@ -5,11 +5,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
|
|
||||||
import forge.ai.AiAttackController;
|
import forge.ai.*;
|
||||||
import forge.ai.ComputerUtil;
|
|
||||||
import forge.ai.ComputerUtilCard;
|
|
||||||
import forge.ai.ComputerUtilCombat;
|
|
||||||
import forge.ai.SpellAbilityAi;
|
|
||||||
import forge.card.MagicColor;
|
import forge.card.MagicColor;
|
||||||
import forge.game.Game;
|
import forge.game.Game;
|
||||||
import forge.game.GameObject;
|
import forge.game.GameObject;
|
||||||
@@ -221,6 +217,11 @@ public class ProtectAi extends SpellAbilityAi {
|
|||||||
// Don't target cards that will die.
|
// Don't target cards that will die.
|
||||||
list = ComputerUtil.getSafeTargets(ai, sa, list);
|
list = ComputerUtil.getSafeTargets(ai, sa, list);
|
||||||
|
|
||||||
|
// Don't target self if the cost includes sacrificing itself
|
||||||
|
if (ComputerUtilCost.isSacrificeSelfCost(sa.getPayCosts())) {
|
||||||
|
list.remove(source);
|
||||||
|
}
|
||||||
|
|
||||||
if (list.isEmpty()) {
|
if (list.isEmpty()) {
|
||||||
return mandatory && protectMandatoryTarget(ai, sa, mandatory);
|
return mandatory && protectMandatoryTarget(ai, sa, mandatory);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user