mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
- Improved Mirror Entity Avatar AI logic for all-changeling decks (like the one in PConq) so that the AI can still identify the cases to play the avatar's ability.
This commit is contained in:
@@ -11,12 +11,15 @@ import forge.card.CardType;
|
||||
import forge.game.ability.AbilityUtils;
|
||||
import forge.game.card.Card;
|
||||
import forge.game.card.CardCollection;
|
||||
import forge.game.card.CardCollectionView;
|
||||
import forge.game.card.CardLists;
|
||||
import forge.game.card.CardPredicates;
|
||||
import forge.game.keyword.Keyword;
|
||||
import forge.game.phase.PhaseType;
|
||||
import forge.game.player.Player;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
import forge.game.zone.ZoneType;
|
||||
import forge.util.Aggregates;
|
||||
import java.util.List;
|
||||
|
||||
public class ChooseTypeAi extends SpellAbilityAi {
|
||||
@@ -41,11 +44,26 @@ public class ChooseTypeAi extends SpellAbilityAi {
|
||||
return false;
|
||||
}
|
||||
|
||||
CardCollectionView otb = aiPlayer.getCardsIn(ZoneType.Battlefield);
|
||||
List<String> valid = Lists.newArrayList(CardType.getAllCreatureTypes());
|
||||
String chosenType = ComputerUtilCard.getMostProminentType(aiPlayer.getCardsIn(ZoneType.Battlefield), valid);
|
||||
|
||||
String chosenType = ComputerUtilCard.getMostProminentType(otb, valid);
|
||||
if (chosenType.isEmpty()) {
|
||||
// Account for the situation when only changelings are on the battlefield
|
||||
boolean allChangeling = false;
|
||||
for (Card c : otb) {
|
||||
if (c.isCreature() && c.hasStartOfKeyword(Keyword.CHANGELING.toString())) {
|
||||
chosenType = Aggregates.random(valid); // just choose a random type for changelings
|
||||
allChangeling = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!allChangeling) {
|
||||
// Still empty, probably no creatures on board
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
int maxX = ComputerUtilMana.determineMaxAffordableX(aiPlayer, sa);
|
||||
int avgPower = 0;
|
||||
|
||||
Reference in New Issue
Block a user