mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
Improved deck naming for LDA generated decks
This commit is contained in:
@@ -296,6 +296,7 @@ public class DeckgenUtil {
|
|||||||
return deck;
|
return deck;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param selection {@link java.lang.String} array
|
* @param selection {@link java.lang.String} array
|
||||||
* @return {@link forge.deck.Deck}
|
* @return {@link forge.deck.Deck}
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import java.util.List;
|
|||||||
|
|
||||||
public class Archetype implements Serializable {
|
public class Archetype implements Serializable {
|
||||||
|
|
||||||
|
static final long serialVersionUID = 1733769383530140352L;
|
||||||
|
|
||||||
private List<Pair<String, Double>> cardProbabilities;
|
private List<Pair<String, Double>> cardProbabilities;
|
||||||
private String name;
|
private String name;
|
||||||
private Integer deckCount;
|
private Integer deckCount;
|
||||||
@@ -26,7 +28,10 @@ public class Archetype implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return titleize(name);
|
||||||
|
/*//Debug:
|
||||||
|
return getDeckCount() + "-" + getCardProbabilities().get(0).getRight().toString().substring(0,4)
|
||||||
|
+ "-" + titleize(name) + "-" + getCardProbabilities().get(0).getLeft();*/
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setName(String name) {
|
public void setName(String name) {
|
||||||
@@ -40,4 +45,19 @@ public class Archetype implements Serializable {
|
|||||||
public void setDeckCount(Integer deckCount) {
|
public void setDeckCount(Integer deckCount) {
|
||||||
this.deckCount = deckCount;
|
this.deckCount = deckCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String titleize(final String input) {
|
||||||
|
final StringBuilder output = new StringBuilder(input.length());
|
||||||
|
boolean lastCharacterWasWhitespace = true;
|
||||||
|
|
||||||
|
for (final char currentCharacter : input.toCharArray()) {
|
||||||
|
if (lastCharacterWasWhitespace) {
|
||||||
|
output.append(Character.toTitleCase(currentCharacter));
|
||||||
|
} else {
|
||||||
|
output.append(currentCharacter);
|
||||||
|
}
|
||||||
|
lastCharacterWasWhitespace = Character.isWhitespace(currentCharacter);
|
||||||
|
}
|
||||||
|
return output.toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,9 @@ public class ArchetypeDeckBuilder extends CardThemedDeckBuilder{
|
|||||||
* @return name
|
* @return name
|
||||||
*/
|
*/
|
||||||
protected String generateName() {
|
protected String generateName() {
|
||||||
return archetype.getName() + " generated deck";
|
return archetype.getName() + " Generated Deck";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,6 +105,9 @@ public class CardThemedDeckBuilder extends DeckGeneratorBase {
|
|||||||
}
|
}
|
||||||
//get colours for first few cards
|
//get colours for first few cards
|
||||||
for(PaperCard c:getAiPlayables()){
|
for(PaperCard c:getAiPlayables()){
|
||||||
|
if(c.getRules().getType().isLand()){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if(deckColors.canChoseMoreColors()){
|
if(deckColors.canChoseMoreColors()){
|
||||||
deckColors.addColorsOf(c);
|
deckColors.addColorsOf(c);
|
||||||
cardCount++;
|
cardCount++;
|
||||||
|
|||||||
Reference in New Issue
Block a user