Skip to content

Adding Challenges

Alex Driedger edited this page May 27, 2019 · 6 revisions

Support for adding challenges from other mods was designed to be as easy as possible. If you run into any problems or bugs, please submit an issue!

Challenges File

Create a file with one or more challenges with the following format

{
  "YourModID:Super Cool Challenge": {
    "NAME": "Super Cool Challenge",
    "DESCRIPTION": "Only the coolest thing out there."
  },
  "YourModID:Only Awesomeness": {
    "NAME": "Only Awesomeness",
    "DESCRIPTION": "Heck ya it's awesome."
  }
}

File Location

For Challenge the Spire to find your file with challenges, it must be under a directory that contains localization, the name of the language (for localization), and end with Challenges.json. A mod can have multiple files with challenges.

Example File Path

resources/YourModIDResources/localization/eng/YourModID-Challenges.json

Check if Your Challenge is Active

This is the same as checking if a daily/custom mod is active. There will always be two challenges to check for: the challenge and the difficulty. Both can be checked for in the same way.

public static boolean isCustomModActive(String ID) {
    return (CardCrawlGame.trial != null && CardCrawlGame.trial.dailyModIDs().contains(ID)) || ModHelper.isModEnabled(ID);
}

Mods should not need to check if Challenge the Spire is running (using Loader.isModLoaded(String ID)) since challenges are simply CustomMods

Example

public void receivePostCreateStartingRelics(AbstractPlayer.PlayerClass playerClass, ArrayList<String> relics) {
    if (isCustomModActive("TestModSTS:Only Awesomeness")) {
        if (isCustomModActive("challengethespire:Bronze Difficulty")) {
            relics.add(DeadBranch.ID);
            relics.add(BirdFacedUrn.ID);
        } else if (isCustomModActive("challengethespire:Silver Difficulty")) {
            relics.add(BirdFacedUrn.ID);
        } else if (isCustomModActive("challengethespire:Gold Difficulty") || isCustomModActive("challengethespire:Platinum Difficulty")) {
            relics.add(Vajra.ID);
        }
    }
}

Localization

Challenges are currently only supported in English and Simplified Chinese. This is due to Challenge the Spire currently only supporting English and Simplified Chinese. If you would like your challenges to be supported in more languages, please consider translating Challenge the Spire into the language you would like to support (there aren't that many strings to translate)!

Challenges will only be loaded in the language which is being played. For example, if the game is being played in Simplified Chinese (ZHS) but your challenges are only localized in English (located under localization/eng), your challenges will not be loaded. This is so the Challenge Mode screen only has one language on it.

Example Mod

To see a working example mod, check out the Default Challenge Example