- Expanded the predictThreatenedObjects AI function.

This commit is contained in:
Sloth
2014-04-04 18:42:50 +00:00
parent b8825ceb8b
commit fd88585bd4
2 changed files with 17 additions and 8 deletions

View File

@@ -1444,6 +1444,21 @@ public class ComputerUtil {
}
}
}
//GainControl
else if (threatApi == ApiType.GainControl
&& (saviourApi == ApiType.ChangeZone || saviourApi == ApiType.Pump || saviourApi == null)) {
for (final Object o : objects) {
if (o instanceof Card) {
final Card c = (Card) o;
// give Shroud to targeted creatures
if (saviourApi == ApiType.Pump && tgt == null && saviour.hasParam("KW")
&& (saviour.getParam("KW").endsWith("Shroud") || saviour.getParam("KW").endsWith("Hexproof"))) {
continue;
}
threatened.add(c);
}
}
}
Iterables.addAll(threatened, ComputerUtil.predictThreatenedObjects(aiPlayer, saviour, topStack.getSubAbility()));
return threatened;

View File

@@ -20,10 +20,8 @@ import forge.game.spellability.TargetChoices;
import forge.game.spellability.TargetRestrictions;
import forge.game.zone.ZoneType;
import forge.util.Aggregates;
import forge.util.MyRandom;
import java.util.List;
import java.util.Random;
public class DamageDealAi extends DamageAiBase {
@Override
@@ -89,12 +87,8 @@ public class DamageDealAi extends DamageAiBase {
return false;
}
if (sa.isAbility()) {
final Random r = MyRandom.getRandom(); // prevent run-away
// activations
if (r.nextFloat() > Math.pow(.9, sa.getActivationsThisTurn())) {
return false;
}
if (ComputerUtil.preventRunAwayActivations(sa)) {
return false;
}
if (!this.damageTargetAI(ai, sa, dmg)) {