- Patched up PlayAi to enable the AI to play Hideaway lands. Marking the relevant cards as playable.

- Some improvement to Volrath's Shapeshifter AI.
This commit is contained in:
Agetian
2017-10-15 13:38:17 +00:00
parent ac70e6504a
commit 0d4a837be6
8 changed files with 22 additions and 21 deletions

View File

@@ -1145,9 +1145,13 @@ public class SpecialCardAi {
topGY = ai.getCardsIn(ZoneType.Graveyard).get(0);
}
if ((topGY != null && !topGY.isCreature()) || creatHand != null) {
if (numCreatsInHand > 1 || !ComputerUtilMana.canPayManaCost(creatHand.getSpellPermanent(), ai, 0)) {
return true;
if (creatHand != null) {
if (topGY == null
|| !topGY.isCreature()
|| ComputerUtilCard.evaluateCreature(creatHand) > ComputerUtilCard.evaluateCreature(topGY) + 80) {
if (numCreatsInHand > 1 || !ComputerUtilMana.canPayManaCost(creatHand.getSpellPermanent(), ai, 0)) {
return true;
}
}
}

View File

@@ -1,14 +1,8 @@
package forge.ai.ability;
import java.util.List;
import com.google.common.base.Predicate;
import forge.ai.AiPlayDecision;
import forge.ai.ComputerUtil;
import forge.ai.ComputerUtilCard;
import forge.ai.PlayerControllerAi;
import forge.ai.SpellAbilityAi;
import forge.ai.*;
import forge.card.CardStateName;
import forge.game.Game;
import forge.game.ability.AbilityUtils;
import forge.game.card.Card;
@@ -22,6 +16,8 @@ import forge.game.spellability.SpellAbility;
import forge.game.spellability.TargetRestrictions;
import forge.game.zone.ZoneType;
import java.util.List;
public class PlayAi extends SpellAbilityAi {
@Override
@@ -105,7 +101,7 @@ public class PlayAi extends SpellAbilityAi {
List<Card> tgtCards = CardLists.filter(options, new Predicate<Card>() {
@Override
public boolean apply(final Card c) {
for (SpellAbility s : c.getBasicSpells()) {
for (SpellAbility s : c.getBasicSpells(c.getState(CardStateName.Original))) {
Spell spell = (Spell) s;
s.setActivatingPlayer(ai);
// timing restrictions still apply

View File

@@ -2232,8 +2232,12 @@ public class Card extends GameEntity implements Comparable<Card> {
}
public final FCollectionView<SpellAbility> getBasicSpells() {
return getBasicSpells(currentState);
}
public final FCollectionView<SpellAbility> getBasicSpells(CardState state) {
final FCollection<SpellAbility> res = new FCollection<>();
for (final SpellAbility sa : currentState.getNonManaAbilities()) {
for (final SpellAbility sa : state.getNonManaAbilities()) {
if (sa.isSpell() && sa.isBasicSpell()) {
res.add(sa);
}

View File

@@ -3,7 +3,7 @@ ManaCost:no cost
Types:Land
K:Hideaway
A:AB$ Mana | Cost$ T | Produced$ B | SpellDescription$ Add {B} to your mana pool.
A:AB$ Play | Cost$ B T | Defined$ Remembered | Amount$ All | Controller$ You | WithoutManaCost$ True | Optional$ True | ConditionCheckSVar$ Hands | ConditionSVarCompare$ EQ0 | ForgetRemembered$ True | References$ Hands | SpellDescription$ You may play the exiled card without paying its mana cost if each player has no cards in hand.
A:AB$ Play | Cost$ B T | Defined$ Remembered | Amount$ All | Controller$ You | WithoutManaCost$ True | Optional$ True | ConditionCheckSVar$ Hands | ConditionSVarCompare$ EQ0 | ForgetRemembered$ True | References$ Hands | AILogic$ CheckCondition | SpellDescription$ You may play the exiled card without paying its mana cost if each player has no cards in hand.
SVar:Hands:Count$NumInAllHands
SVar:RemRandomDeck:True
SVar:Picture:http://www.wizards.com/global/images/magic/general/howltooth_hollow.jpg

View File

@@ -3,7 +3,7 @@ ManaCost:no cost
Types:Land
K:Hideaway
A:AB$ Mana | Cost$ T | Produced$ G | SpellDescription$ Add {G} to your mana pool.
A:AB$ Play | Cost$ G T | Defined$ Remembered | Amount$ All | Controller$ You | WithoutManaCost$ True | Optional$ True | References$ X | ConditionCheckSVar$ X | ConditionSVarCompare$ GE10 | ForgetRemembered$ True | SpellDescription$ You may play the exiled card without paying its mana cost if creatures you control have total power 10 or greater.
A:AB$ Play | Cost$ G T | Defined$ Remembered | Amount$ All | Controller$ You | WithoutManaCost$ True | Optional$ True | References$ X | ConditionCheckSVar$ X | ConditionSVarCompare$ GE10 | ForgetRemembered$ True | AILogic$ CheckCondition | SpellDescription$ You may play the exiled card without paying its mana cost if creatures you control have total power 10 or greater.
SVar:X:Count$SumPower_Creature.YouCtrl
SVar:Picture:http://www.wizards.com/global/images/magic/general/mosswort_bridge.jpg
Oracle:Hideaway (This land enters the battlefield tapped. When it does, look at the top four cards of your library, exile one face down, then put the rest on the bottom of your library.)\n{T}: Add {G} to your mana pool.\n{G}, {T}: You may play the exiled card without paying its mana cost if creatures you control have total power 10 or greater.

View File

@@ -3,9 +3,8 @@ ManaCost:no cost
Types:Land
K:Hideaway
A:AB$ Mana | Cost$ T | Produced$ U | SpellDescription$ Add {U} to your mana pool.
A:AB$ Play | Cost$ U T | Defined$ Remembered | Amount$ All | Controller$ You | WithoutManaCost$ True | Optional$ True | ConditionCheckSVar$ X | ConditionSVarCompare$ LE20 | ForgetRemembered$ True | References$ X | SpellDescription$ You may play the exiled card without paying its mana cost if a library has twenty or fewer cards in it.
A:AB$ Play | Cost$ U T | Defined$ Remembered | Amount$ All | Controller$ You | WithoutManaCost$ True | Optional$ True | ConditionCheckSVar$ X | ConditionSVarCompare$ LE20 | ForgetRemembered$ True | References$ X | AILogic$ CheckCondition | SpellDescription$ You may play the exiled card without paying its mana cost if a library has twenty or fewer cards in it.
SVar:X:PlayerCountPlayers$LowestValidLibrary Card.YouOwn
SVar:RemRandomDeck:True
SVar:RemAIDeck:True
SVar:Picture:http://www.wizards.com/global/images/magic/general/shelldock_isle.jpg
Oracle:Hideaway (This land enters the battlefield tapped. When it does, look at the top four cards of your library, exile one face down, then put the rest on the bottom of your library.)\n{T}: Add {U} to your mana pool.\n{U}, {T}: You may play the exiled card without paying its mana cost if a library has twenty or fewer cards in it.

View File

@@ -3,8 +3,7 @@ ManaCost:no cost
Types:Land
K:Hideaway
A:AB$ Mana | Cost$ T | Produced$ R | SpellDescription$ Add {R} to your mana pool.
A:AB$ Play | Cost$ R T | Defined$ Remembered | Amount$ All | Controller$ You | WithoutManaCost$ True | Optional$ True | ConditionCheckSVar$ X | ConditionSVarCompare$ GE7 | References$ X | ForgetRemembered$ True | SpellDescription$ You may play the exiled card without paying its mana cost if an opponent was dealt 7 or more damage this turn.
A:AB$ Play | Cost$ R T | Defined$ Remembered | Amount$ All | Controller$ You | WithoutManaCost$ True | Optional$ True | ConditionCheckSVar$ X | ConditionSVarCompare$ GE7 | References$ X | ForgetRemembered$ True | AILogic$ CheckCondition | SpellDescription$ You may play the exiled card without paying its mana cost if an opponent was dealt 7 or more damage this turn.
SVar:X:Count$MaxOppDamageThisTurn
SVar:RemRandomDeck:True
SVar:Picture:http://www.wizards.com/global/images/magic/general/spinerock_knoll.jpg
Oracle:Hideaway (This land enters the battlefield tapped. When it does, look at the top four cards of your library, exile one face down, then put the rest on the bottom of your library.)\n{T}: Add {R} to your mana pool.\n{R}, {T}: You may play the exiled card without paying its mana cost if an opponent was dealt 7 or more damage this turn.

View File

@@ -3,8 +3,7 @@ ManaCost:no cost
Types:Land
K:Hideaway
A:AB$ Mana | Cost$ T | Produced$ W | SpellDescription$ Add {W} to your mana pool.
A:AB$ Play | Cost$ W T | Defined$ Remembered | Amount$ All | Controller$ You | WithoutManaCost$ True | Optional$ True | ConditionCheckSVar$ X | ConditionSVarCompare$ GE3 | References$ X | ForgetRemembered$ True | PlayerTurn$ True | SpellDescription$ You may play the exiled card without paying its mana cost if you attacked with three or more creatures this turn.
A:AB$ Play | Cost$ W T | Defined$ Remembered | Amount$ All | Controller$ You | WithoutManaCost$ True | Optional$ True | ConditionCheckSVar$ X | ConditionSVarCompare$ GE3 | References$ X | ForgetRemembered$ True | PlayerTurn$ True | AILogic$ CheckCondition | SpellDescription$ You may play the exiled card without paying its mana cost if you attacked with three or more creatures this turn.
SVar:X:Count$AttackersDeclared
SVar:RemAIDeck:True
SVar:Picture:http://www.wizards.com/global/images/magic/general/windbrisk_heights.jpg
Oracle:Hideaway (This land enters the battlefield tapped. When it does, look at the top four cards of your library, exile one face down, then put the rest on the bottom of your library.)\n{T}: Add {W} to your mana pool.\n{W}, {T}: You may play the exiled card without paying its mana cost if you attacked with three or more creatures this turn.