Skip to content

Commit 5cc8bd8

Browse files
authored
Merge pull request #11 from EricBartusch/feat/color
feat: Adding color and description inputs
2 parents 852e47e + 350ec45 commit 5cc8bd8

File tree

10 files changed

+58
-48
lines changed

10 files changed

+58
-48
lines changed

README.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@ Instead follow the guide [here](https://github.com/Gremious/StS-DefaultModBase/w
1313
3. Navigate to your local git repo
1414
4. Run `yo sts-protemplate` and follow prompts
1515

16-
## Things you'll still need to do
17-
18-
1. Update CardColor enum
19-
2. Update the description in pom.xml
20-
2116
## Don't want to use yeoman? Try this:
2217

2318
Download the .zip of [this branch](https://github.com/EricBartusch/sts-protemplate/tree/no-yeoman-please)

app/index.js

Lines changed: 47 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ module.exports = class extends Generator {
3636
name: "steamPath",
3737
message: "Where is steam installed?",
3838
default: "C:\\Program Files (x86)\\Steam\\steamapps"
39+
},
40+
{
41+
type: "input",
42+
name: "description",
43+
message: "Provide a description of your mod"
3944
}
4045
]);
4146

@@ -76,28 +81,42 @@ module.exports = class extends Generator {
7681
this.modIdCamel = toCamelCase(this.answers.modIdPascal);
7782

7883
if (this.customizations.createChar) {
79-
this.characterName = await this.prompt({
80-
type: "input",
81-
name: "charName",
82-
message: "What is the name of the character (in PascalCase)?",
83-
default: "TheTodo"
84-
});
84+
this.character = await this.prompt([
85+
{
86+
type: "input",
87+
name: "charName",
88+
message: "What is the name of the character (in PascalCase)?",
89+
default: "TheTodo"
90+
},
91+
{
92+
type: "input",
93+
name: "charColor",
94+
message: "What is the color for this character?",
95+
default: "GREY"
96+
}
97+
]);
8598
} else {
86-
this.characterName = { charName: "TheTodo" };
99+
this.character = { charName: "TheTodo", charColor: "GREY" };
87100
}
88101

89102
// Change TheTodo to THE_TODO for use in Enums
90-
this.characterName.charNameEnum = this.characterName.charName
103+
this.character.charNameEnum = this.character.charName
91104
.split(/(?=[A-Z])/)
92105
.join("_")
93106
.toUpperCase();
94107
// Change TheTodo to The Todo and the Todo for charstrings
95-
this.characterName.charStringsCapital = this.characterName.charName
108+
this.character.charStringsCapital = this.character.charName
96109
.replace(/([A-Z])/g, " $1")
97110
.trim();
98-
this.characterName.charStringsFirstLower =
99-
this.characterName.charStringsCapital.slice(0, 1).toLowerCase() +
100-
this.characterName.charStringsCapital.slice(1);
111+
this.character.charStringsFirstLower =
112+
this.character.charStringsCapital.slice(0, 1).toLowerCase() +
113+
this.character.charStringsCapital.slice(1);
114+
// Change color Enum
115+
this.character.charColor = (
116+
this.character.charName.toLowerCase().replace("the", "") +
117+
"_" +
118+
this.character.charColor
119+
).toUpperCase();
101120
}
102121

103122
writing() {
@@ -115,8 +134,9 @@ module.exports = class extends Generator {
115134
createRelics: this.customizations.createRelics,
116135
createPowers: this.customizations.createPowers,
117136
createChar: this.customizations.createChar,
118-
charName: this.characterName.charName,
119-
charNameEnum: this.characterName.charNameEnum
137+
charName: this.character.charName,
138+
charNameEnum: this.character.charNameEnum,
139+
charColor: this.character.charColor
120140
}
121141
);
122142

@@ -125,15 +145,16 @@ module.exports = class extends Generator {
125145
this.fs.copyTpl(
126146
this.templatePath(`src/main/java/theTodo/TheTodo.java`),
127147
this.destinationPath(
128-
`src/main/java/${this.modIdCamel}/${this.characterName.charName}.java`
148+
`src/main/java/${this.modIdCamel}/${this.character.charName}.java`
129149
),
130150
{
131151
modIdPascal: this.answers.modIdPascal,
132152
modIdCamel: this.modIdCamel,
133153
createCards: this.customizations.createCards,
134154
createRelics: this.customizations.createRelics,
135-
charName: this.characterName.charName,
136-
charNameEnum: this.characterName.charNameEnum
155+
charName: this.character.charName,
156+
charNameEnum: this.character.charNameEnum,
157+
charColor: this.character.charColor
137158
}
138159
);
139160
}
@@ -149,7 +170,8 @@ module.exports = class extends Generator {
149170
modIdSpaces: this.answers.modIdPascal
150171
.replace(/([A-Z])/g, " $1")
151172
.slice(1),
152-
steamPath: this.answers.steamPath
173+
steamPath: this.answers.steamPath,
174+
description: this.answers.description
153175
}
154176
);
155177

@@ -196,7 +218,8 @@ module.exports = class extends Generator {
196218
modIdPascal: this.answers.modIdPascal,
197219
modIdCamel: this.modIdCamel,
198220
createChar: this.customizations.createChar,
199-
charName: this.characterName.charName
221+
charName: this.character.charName,
222+
charColor: this.character.charColor
200223
},
201224
null,
202225
{ globOptions: { dot: true } }
@@ -227,7 +250,8 @@ module.exports = class extends Generator {
227250
modIdPascal: this.answers.modIdPascal,
228251
modIdCamel: this.modIdCamel,
229252
createChar: this.customizations.createChar,
230-
charName: this.characterName.charName
253+
charName: this.character.charName,
254+
charColor: this.character.charColor
231255
},
232256
null,
233257
{ globOptions: { dot: true } }
@@ -257,9 +281,9 @@ module.exports = class extends Generator {
257281
{
258282
modIdPascal: this.answers.modIdPascal,
259283
modIdCamel: this.modIdCamel,
260-
charName: this.characterName.charName,
261-
charStringsCapital: this.characterName.charStringsCapital,
262-
charStringsFirstLower: this.characterName.charStringsFirstLower
284+
charName: this.character.charName,
285+
charStringsCapital: this.character.charStringsCapital,
286+
charStringsFirstLower: this.character.charStringsFirstLower
263287
},
264288
null,
265289
{ globOptions: { dot: true } }

app/templates/README

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,3 @@ It contains the basics of an empty character, as well as:
88
- AbstractCard comes with secondary variable and secondary damage (me + Kio)
99
- Automatic card recoloring (me + Mayhem)
1010
- Hopefully more! Let me know if there's something you'd want added!!
11-
12-
Setup guide:
13-
1. Clone the project with Github, preferably downloading with Github Desktop to make it so IntelliJ integration is easy!
14-
2. Go into your pom.xml, and change the description
15-
3. In the modded character file, go to the Enums section at the bottom and change the PlayerClass and CardColor enums. They're also annotated with TODOs.
16-
4. Update this file!

app/templates/pom.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
<artifactId><%= modIdPascal %></artifactId>
77
<version>0.0.1</version>
88
<name><%= modIdSpaces %></name>
9-
<description>TODO: Change this description</description>
10-
<!-- Change the above for mod information. -->
9+
<description><%= description %></description>
1110

1211
<properties>
1312
<maven.compiler.source>1.8</maven.compiler.source>
@@ -16,7 +15,6 @@
1615
<ModTheSpire.version>3.18.2</ModTheSpire.version>
1716
<ModID><%= modIdLower %></ModID>
1817

19-
<!--CHANGE THIS TO YOUR STEAM INSTALLATION-->
2018
<Steam.path><%= steamPath %></Steam.path>
2119

2220
</properties>

app/templates/src/main/java/theTodo/TheTodo.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
import java.util.ArrayList;
3333

34-
import static <%= modIdCamel %>.<%= charName %>.Enums.TODO_COLOR;
34+
import static <%= modIdCamel %>.<%= charName %>.Enums.<%= charColor %>;
3535
import static <%= modIdCamel %>.<%= modIdPascal %>.*;
3636

3737
public class <%= charName %> extends CustomPlayer {
@@ -121,7 +121,7 @@ public int getAscensionMaxHPLoss() {
121121

122122
@Override
123123
public AbstractCard.CardColor getCardColor() {
124-
return TODO_COLOR;
124+
return <%= charColor %>;
125125
}
126126

127127
@Override
@@ -184,12 +184,11 @@ public String getVampireText() {
184184
}
185185

186186
public static class Enums {
187-
//TODO: Change these.
188187
@SpireEnum
189188
public static AbstractPlayer.PlayerClass <%= charNameEnum %>;
190-
@SpireEnum(name = "TODO_COLOR")
191-
public static AbstractCard.CardColor TODO_COLOR;
192-
@SpireEnum(name = "TODO_COLOR")
189+
@SpireEnum(name = "<%= charColor %>")
190+
public static AbstractCard.CardColor <%= charColor %>;
191+
@SpireEnum(name = "<%= charColor %>")
193192
@SuppressWarnings("unused")
194193
public static CardLibrary.LibraryType LIBRARY_COLOR;
195194
}

app/templates/src/main/java/theTodo/TodoMod.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public static String makeID(String idText) {
7979
public <%= modIdPascal %>() {
8080
BaseMod.subscribe(this);
8181
<%_ if (createChar) { _%>
82-
BaseMod.addColor(<%= charName %>.Enums.TODO_COLOR, characterColor, characterColor, characterColor,
82+
BaseMod.addColor(<%= charName %>.Enums.<%= charColor %>, characterColor, characterColor, characterColor,
8383
characterColor, characterColor, characterColor, characterColor,
8484
ATTACK_S_ART, SKILL_S_ART, POWER_S_ART, CARD_ENERGY_S,
8585
ATTACK_L_ART, SKILL_L_ART, POWER_L_ART,

app/templates/src/main/java/theTodo/cards/AbstractEasyCard.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public abstract class AbstractEasyCard extends CustomCard {
4747
private boolean needsArtRefresh = false;
4848

4949
public AbstractEasyCard(final String cardID, final int cost, final CardType type, final CardRarity rarity, final CardTarget target) {
50-
this(cardID, cost, type, rarity, target, <%_ if (createChar) { _%> <%= charName %>.Enums.TODO_COLOR<%_ } else { _%> CardColor.COLORLESS<%_ } _%>);
50+
this(cardID, cost, type, rarity, target, <%_ if (createChar) { _%> <%= charName %>.Enums.<%= charColor %><%_ } else { _%> CardColor.COLORLESS<%_ } _%>);
5151
}
5252

5353
public AbstractEasyCard(final String cardID, final int cost, final CardType type, final CardRarity rarity, final CardTarget target, final CardColor color) {

app/templates/src/main/java/theTodo/relics/TodoItem.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ public class TodoItem extends AbstractEasyRelic {
1010
public static final String ID = makeID("TodoItem");
1111

1212
public TodoItem() {
13-
super(ID, RelicTier.STARTER, LandingSound.FLAT, <%_ if (createChar) { _%> <%= charName %>.Enums.TODO_COLOR<%_ } else { _%> null<%_ } _%>);
13+
super(ID, RelicTier.STARTER, LandingSound.FLAT, <%_ if (createChar) { _%> <%= charName %>.Enums.<%= charColor %><%_ } else { _%> null<%_ } _%>);
1414
}
1515
}

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "generator-sts-protemplate",
3-
"version": "0.5.0",
3+
"version": "0.5.1",
44
"description": "Yeoman generator for starting up new Slay the Spire mods",
55
"homepage": "https://github.com/EricBartusch/sts-protemplate",
66
"author": {

0 commit comments

Comments
 (0)