mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 18:58:00 +00:00
AI multi UnlessType support
This commit is contained in:
@@ -530,7 +530,14 @@ public class PlayerControllerAi extends PlayerController {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CardCollectionView chooseCardsToDiscardUnlessType(int num, CardCollectionView hand, String uType, SpellAbility sa) {
|
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()) {
|
if (!cardsOfType.isEmpty()) {
|
||||||
Card toDiscard = Aggregates.itemWithMin(cardsOfType, CardPredicates.Accessors.fnGetCmc);
|
Card toDiscard = Aggregates.itemWithMin(cardsOfType, CardPredicates.Accessors.fnGetCmc);
|
||||||
return new CardCollection(toDiscard);
|
return new CardCollection(toDiscard);
|
||||||
|
|||||||
Reference in New Issue
Block a user