mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 18:58:00 +00:00
- Add a function that can be used to build Convoke, Improvise, Delve functions for the AI (currently not hooked to anything)
This commit is contained in:
committed by
Hans Mackowiak
parent
c75cab4b75
commit
4f77dfcbf5
@@ -17,6 +17,7 @@ import forge.game.ability.*;
|
||||
import forge.game.card.*;
|
||||
import forge.game.combat.CombatUtil;
|
||||
import forge.game.cost.*;
|
||||
import forge.game.keyword.Keyword;
|
||||
import forge.game.mana.Mana;
|
||||
import forge.game.mana.ManaCostBeingPaid;
|
||||
import forge.game.mana.ManaPool;
|
||||
@@ -1806,6 +1807,34 @@ public class ComputerUtilMana {
|
||||
return res;
|
||||
}
|
||||
|
||||
// Convoke, Delve, Improvise
|
||||
public static List<SpellAbility> getAIPlayableSpecialAbilities(Card card, Player ai, SpellAbility saPaidFor, ManaCostBeingPaid manaCost) {
|
||||
List<SpellAbility> result = new ArrayList<>();
|
||||
if (saPaidFor.isSpell()) {
|
||||
Collection<SpellAbility> specialAbilities = Lists.newArrayList();
|
||||
if (card.isInPlay() && card.isUntapped()) {
|
||||
if (saPaidFor.getHostCard().hasKeyword(Keyword.CONVOKE) && card.isCreature()) {
|
||||
specialAbilities.addAll(CardFactoryUtil.buildConvokeAbility(card, manaCost, saPaidFor));
|
||||
}
|
||||
|
||||
if (saPaidFor.getHostCard().hasKeyword(Keyword.IMPROVISE) && card.isArtifact()) {
|
||||
specialAbilities.add(CardFactoryUtil.buildImproviseAbility(card, manaCost, saPaidFor));
|
||||
}
|
||||
}
|
||||
if (card.isInZone(ZoneType.Graveyard)) {
|
||||
if (saPaidFor.getHostCard().hasKeyword(Keyword.DELVE)) {
|
||||
specialAbilities.add(CardFactoryUtil.buildDelveAbility(card, manaCost, saPaidFor));
|
||||
}
|
||||
}
|
||||
// set the activating player
|
||||
for (final SpellAbility sa : specialAbilities) {
|
||||
sa.setActivatingPlayer(ai);
|
||||
result.add(sa);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private static void handleOfferingsAI(final SpellAbility sa, boolean test, boolean costIsPaid) {
|
||||
if (sa.isOffering() && sa.getSacrificedAsOffering() != null) {
|
||||
final Card offering = sa.getSacrificedAsOffering();
|
||||
|
||||
Reference in New Issue
Block a user