BaseMod provides a number of hooks and a console.
Currently supported version: [EARLY_ACCESS_015]
(non beta)
- Java 8+
- ModTheSpire v2.2.1+ (https://github.com/kiooeht/ModTheSpire/releases)
- Java 8
- Maven
- CFR 124 (run this with Java 8, doesn't work well with 9)
- ModTheSpire (https://github.com/kiooeht/ModTheSpire)
- (If you haven't already)
mvn install
ModTheSpire 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.
Take a look at the wiki (https://github.com/daviscook477/BaseMod/wiki) to get started using BaseMod as either a console or a modding platform!
Take a look at the Console page on the wiki (https://github.com/daviscook477/BaseMod/wiki/Console) to start using the console to test things out!
Take a look here for the hooks that are available (https://github.com/daviscook477/BaseMod/wiki/Hooks)
Take alook here for how to set up a Mod Badge (https://github.com/daviscook477/BaseMod/wiki/Mod-Badges)
CustomRelic(String id, Texture texture, AbstractRelic.RelicTier tier, AbstractRelic.LandingSound sfx)
BaseMod.addRelic(AbstractRelic relic, RelicType type)
(note:CustomRelic
extendsAbstractRelic
) andRelicType
indicates if this relic is shared between both characters orRED
only orGREEN
only.BaseMod.removeRelic(AbstractRelic relic, RelicType type)
removes a relic from the game (note: removing a relic used by an event is currently untested/undefined behavior)BaseMod.removeRelic(AbstractRelic relic)
removes a relic from the game without having to know itsRelicType
CustomCard(String id, String name, String img, int cost, String rawDescription, CardType type, CardColor color, CardRarity rarity, CardTarget target, int cardPool)
BaseMod.addCard(AbstractCard card)
(note:CustomCard
extendsAbstractCard
).BaseMod.removeCard(AbstractCard card)
removes a card from the game (note: removing a card used by an event is currently untested/undefined behavior)
The process for creating custom player characters is fairly involved but still not too complex. It is detailed below:
- To add a custom character there are two major steps. You need to register both a new color and a new character. Basically the Ironclad is RED, the Silent is GREEN, the unused content Crowbot is BLUE, etc... In making a custom character you would want to make a new color like maybe YELLOW or PURPLE or ORANGE.
- Since the base game represents colors using an enum we need to use ModTheSpire's enum patching feature. To do this create any class and add to it the following code:
@SpireEnum
public static AbstractCard.CardColor MY_NEW_COLOR;
- The base game also reprents players using an enum so we must do the same thing for the player enum. Use this code:
@SpireEnum
public static AbstractPlayer.PlayerClass MY_NEW_PLAYER_CHARACTER;
- To create a new color use
BaseMod.addColor
. This should be called in your mod'sinitialize
method. It does not need a special handler to work. The parameters are as follows:String color
(this should beMY_NEW_COLOR.toString()
),Color bgColor
(the background color for the card color),Color backColor
(the back color for the card color),Color frameColor
(the frame color for the card color),Color frameOutineColor
(the frame outline color for the card color),Color descBoxColor
(the description box color),Color trailVfxColor
(the trail vfx color),Color glowColor
(the glow color),String attackBg
(path to your attack bg texture for the card color, path starts relative to yourSlayTheSpire
folder),String skillBg
(path to your skill bg texture for the card color, path starts relative to yourSlayTheSpire
folder),String powerBg
(path to your power bg texture for the card color, path starts relative to yourSlayTheSpire
folder),String energyOrb
(path to your energy orb texture for the card color, path starts relative to yourSlayTheSpire
folder) - To create a new player character make a EditCharacterSubscriber and in the
receiveEditCharacters
method go ahead and callBaseMod.addCharacter
. The parameters are as follows:Class characterClass
(the actual java Class of your character, e.g.MyCharacterClass.class
),String titleString
(title string for the character),String classString
(class string for the character),String color
, (the color for this character; should beMy_New_Color.toString()
),String selectText
(select text for the character),String selectButton
(path to select button texture starting relative to theSlayTheSpire
folder),String portrait
(path to portrait texture starting relative to theSlayTheSpire
folder),String characterID
(this should beMY_NEW_PLAYER_CHARACTER.toString()
) - Now just be sure to add some cards for your custom character! When defining cards for your custom character rather than using
AbstractCard.CardColor.WHATEVER
go ahead and useMY_NEW_COLOR
instead. - Note that there are likely to be bugs with this feature since it is complex and new so use at your own risk and also please submit bug reports as issues on this repository.
- t-larson - Original author
- FlipskiZ -
hand
command, bug fixes - daviscook477 - Custom players, custom colors, custom cards, more API hooks, code cleanup, bugfixes
- Haashi - custom potion support (w/ hooks) and better dev console potion support