Skip to content

Keywords

Alchyr edited this page Aug 5, 2024 · 8 revisions

Keywords should always be capitalized in card/relic/power text. Base game keywords can be used as-is.

Keywords from your mod must be prefixed with your mod's id. Keywords in card text are automatically detected. For relics, keywords must be prefixed with #y to work properly. For any other text, there is no keyword detection. Power descriptions are only seen as tooltips when hovering over the player, and if tooltips could generate other tooltips that could cause a lot of problems. For these cases, just write the text you want to see.


Example of using the keyword "Hello" and the keyword Strength.

In Keywords.json:

  {
    "PROPER_NAME": "Hello",
    "NAMES": [
      "hello"
    ],
    "DESCRIPTION": "This is a description of what the keyword does."
  },

In card text: "Gain 1 Strength. NL Next turn, gain 1 ${modID}:Hello."

In a relic: "At the start of each combat, gain #b1 #yStrength and #b1 #y${modID}:Hello." (Numbers are also colored blue in relics and powers.)

In a power: "At the start of each turn, gain #b1 #yStrength and #b1 #yHello."

Since the keywords in a power description aren't detected, you just write what you want the player to see.


Saving Keyword Text

On occasion, you may want to have easy access to the text of your keywords, such as for adding tooltips for potions. To do this, you can add an ID to your keywords, which will be used by BasicMod.

ex. in Keywords.json:

  {
    "ID": "bloink",
    "PROPER_NAME": "Bloink",
    "NAMES": [
      "bloink"
    ],
    "DESCRIPTION": "Does something."
  }

The purpose of the ID field is to have a consistent identification that won't be changed when translated. When keywords are registered, the keywords with an ID defined will be saved in the keywords Map in your main mod file.

After doing this, you should be able to access any keywords you add an ID to using MainModFile.keywords.get("keywordID"). In this example, .get("bloink").

The main relevant information if you're creating a tooltip will be .PROPER_NAME and .DESCRIPTION.

tips.add(new PowerTip(MainModFile.keywords.get("bloink").PROPER_NAME, MainModFile.keywords.get("bloink").DESCRIPTION));

Clone this wiki locally