declareAttackers fixes

This commit is contained in:
Bug Hunter
2022-03-26 00:36:17 +00:00
committed by Anthony Calosa
parent bd4e3b56ac
commit c0ede21c31
9 changed files with 40 additions and 30 deletions

View File

@@ -47,6 +47,7 @@ import forge.game.cost.Cost;
import forge.game.keyword.Keyword;
import forge.game.player.Player;
import forge.game.spellability.SpellAbility;
import forge.game.spellability.SpellAbilityPredicates;
import forge.game.trigger.Trigger;
import forge.game.trigger.TriggerType;
import forge.game.zone.Zone;
@@ -135,13 +136,11 @@ public class AiAttackController {
if (c.isToken() && c.getCopiedPermanent() == null) {
continue;
}
for (SpellAbility sa : c.getSpellAbilities()) {
if (sa.getApi() == ApiType.Animate) {
if (ComputerUtilCost.canPayCost(sa, defender, false)
&& sa.getRestrictions().checkOtherRestrictions(c, sa, defender)) {
Card animatedCopy = AnimateAi.becomeAnimated(c, sa);
defenders.add(animatedCopy);
}
for (SpellAbility sa : Iterables.filter(c.getSpellAbilities(), SpellAbilityPredicates.isApi(ApiType.Animate))) {
if (ComputerUtilCost.canPayCost(sa, defender, false)
&& sa.getRestrictions().checkOtherRestrictions(c, sa, defender)) {
Card animatedCopy = AnimateAi.becomeAnimated(c, sa);
defenders.add(animatedCopy);
}
}
}

View File

@@ -1150,9 +1150,9 @@ public class AiBlockController {
//Check for validity of blocks in case something slipped through
for (Card attacker : attackers) {
if (!CombatUtil.canAttackerBeBlockedWithAmount(attacker, combat.getBlockers(attacker).size(), combat)) {
for (final Card blocker : combat.getBlockers(attacker)) {
if (blocker.getController() == ai) // don't touch other player's blockers
combat.removeFromCombat(blocker);
for (final Card blocker : CardLists.filterControlledBy(combat.getBlockers(attacker), ai)) {
// don't touch other player's blockers
combat.removeFromCombat(blocker);
}
}
}

View File

@@ -2037,7 +2037,7 @@ public class ComputerUtilCombat {
} // attacker no double strike
return false;// should never arrive here
} // canDestroyBlocker
}
/**
* <p>