mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
Merge pull request #3255 from Agetian/ai-revealorchoose-cost
AI: Support for RevealOrChoose (Dragon's Fire)
This commit is contained in:
@@ -1,30 +1,14 @@
|
|||||||
package forge.ai;
|
package forge.ai;
|
||||||
|
|
||||||
import static forge.ai.ComputerUtilCard.getBestCreatureAI;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import forge.card.MagicColor;
|
|
||||||
import forge.game.cost.*;
|
|
||||||
import org.apache.commons.lang3.ObjectUtils;
|
|
||||||
|
|
||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
import com.google.common.base.Predicates;
|
import com.google.common.base.Predicates;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import forge.card.CardType;
|
import forge.card.CardType;
|
||||||
|
import forge.card.MagicColor;
|
||||||
import forge.game.Game;
|
import forge.game.Game;
|
||||||
import forge.game.GameEntityCounterTable;
|
import forge.game.GameEntityCounterTable;
|
||||||
import forge.game.card.Card;
|
import forge.game.card.*;
|
||||||
import forge.game.card.CardCollection;
|
import forge.game.cost.*;
|
||||||
import forge.game.card.CardCollectionView;
|
|
||||||
import forge.game.card.CardLists;
|
|
||||||
import forge.game.card.CardPredicates;
|
|
||||||
import forge.game.card.CounterEnumType;
|
|
||||||
import forge.game.card.CounterType;
|
|
||||||
import forge.game.keyword.Keyword;
|
import forge.game.keyword.Keyword;
|
||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
import forge.game.spellability.SpellAbility;
|
import forge.game.spellability.SpellAbility;
|
||||||
@@ -33,6 +17,11 @@ import forge.game.zone.ZoneType;
|
|||||||
import forge.util.Aggregates;
|
import forge.util.Aggregates;
|
||||||
import forge.util.TextUtil;
|
import forge.util.TextUtil;
|
||||||
import forge.util.collect.FCollectionView;
|
import forge.util.collect.FCollectionView;
|
||||||
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
import static forge.ai.ComputerUtilCard.getBestCreatureAI;
|
||||||
|
|
||||||
public class AiCostDecision extends CostDecisionMakerBase {
|
public class AiCostDecision extends CostDecisionMakerBase {
|
||||||
private final CardCollection discarded;
|
private final CardCollection discarded;
|
||||||
@@ -481,6 +470,18 @@ public class AiCostDecision extends CostDecisionMakerBase {
|
|||||||
return PaymentDecision.card(hand);
|
return PaymentDecision.card(hand);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cost.getRevealFrom().size() == 2 && cost.getRevealFrom().containsAll(Arrays.asList(ZoneType.Hand, ZoneType.Battlefield))) { // RevealOrChoose
|
||||||
|
String aiLogic = ability.getParamOrDefault("AILogic", "");
|
||||||
|
hand = CardLists.getValidCards(hand, type.split(";"), player, source, ability);
|
||||||
|
|
||||||
|
if (aiLogic.startsWith("PowerAtLeast.")) {
|
||||||
|
int minPower = Integer.parseInt(aiLogic.substring(aiLogic.indexOf(".") + 1));
|
||||||
|
hand = CardLists.filterPower(hand, minPower);
|
||||||
|
}
|
||||||
|
|
||||||
|
return hand.isEmpty() ? null : PaymentDecision.card(getBestCreatureAI(hand));
|
||||||
|
}
|
||||||
|
|
||||||
if (cost.getType().equals("SameColor")) {
|
if (cost.getType().equals("SameColor")) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ Name:Dragon's Fire
|
|||||||
ManaCost:1 R
|
ManaCost:1 R
|
||||||
Types:Instant
|
Types:Instant
|
||||||
K:Kicker:RevealOrChoose<1/Dragon>:Generic
|
K:Kicker:RevealOrChoose<1/Dragon>:Generic
|
||||||
A:SP$ DealDamage | ValidTgts$ Creature,Planeswalker | TgtPrompt$ Select target creature or planeswalker | NumDmg$ Y | SpellDescription$ CARDNAME deals 3 damage to target creature or planeswalker. If you revealed a Dragon card or chose a Dragon as you cast this spell, CARDNAME deals damage equal to the power of that card or creature instead.
|
A:SP$ DealDamage | ValidTgts$ Creature,Planeswalker | TgtPrompt$ Select target creature or planeswalker | NumDmg$ Y | AILogic$ PowerAtLeast.4 | SpellDescription$ CARDNAME deals 3 damage to target creature or planeswalker. If you revealed a Dragon card or chose a Dragon as you cast this spell, CARDNAME deals damage equal to the power of that card or creature instead.
|
||||||
SVar:Y:Count$OptionalGenericCostPaid.X.3
|
SVar:Y:Count$OptionalGenericCostPaid.X.3
|
||||||
SVar:X:Revealed$CardPower
|
SVar:X:Revealed$CardPower
|
||||||
Oracle:As an additional cost to cast this spell, you may reveal a Dragon card from your hand or choose a Dragon you control.\nDragon's Fire deals 3 damage to target creature or planeswalker. If you revealed a Dragon card or chose a Dragon as you cast this spell, Dragon's Fire deals damage equal to the power of that card or creature instead.
|
Oracle:As an additional cost to cast this spell, you may reveal a Dragon card from your hand or choose a Dragon you control.\nDragon's Fire deals 3 damage to target creature or planeswalker. If you revealed a Dragon card or chose a Dragon as you cast this spell, Dragon's Fire deals damage equal to the power of that card or creature instead.
|
||||||
|
|||||||
Reference in New Issue
Block a user