mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
[Mobile] Auto select AI Enabled Decks randomly
- Auto select AI Enabled Decks (non generated decks) when the Player Panel is AI and at least more than 10 AI Decks is available randomly
This commit is contained in:
@@ -8,6 +8,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import forge.util.MyRandom;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import com.badlogic.gdx.utils.Align;
|
import com.badlogic.gdx.utils.Align;
|
||||||
@@ -195,7 +196,20 @@ public class FDeckChooser extends FScreen {
|
|||||||
DeckgenUtil.randomSelect(lstDecks);
|
DeckgenUtil.randomSelect(lstDecks);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
DeckgenUtil.randomSelect(lstDecks);
|
List<DeckProxy> AIDecks = new ArrayList<>();
|
||||||
|
int count = 0;
|
||||||
|
if (isAi) {
|
||||||
|
for (DeckProxy deckProxy : lstDecks.getPool().toFlatList()) {
|
||||||
|
if (deckProxy.getAI().inMainDeck == 0) {
|
||||||
|
AIDecks.add(deckProxy);
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (count > 10)
|
||||||
|
lstDecks.setSelectedItem(AIDecks.get(MyRandom.getRandom().nextInt(AIDecks.size())));
|
||||||
|
else
|
||||||
|
DeckgenUtil.randomSelect(lstDecks);
|
||||||
}
|
}
|
||||||
accept();
|
accept();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user