mirror of
https://github.com/magefree/mage.git
synced 2025-12-24 20:41:58 -08:00
Implemented Alpine Moon
This commit is contained in:
parent
880534c4df
commit
8116f1365e
4 changed files with 147 additions and 0 deletions
|
|
@ -24,6 +24,7 @@ public class ChooseACardNameEffect extends OneShotEffect {
|
|||
|
||||
ALL,
|
||||
NOT_BASIC_LAND_NAME,
|
||||
NONBASIC_LAND_NAME,
|
||||
NON_ARTIFACT_AND_NON_LAND_NAME,
|
||||
NON_LAND_NAME,
|
||||
NON_LAND_AND_NON_CREATURE_NAME,
|
||||
|
|
@ -62,6 +63,10 @@ public class ChooseACardNameEffect extends OneShotEffect {
|
|||
cardChoice.setChoices(CardRepository.instance.getNotBasicLandNames());
|
||||
cardChoice.setMessage("Choose a card name other than a basic land card name");
|
||||
break;
|
||||
case NONBASIC_LAND_NAME:
|
||||
cardChoice.setChoices(CardRepository.instance.getNonbasicLandNames());
|
||||
cardChoice.setMessage("Choose a nonbasic land card name");
|
||||
break;
|
||||
case NON_ARTIFACT_AND_NON_LAND_NAME:
|
||||
cardChoice.setChoices(CardRepository.instance.getNonArtifactAndNonLandNames());
|
||||
cardChoice.setMessage("Choose a nonartifact, nonland card name");
|
||||
|
|
@ -113,6 +118,9 @@ public class ChooseACardNameEffect extends OneShotEffect {
|
|||
case NOT_BASIC_LAND_NAME:
|
||||
sb.append("card name other than a basic land card");
|
||||
break;
|
||||
case NONBASIC_LAND_NAME:
|
||||
sb.append("nonbasic land card name");
|
||||
break;
|
||||
case NON_ARTIFACT_AND_NON_LAND_NAME:
|
||||
sb.append("nonartifact, nonland card");
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -153,6 +153,30 @@ public enum CardRepository {
|
|||
return names;
|
||||
}
|
||||
|
||||
public Set<String> getNonbasicLandNames() {
|
||||
Set<String> names = new TreeSet<>();
|
||||
try {
|
||||
QueryBuilder<CardInfo, Object> qb = cardDao.queryBuilder();
|
||||
qb.distinct().selectColumns("name");
|
||||
Where where = qb.where();
|
||||
where.and(where.not().not().like("supertypes", '%' + SuperType.BASIC.name() + '%'), where.like("types", '%' + CardType.LAND.name() + '%'));
|
||||
List<CardInfo> results = cardDao.query(qb.prepare());
|
||||
for (CardInfo card : results) {
|
||||
int result = card.getName().indexOf(" // ");
|
||||
if (result > 0) {
|
||||
names.add(card.getName().substring(0, result));
|
||||
names.add(card.getName().substring(result + 4));
|
||||
} else {
|
||||
names.add(card.getName());
|
||||
}
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
Logger.getLogger(CardRepository.class).error("Error getting non-land names from DB : " + ex);
|
||||
|
||||
}
|
||||
return names;
|
||||
}
|
||||
|
||||
public Set<String> getNotBasicLandNames() {
|
||||
Set<String> names = new TreeSet<>();
|
||||
try {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue