mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
- Fixed several bugs in isPreferredTarget.
This commit is contained in:
@@ -736,7 +736,8 @@ public class ChangeZoneAi extends SpellAbilityAi {
|
|||||||
for (Card attacker : attackers) {
|
for (Card attacker : attackers) {
|
||||||
List<Card> blockers = currCombat.getBlockers(attacker);
|
List<Card> blockers = currCombat.getBlockers(attacker);
|
||||||
// Save my attacker by bouncing a blocker
|
// Save my attacker by bouncing a blocker
|
||||||
if (attacker.getShield().isEmpty() && ComputerUtilCombat.attackerWouldBeDestroyed(ai, attacker, currCombat)
|
if (attacker.getController().equals(ai) && attacker.getShield().isEmpty()
|
||||||
|
&& ComputerUtilCombat.attackerWouldBeDestroyed(ai, attacker, currCombat)
|
||||||
&& !currCombat.getBlockers(attacker).isEmpty()) {
|
&& !currCombat.getBlockers(attacker).isEmpty()) {
|
||||||
ComputerUtilCard.sortByEvaluateCreature(blockers);
|
ComputerUtilCard.sortByEvaluateCreature(blockers);
|
||||||
Combat combat = new Combat(ai);
|
Combat combat = new Combat(ai);
|
||||||
@@ -755,9 +756,9 @@ public class ChangeZoneAi extends SpellAbilityAi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Save my blocker by bouncing the attacker (cannot handle blocking multiple attackers)
|
// Save my blocker by bouncing the attacker (cannot handle blocking multiple attackers)
|
||||||
if (!attacker.getController().equals(ai) && !blockers.isEmpty()) {
|
if (attacker.getController().isOpponentOf(ai) && !blockers.isEmpty()) {
|
||||||
for (Card blocker : blockers) {
|
for (Card blocker : blockers) {
|
||||||
if (ComputerUtilCombat.blockerWouldBeDestroyed(ai, blocker, currCombat)) {
|
if (ComputerUtilCombat.blockerWouldBeDestroyed(ai, blocker, currCombat) && sa.canTarget(attacker)) {
|
||||||
sa.getTargets().add(attacker);
|
sa.getTargets().add(attacker);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -896,7 +897,7 @@ public class ChangeZoneAi extends SpellAbilityAi {
|
|||||||
|
|
||||||
// Only care about combatants during combat
|
// Only care about combatants during combat
|
||||||
if (ai.getGame().getPhaseHandler().inCombat()) {
|
if (ai.getGame().getPhaseHandler().inCombat()) {
|
||||||
CardLists.getValidCards(list, "Card.attacking,Card.blocking", null, null);
|
list = CardLists.getValidCards(list, "Card.attacking,Card.blocking", null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (list.isEmpty()) {
|
if (list.isEmpty()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user