mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 18:58:00 +00:00
- Expanded the predictThreatenedObjects AI function.
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user