- Blocking by the AI should no longer freeze. Please post any errors. Small attack AI adjustments.

This commit is contained in:
jeffwadsworth 2012-11-07 14:58:26 -06:00
parent 14a4a786e8
commit ad035f1e47
2 changed files with 13 additions and 8 deletions

View file

@ -1094,14 +1094,18 @@ public class ComputerPlayer6 extends ComputerPlayer<ComputerPlayer6> implements
if (attacker.getToughness().getValue() == blocker.getPower().getValue()
&& attacker.getPower().getValue() == blocker.getToughness().getValue()) {
if (attackerValue < blockerValue
if (attackerValue > blockerValue
|| blocker.getAbilities().containsKey(FirstStrikeAbility.getInstance().getId())
|| blocker.getAbilities().containsKey(DoubleStrikeAbility.getInstance().getId())) {
|| blocker.getAbilities().containsKey(DoubleStrikeAbility.getInstance().getId())
|| blocker.getAbilities().contains(new ExaltedAbility())
|| blocker.getAbilities().containsKey(DeathtouchAbility.getInstance().getId())
|| blocker.getAbilities().contains(new IndestructibleAbility())) {
safeToAttack = false;
}
}
}
if (attacker.getAbilities().containsKey(DeathtouchAbility.getInstance().getId())) {
if (attacker.getAbilities().containsKey(DeathtouchAbility.getInstance().getId())
|| attacker.getAbilities().contains(new IndestructibleAbility())) {
safeToAttack = true;
}
if (safeToAttack) {

View file

@ -222,8 +222,8 @@ public class CombatUtil {
simulateStep(sim, new FirstCombatDamageStep());
simulateStep(sim, new CombatDamageStep());
simulateStep(sim, new EndOfCombatStep());
sim.checkStateAndTriggered();
// The following commented out call produces random freezes.
//sim.checkStateAndTriggered();
while (!sim.getStack().isEmpty()) {
sim.getStack().resolve(sim);
sim.applyEffects();
@ -255,8 +255,8 @@ public class CombatUtil {
simulateStep(sim, new FirstCombatDamageStep());
simulateStep(sim, new CombatDamageStep());
simulateStep(sim, new EndOfCombatStep());
sim.checkStateAndTriggered();
// The following commented out call produces random freezes.
//sim.checkStateAndTriggered();
while (!sim.getStack().isEmpty()) {
triggered = true;
sim.getStack().resolve(sim);
@ -270,7 +270,8 @@ public class CombatUtil {
game.getPhase().setStep(step);
if (!step.skipStep(game, game.getActivePlayerId())) {
step.beginStep(game, game.getActivePlayerId());
game.checkStateAndTriggered();
// The following commented out call produces random freezes.
//game.checkStateAndTriggered();
while (!game.getStack().isEmpty()) {
game.getStack().resolve(game);
game.applyEffects();