mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
- Improve Maze's End AI.
This commit is contained in:
@@ -756,6 +756,37 @@ public class SpecialCardAi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Maze's End
|
||||||
|
public static class MazesEnd {
|
||||||
|
public static boolean consider(final Player ai, final SpellAbility sa) {
|
||||||
|
PhaseHandler ph = ai.getGame().getPhaseHandler();
|
||||||
|
CardCollection availableGates = CardLists.filter(ai.getCardsIn(ZoneType.Library), CardPredicates.isType("Gate"));
|
||||||
|
|
||||||
|
return ph.is(PhaseType.END_OF_TURN) && ph.getNextTurn() == ai && !availableGates.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Card considerCardToGet(final Player ai, final SpellAbility sa)
|
||||||
|
{
|
||||||
|
CardCollection currentGates = CardLists.filter(ai.getCardsIn(ZoneType.Battlefield), CardPredicates.isType("Gate"));
|
||||||
|
CardCollection availableGates = CardLists.filter(ai.getCardsIn(ZoneType.Library), CardPredicates.isType("Gate"));
|
||||||
|
|
||||||
|
if (availableGates.isEmpty())
|
||||||
|
return null; // shouldn't get here
|
||||||
|
|
||||||
|
for (Card gate : availableGates)
|
||||||
|
{
|
||||||
|
if (CardLists.filter(currentGates, CardPredicates.nameEquals(gate.getName())).isEmpty())
|
||||||
|
{
|
||||||
|
// Diversify our mana base
|
||||||
|
return gate;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fetch a random gate if we already have all types
|
||||||
|
return Aggregates.random(availableGates);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Mairsil, the Pretender
|
// Mairsil, the Pretender
|
||||||
public static class MairsilThePretender {
|
public static class MairsilThePretender {
|
||||||
// Scan the fetch list for a card with at least one activated ability.
|
// Scan the fetch list for a card with at least one activated ability.
|
||||||
|
|||||||
@@ -128,6 +128,8 @@ public class ChangeZoneAi extends SpellAbilityAi {
|
|||||||
// This logic only fills the multiple cards array, the decision to play is made
|
// This logic only fills the multiple cards array, the decision to play is made
|
||||||
// separately in hiddenOriginCanPlayAI later.
|
// separately in hiddenOriginCanPlayAI later.
|
||||||
multipleCardsToChoose = SpecialCardAi.Intuition.considerMultiple(aiPlayer, sa);
|
multipleCardsToChoose = SpecialCardAi.Intuition.considerMultiple(aiPlayer, sa);
|
||||||
|
} else if (aiLogic.equals("MazesEnd")) {
|
||||||
|
return SpecialCardAi.MazesEnd.consider(aiPlayer, sa);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isHidden(sa)) {
|
if (isHidden(sa)) {
|
||||||
@@ -1491,6 +1493,8 @@ public class ChangeZoneAi extends SpellAbilityAi {
|
|||||||
return SpecialCardAi.MairsilThePretender.considerCardFromList(fetchList);
|
return SpecialCardAi.MairsilThePretender.considerCardFromList(fetchList);
|
||||||
} else if ("SurvivalOfTheFittest".equals(logic)) {
|
} else if ("SurvivalOfTheFittest".equals(logic)) {
|
||||||
return SpecialCardAi.SurvivalOfTheFittest.considerCardToGet(decider, sa);
|
return SpecialCardAi.SurvivalOfTheFittest.considerCardToGet(decider, sa);
|
||||||
|
} else if ("MazesEnd".equals(logic)) {
|
||||||
|
return SpecialCardAi.MazesEnd.considerCardToGet(decider, sa);
|
||||||
} else if ("Intuition".equals(logic)) {
|
} else if ("Intuition".equals(logic)) {
|
||||||
if (!multipleCardsToChoose.isEmpty()) {
|
if (!multipleCardsToChoose.isEmpty()) {
|
||||||
Card choice = multipleCardsToChoose.get(0);
|
Card choice = multipleCardsToChoose.get(0);
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ ManaCost:no cost
|
|||||||
Types:Land
|
Types:Land
|
||||||
K:CARDNAME enters the battlefield tapped.
|
K:CARDNAME enters the battlefield tapped.
|
||||||
A:AB$ Mana | Cost$ T | Produced$ C | SpellDescription$ Add {C}.
|
A:AB$ Mana | Cost$ T | Produced$ C | SpellDescription$ Add {C}.
|
||||||
A:AB$ ChangeZone | Cost$ 3 T Return<1/CARDNAME> | ChangeType$ Gate | ChangeNum$ 1 | Origin$ Library | Destination$ Battlefield | SubAbility$ DBWin | SpellDescription$ Search your library for a Gate card, put it onto the battlefield, then shuffle your library. If you control ten or more Gates with different names, you win the game.
|
A:AB$ ChangeZone | Cost$ 3 T Return<1/CARDNAME> | ChangeType$ Gate | ChangeNum$ 1 | Origin$ Library | Destination$ Battlefield | AILogic$ MazesEnd | SubAbility$ DBWin | SpellDescription$ Search your library for a Gate card, put it onto the battlefield, then shuffle your library. If you control ten or more Gates with different names, you win the game.
|
||||||
SVar:DBWin:DB$ WinsGame | Defined$ You | ConditionCheckSVar$ MazeGate | ConditionSVarCompare$ GE10 | References$ MazeGate
|
SVar:DBWin:DB$ WinsGame | Defined$ You | ConditionCheckSVar$ MazeGate | ConditionSVarCompare$ GE10 | References$ MazeGate
|
||||||
SVar:MazeGate:Count$DifferentCardNames_Gate.YouCtrl+inZoneBattlefield
|
SVar:MazeGate:Count$DifferentCardNames_Gate.YouCtrl+inZoneBattlefield
|
||||||
AI:RemoveDeck:Random
|
AI:RemoveDeck:Random
|
||||||
|
|||||||
Reference in New Issue
Block a user