- ChangeZoneAllAi: for things that return creatures from the battlefield to wherever en masse (e.g. Evacuation), cast is as a last resort if the opponent is about to deal lethal damage and win.

- Skyshroud War Beast: added NoZeroToughnessAI param.
This commit is contained in:
Agetian
2017-09-18 04:35:14 +00:00
parent c401a609a4
commit 4569bca39d
2 changed files with 16 additions and 10 deletions

View File

@@ -1,19 +1,11 @@
package forge.ai.ability; package forge.ai.ability;
import java.util.Collections;
import java.util.Random;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import forge.ai.*; import forge.ai.*;
import forge.game.Game; import forge.game.Game;
import forge.game.ability.AbilityUtils; import forge.game.ability.AbilityUtils;
import forge.game.card.Card; import forge.game.card.*;
import forge.game.card.CardCollection;
import forge.game.card.CardCollectionView;
import forge.game.card.CardLists;
import forge.game.card.CardPredicates;
import forge.game.cost.Cost; import forge.game.cost.Cost;
import forge.game.phase.PhaseType; import forge.game.phase.PhaseType;
import forge.game.player.Player; import forge.game.player.Player;
@@ -23,6 +15,9 @@ import forge.game.spellability.SpellAbility;
import forge.game.zone.ZoneType; import forge.game.zone.ZoneType;
import forge.util.MyRandom; import forge.util.MyRandom;
import java.util.Collections;
import java.util.Random;
public class ChangeZoneAllAi extends SpellAbilityAi { public class ChangeZoneAllAi extends SpellAbilityAi {
@Override @Override
protected boolean canPlayAI(Player ai, SpellAbility sa) { protected boolean canPlayAI(Player ai, SpellAbility sa) {
@@ -136,13 +131,23 @@ public class ChangeZoneAllAi extends SpellAbilityAi {
} }
computerType = new CardCollection(); computerType = new CardCollection();
} }
// mass zone change for creatures: if in dire danger, do it; otherwise, only do it if the opponent's
// creatures are better in value
if ((CardLists.getNotType(oppType, "Creature").size() == 0) if ((CardLists.getNotType(oppType, "Creature").size() == 0)
&& (CardLists.getNotType(computerType, "Creature").size() == 0)) { && (CardLists.getNotType(computerType, "Creature").size() == 0)) {
if (game.getCombat() != null && ComputerUtilCombat.lifeInSeriousDanger(ai, game.getCombat())) {
if (game.getPhaseHandler().is(PhaseType.COMBAT_DECLARE_BLOCKERS)
&& game.getPhaseHandler().getPlayerTurn().isOpponentOf(ai)) {
// Life is in serious danger, return all creatures from the battlefield to wherever
// so they don't deal lethal damage
return true;
}
}
if ((ComputerUtilCard.evaluateCreatureList(computerType) + 200) >= ComputerUtilCard if ((ComputerUtilCard.evaluateCreatureList(computerType) + 200) >= ComputerUtilCard
.evaluateCreatureList(oppType)) { .evaluateCreatureList(oppType)) {
return false; return false;
} }
} // otherwise evaluate both lists by CMC and pass only if human } // mass zone change for non-creatures: evaluate both lists by CMC and pass only if human
// permanents are more valuable // permanents are more valuable
else if ((ComputerUtilCard.evaluatePermanentList(computerType) + 3) >= ComputerUtilCard else if ((ComputerUtilCard.evaluatePermanentList(computerType) + 3) >= ComputerUtilCard
.evaluatePermanentList(oppType)) { .evaluatePermanentList(oppType)) {

View File

@@ -8,5 +8,6 @@ SVar:ChooseP:DB$ ChoosePlayer | Defined$ You | Choices$ Player.Opponent | AILogi
S:Mode$ Continuous | EffectZone$ Battlefield | CharacteristicDefining$ True | SetPower$ X | SetToughness$ X | Description$ CARDNAME's power and toughness are each equal to the number of nonbasic lands the chosen player controls. S:Mode$ Continuous | EffectZone$ Battlefield | CharacteristicDefining$ True | SetPower$ X | SetToughness$ X | Description$ CARDNAME's power and toughness are each equal to the number of nonbasic lands the chosen player controls.
SVar:X:Count$Valid Land.nonBasic+ChosenCtrl SVar:X:Count$Valid Land.nonBasic+ChosenCtrl
SVar:RemRandomDeck:True SVar:RemRandomDeck:True
SVar:NoZeroToughnessAI:True
SVar:Picture:http://www.wizards.com/global/images/magic/general/skyshroud_war_beast.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/skyshroud_war_beast.jpg
Oracle:Trample\nAs Skyshroud War Beast enters the battlefield, choose an opponent.\nSkyshroud War Beast's power and toughness are each equal to the number of nonbasic lands the chosen player controls. Oracle:Trample\nAs Skyshroud War Beast enters the battlefield, choose an opponent.\nSkyshroud War Beast's power and toughness are each equal to the number of nonbasic lands the chosen player controls.