mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 02:38:02 +00:00
AI multi UnlessType support
This commit is contained in:
@@ -530,7 +530,14 @@ public class PlayerControllerAi extends PlayerController {
|
||||
|
||||
@Override
|
||||
public CardCollectionView chooseCardsToDiscardUnlessType(int num, CardCollectionView hand, String uType, SpellAbility sa) {
|
||||
final CardCollectionView cardsOfType = CardLists.getType(hand, uType);
|
||||
String [] splitUTypes = uType.split(",");
|
||||
CardCollection cardsOfType = new CardCollection();
|
||||
for (String part : splitUTypes) {
|
||||
CardCollection partCards = CardLists.getType(hand, part);
|
||||
if (!partCards.isEmpty()) {
|
||||
cardsOfType.addAll(partCards);
|
||||
}
|
||||
}
|
||||
if (!cardsOfType.isEmpty()) {
|
||||
Card toDiscard = Aggregates.itemWithMin(cardsOfType, CardPredicates.Accessors.fnGetCmc);
|
||||
return new CardCollection(toDiscard);
|
||||
|
||||
Reference in New Issue
Block a user