BaseMod provides a number of hooks and a console.
Currently supported version: [EARLY_ACCESS_015]
(non beta)
- Java 8+
- ModTheSpire v2.1.0+ (https://github.com/kiooeht/ModTheSpire/releases)
- Java 8
- Maven
- CFR 124 (run this with Java 8, doesn't work well with 9)
- ModTheSpireLib (https://github.com/kiooeht/ModTheSpireLib)
- (If you haven't already)
mvn install
ModTheSpireLib. Altenatively, modify pom.xml to point to a local copy of the JAR. - Copy
desktop-1.0.jar
from your Slay the Spire folder into../_lib
relative to the repo. - Decompile
desktop-1.0.jar
withjava -jar "cfr_0_124.jar" --comments false --showversion false --caseinsensitivefs true --outputdir "decompiled" --jarfilter com.megacrit.cardcrawl.* "desktop-1.0.jar"
- Run
_patch.bat
to automatically apply diffs - Run
mvn package
- Copy
target/BaseMod.jar
to your ModTheSpire mods directory. Maven will automatically do this after packaging if your mods directory is located at../_ModTheSpire/mods
relative to the repo.
Default hotkey is `
, can be changed from BaseMod's settings screen.
deck add [id] {upgrades}
add card to deck (optional: integer # of upgrades)deck r [id]
remove card from deckdraw [num]
draw cardsenergy add [amount]
gain energyenergy inf
toggles infinite energyenergy r [amount]
lose energyfight [name]
enter combat with the specified encountergold add [amount]
gain goldgold r [amount]
lose goldhand add [id] {upgrades}
add card to hand with (optional: integer # of upgrades)hand r all
exhaust entire handhand r [id]
exhaust card from handinfo
toggle Settings.isInfokill all
kills all enemies in the current combatkill self
kills your characterpotion [pos] [id]
gain specified potion in specified slotrelic add [id]
generate relicrelic list
logs all relic poolsrelic r [id]
lose relic
BaseMod.subscribeTo...(this)
BaseMod.unsubscribeFrom...(this)
Implement the appropriate interface (ex. basemod.interfaces.PostInitializeSubscriber
)
boolean receivePostCampfire()
- After a campfire action is performed. Returning false will allow another action to be performed.void receivePostDraw(AbstractCard)
- After a card is drawn.void receivePostDungeonInitialize()
- After dungeon initialization completes.void receivePostEnergyRecharge()
- At the start of every player turn, after energy has recharged.void receivePostInitialize()
- One time only, at the end ofCardCrawlGame.initialize()
.boolean receivePreMonsterTurn(AbstractMonster)
- Before each monster takes its turn. Returning false will skip the monsters turn.void receiveRender(SpriteBatch)
- Under tips and the cursor, above everything else.void receivePostRender(SpriteBatch)
- Above everything.void receivePreStartGame()
- When starting a new game, before generating/loading the player.void receiveStartGame()
- When starting a new game or continuing, after generating/loading the player and before dungeon generation.void receivePreUpdate()
- Immediately after input is read.void receivePostUpdate()
- Immediately before input is disposed.
32x32 images that display under the title on the main menu. Clicking one opens that mods settings menu.
BaseMod.registerModBadge(Texture texture, String modName, String author, String description, ModPanel settingsPanel)
ModPanel.addButton(float x, float y, Consumer<ModButton> clickEvent)
ModPanel.addLabel(String text, float x, float y, Consumer<ModLabel> updateEvent)
- There is more here, but it is a big mess and is going to be cleaned up soon.
Example of setting up a basic mod badge with settings panel:
ModPanel settingsPanel = new ModPanel();
settingsPanel.addLabel("", 475.0f, 700.0f, (me) -> {
if (me.parent.waitingOnEvent) {
me.text = "Press key";
} else {
me.text = "Change console hotkey (" + Keys.toString(DevConsole.toggleKey) + ")";
}
});
settingsPanel.addButton(350.0f, 650.0f, (me) -> {
me.parent.waitingOnEvent = true;
oldInputProcessor = Gdx.input.getInputProcessor();
Gdx.input.setInputProcessor(new InputAdapter() {
@Override
public boolean keyUp(int keycode) {
DevConsole.toggleKey = keycode;
me.parent.waitingOnEvent = false;
Gdx.input.setInputProcessor(oldInputProcessor);
return true;
}
});
});
Texture badgeTexture = new Texture(Gdx.files.internal("img/BaseModBadge.png"));
registerModBadge(badgeTexture, MODNAME, AUTHOR, DESCRIPTION, settingsPanel);
CustomRelic(String id, Texture texture, AbstractRelic.RelicTier tier, AbstractRelic.LandingSound sfx)
BaseMod.loadCustomRelicStrings(String json)
- Initial release
- Scale console by Settings.scale
- Prevent game hotkeys from activating while console is visible
- Add mod badges
- Add initial support for mod settings screens
- Add
relic
console command - Add option to change console keybind on BaseMod settings screen
- Scale mod badges by Settings.scale
- Scale mod settings screens by Settings.scale
- Fix bug with IDs which contain spaces (FlipskiZ)
- Add
card
console command (FlipskiZ) - Add
kill all
console command
- Initial support for each mod badge being tied to its own settings panel
- Add
gold
command - Add
energy
command - Remove bundled font and use one from the base game instead
- Add
energy inf
command - Add
PostEnergyRechargeSubscriber
interface and related code
- Add
PostDrawSubscriber
interface and related code - Add
CustomRelic
extension of AbstractRelic - Add support for loading custom RelicStrings
- Fix a bug that prevented the character
D
from being input into the console - Rename
card
command tohand
- Add
hand r all
command - Add
deck
command - Add
draw
command - Add
float BaseMod.pathDensityMultiplier
property which can be used to modify map generation
- Add
PreStartGameSubscriber
interface and related code
- Add
AbstractDungeon
cleanup to diff, nothing changed yet. - Add
relic list
command - Fix crash when attempting to
deck add
an invalid card id - Add upgrade support to
deck add
andhand add
- Add
PreMonsterTurnSubscriber
interface and related code
- Add
PostCampfireSubscriber
interface and related code - Add proper support for
IntangiblePower
to be applied to players
- Update to support
[EARLY_ACCESS_013]
- Fix bug that prevented the
deck r
command from working
- Pull in changes from
[EARLY_ACCESS_013]
hotfix 2
- A lot of behind the scenes work on settings pages.
- MODDERS: You shouldn't try to build complex settings pages right now, its probably going to get significantly cleaned up and reworked to be more simple soon.
- Fix non-id parameters on commands being cases sensitive
- Change backspace behavior on console
- Fix scaling for new settings panel elements introduced in v1.3.2
- Add
StartActSubscriber
interface and related code - Add
PostDungeonInitializeSubscriber
interface and related code - Add
StartGameSubscriber
interface and related code - Fix bug that would prevent
publishPreStartGame()
from occuring in some cases - Cleanup part 1
- Add IDEA project files
- Remove
_build.bat
since this can be automated in IDEA
- Add support for CustomRelic outline images
- Prevent Girya from stacking above 3 if
receivePostCampfire()
returns false
- Update to support
[EARLY_ACCESS_014]
- Mostly switch to using SpirePatch for inserting hooks
- Speed up
kill all
command
- Add
kill self
command
- Add support for adding custom localization strings of any type
- Code cleanup
- Add
potion
command - Add
fight
command - Speed up
kill self
command
- Update to support
[EARLY_ACCESS_015]
- t-larson - Original author
- FlipskiZ -
hand
command, bug fixes