mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 04:08:01 +00:00
- AI will now try to chump block with creatures that have SacMe SVars > 3 (for example Rukh Egg).
This commit is contained in:
@@ -198,7 +198,7 @@ public class AiBlockController {
|
||||
final List<Card> safeBlockers = getSafeBlockers(combat, attacker, blockers);
|
||||
List<Card> killingBlockers;
|
||||
|
||||
if (safeBlockers.size() > 0) {
|
||||
if (!safeBlockers.isEmpty()) {
|
||||
// 1.Blockers that can destroy the attacker but won't get
|
||||
// destroyed
|
||||
killingBlockers = getKillingBlockers(combat, attacker, safeBlockers);
|
||||
@@ -213,13 +213,19 @@ public class AiBlockController {
|
||||
// 3.Blockers that can destroy the attacker and have an upside when dying
|
||||
killingBlockers = getKillingBlockers(combat, attacker, blockers);
|
||||
for (Card b : killingBlockers) {
|
||||
if ((b.hasKeyword("Undying") && b.getCounters(CounterType.P1P1) == 0)
|
||||
|| !b.getSVar("SacMe").equals("")) {
|
||||
if ((b.hasKeyword("Undying") && b.getCounters(CounterType.P1P1) == 0) || b.hasSVar("SacMe")) {
|
||||
blocker = b;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// 4.Blockers that can destroy the attacker and are worth less
|
||||
// 4.Blockers that have a big upside when dying
|
||||
for (Card b : blockers) {
|
||||
if (b.hasSVar("SacMe") && Integer.parseInt(b.getSVar("SacMe")) > 3) {
|
||||
blocker = b;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// 5.Blockers that can destroy the attacker and are worth less
|
||||
if (blocker == null && !killingBlockers.isEmpty()) {
|
||||
final Card worst = ComputerUtilCard.getWorstCreatureAI(killingBlockers);
|
||||
int value = ComputerUtilCard.evaluateCreature(attacker);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package forge.ai.ability;
|
||||
|
||||
import forge.ai.ComputerUtil;
|
||||
import forge.ai.ComputerUtilCard;
|
||||
import forge.ai.ComputerUtilCost;
|
||||
import forge.ai.SpellAbilityAi;
|
||||
@@ -12,11 +13,9 @@ import forge.game.player.Player;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
import forge.game.spellability.TargetRestrictions;
|
||||
import forge.game.zone.ZoneType;
|
||||
import forge.util.MyRandom;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class UntapAi extends SpellAbilityAi {
|
||||
|
||||
@@ -37,8 +36,9 @@ public class UntapAi extends SpellAbilityAi {
|
||||
return false;
|
||||
}
|
||||
|
||||
final Random r = MyRandom.getRandom();
|
||||
boolean randomReturn = r.nextFloat() <= Math.pow(.6667, sa.getActivationsThisTurn() + 1);
|
||||
if (ComputerUtil.preventRunAwayActivations(sa)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (tgt == null) {
|
||||
final List<Card> pDefined = AbilityUtils.getDefinedCards(sa.getHostCard(), sa.getParam("Defined"), sa);
|
||||
@@ -51,7 +51,7 @@ public class UntapAi extends SpellAbilityAi {
|
||||
}
|
||||
}
|
||||
|
||||
return randomReturn;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -133,14 +133,14 @@ public class UntapAi extends SpellAbilityAi {
|
||||
final String[] tappablePermanents = { "Creature", "Land", "Artifact" };
|
||||
untapList = CardLists.getValidCards(untapList, tappablePermanents, source.getController(), source);
|
||||
|
||||
if (untapList.size() == 0) {
|
||||
if (untapList.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
while (sa.getTargets().getNumTargeted() < tgt.getMaxTargets(sa.getHostCard(), sa)) {
|
||||
Card choice = null;
|
||||
|
||||
if (untapList.size() == 0) {
|
||||
if (untapList.isEmpty()) {
|
||||
if ((sa.getTargets().getNumTargeted() < tgt.getMinTargets(sa.getHostCard(), sa)) || (sa.getTargets().getNumTargeted() == 0)) {
|
||||
sa.resetTargets();
|
||||
return false;
|
||||
@@ -150,13 +150,8 @@ public class UntapAi extends SpellAbilityAi {
|
||||
}
|
||||
}
|
||||
|
||||
if (CardLists.getNotType(untapList, "Creature").size() == 0) {
|
||||
choice = ComputerUtilCard.getBestCreatureAI(untapList); // if
|
||||
// only
|
||||
// creatures
|
||||
// take
|
||||
// the
|
||||
// best
|
||||
if (CardLists.getNotType(untapList, "Creature").isEmpty()) {
|
||||
choice = ComputerUtilCard.getBestCreatureAI(untapList); // if only creatures take the best
|
||||
} else {
|
||||
choice = ComputerUtilCard.getMostExpensivePermanentAI(untapList, sa, false);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,6 @@ Types:Creature Zombie
|
||||
PT:4/4
|
||||
T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Graveyard | ValidCard$ Card.Self | Execute$ TrigToken | TriggerController$ TriggeredCardController | TriggerDescription$ When CARDNAME dies, put two 2/2 black Zombie creature tokens onto the battlefield.
|
||||
SVar:TrigToken:AB$ Token | Cost$ 0 | TokenImage$ B 2 2 Zombie | TokenAmount$ 2 | TokenName$ Zombie | TokenTypes$ Creature,Zombie | TokenOwner$ You | TokenPower$ 2 | TokenToughness$ 2 | TokenColors$ Black
|
||||
SVar:SacMe:4
|
||||
SVar:SacMe:3
|
||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/maalfeld_twins.jpg
|
||||
Oracle:When Maalfeld Twins dies, put two 2/2 black Zombie creature tokens onto the battlefield.
|
||||
Reference in New Issue
Block a user