Infodump - Alchyr/BasicMod GitHub Wiki

This page is for smaller chunks of information that are helpful but where an individual page would be excessive.


Card Type

Any card that has effects when used that are affected by damage modifiers (Strength, Weakness) should be an attack. If a card is affected by damage modifiers and is not an attack or triggers on something other than being played, that results in strange interactions with relics like Pen Nib, and is not recommended.

If a card gives the player a long-term benefit for the combat or run, it should likely be a Power. Especially if it applies a power to the player. If it has to target an enemy, it's a Skill.

Permanent card with negative effects: Curse.

Temporary card with negative effects: Status.

Anything else: it's a Skill.

Card Target

NONE - Cards that don't directly interact with the player or an enemy. SELF - Cards that directly affect the player. Block cards, power cards. The base game is a bit inconsistent with these two. Warcry targets SELF, while Skim targets NONE. ENEMY - Cards that directly target a single enemy. SELF_AND_ENEMY - Cards that directly target a single enemy but also affect the player. The only base game example is Spot Weakness. ALL_ENEMY - Cards that affect all enemies. This includes cards that damage a random enemy, such as Sword Boomerang. ALL - Cards that affect everyone.

In terms of functionality, only ENEMY and SELF_AND_ENEMY are different from the rest, adding a targeting arrow and passing the targeted monster to the use method of the card. The rest of the targeting types are identical other than displaying a targeting reticle on their targets. All of them will just pass null for the monster target of the use method, and the player parameter of use is always the same as AbstractDungeon.player.


@Override

You'll probably see the @Override annotation in front of quite a few methods in your code. What does @Override do? Nothing at all- your code will work exactly the same whether it's there or not. @Override isn't there for the code, it's there for you. When a method has the @Override annotation, that tells the compiler that you're trying to override a method. If a method has the annotation but doesn't override anything, the compiler will give you an error to let you know that there's something wrong.


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.

The registerKeyword method in your main mod file should look like this.

    private void registerKeyword(KeywordInfo info) {
        BaseMod.addKeyword(modID.toLowerCase(), info.PROPER_NAME, info.NAMES, info.DESCRIPTION);
        if (!info.ID.isEmpty())
        {
            keywords.put(info.ID, info);
        }
    }

If it does not (an older version of BasicMod), you can modify it to match. You'll just need to add public static final Map<String, KeywordInfo> keywords = new HashMap<>(); to the main mod file, along with updating the registerKeyword method.

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));