Skip to content

Using Archetype API

Gremious edited this page Apr 26, 2019 · 30 revisions

Short Version:

  1. Make a json in the template listed below.
  2. Add archetypeapi as a maven dependency.
  3. In the recievePostInitialize() of your mod add the following line of code.
        if (Loader.isModLoaded("archetypeapi")) {
            loadArchetypes("yourModResources/localization/eng/ArchetypeAPIJsons");
        }

The file patch being the directory where you put all the json's, not any actual individual json file.

  1. Done.

Detailed version

  1. Download the latest release of this mod via the Steam Workshop.

  2. Add it as a Maven dependency via your pom.xml like so:

       <dependency>
            <groupId>archetypeapi</groupId>
            <artifactId>ArchetypeAPI</artifactId>
            <version>2.0.0</version>
            <scope>system</scope>
            <systemPath>steam/steamapps/workshop/content/path/to/ArchetypeAPI.jar</systemPath>
        </dependency>
  1. Make json file with your card ID's as detailed in the exmaple JSON bellow.

If you are adding multiple archetypes, make a unique JSON file for each one.

Don't add starter/special rarity cards to the json. Any card added to this file will be added to the reward pool, regardless of type/color/rarity. (This does also mean you can create cool cross-color/curse+ mixes)

  1. In the recievePostInitialize() in your class with spireInitialiser add the following line of code.
        if (Loader.isModLoaded("archetypeapi")) {
            loadArchetypes("yourModResources/localization/eng/ArchetypeAPIJsons");
        }

The file patch being the directory where you put all the json's, not any actual individual json file.

You are done!


Commented json. Uncommented verstion for copy-pasting added below.

{
  "CHARACTER": "THE_SILENT", // The character enum for the class you're adding this archetype to.
  "NAME": "Cool Archetype",  // The name of the archetype.
  "CARD_TYPE": "SKILL", // The selection cards' type.
  "IMG": "lotusMarksResources/images/cards/Mark.png", // The selection cards' image.
  "TAGS": [
    "SINGLE" // The tags of this archetype. VERY IMPORTANT. All of them are detailed below as well as in the tag patch.
  ],
  "FEATURES": [ 
   // The selection card has a tooltip that shows a couple of card names (usually 3, 1 of each rarity). Add them here.
    "lotusMarks:Mark",
    "lotusMarks:LotusChain",
    "lotusMarks:SkilledExecution"
  ],
  "CARD_IDS": [ // The ID's of your cards!
    "myModID:CardOfThisArchetype1",
    "myModID:CardOfThisArchetype2",
    "myModID:CardOfThisArchetype3"
    .
    .
    .
  ]
}

Uncommented Json

{
  "CHARACTER": "THE_SILENT",
  "NAME": "Cool Archetype",
  "CARD_TYPE": "SKILL",
  "IMG": "lotusMarksResources/images/cards/Mark.png",
  "TAGS": [
    "SINGLE"
  ],
  "FEATURES": [
    "lotusMarks:Mark",
    "lotusMarks:LotusChain",
    "lotusMarks:SkilledExecution"
  ],
  "CARD_IDS": [ - The ID's of your cards!
    "myModID:CardOfThisArchetype1",
    "myModID:CardOfThisArchetype2",
    "myModID:CardOfThisArchetype3"
  ]
}

Card Tags

public class ArchetypeCardTags {
    @SpireEnum
    public static AbstractCard.CardTags BASIC; // IMPORTANT!!!
    // For custom characters, this is the tag for the archetype selection card of the non-archetype cards,
    // or, cards you want always included.
    // THE ARCHETYPE TAGGED WITH THIS WILL *ALWAYS* BE ADDED TO THE CARDPOOL WHEN ROLLED RANDOMLY.
    // YOU MUST HAVE AT LEAST 1 ARCHETYPE CARD TAGGED WITH THIS FOR A CUSTOM CHARACTER!
    // This is also to make sure you load at least a minimal number of cards rather than generating random ones and for a
    // smoother playing experience.
    // A mod option to disable "Always Basic" will be added in the future.

    @SpireEnum
    public static AbstractCard.CardTags SINGLE; // IMPORTANT!!!
    // For single/core archetypes. Cards that say "poison" and only add the poison archetype and nothing more.
    // KEEP IN MIND THAT IF THE PLAYER DOESN'T HAVE THE "CHOOSE ARCHETYPES ON RUN START" OPTION SELECTED,
    // ONLY CARDS TAGGED WITH THIS WILL BE IN THE RANDOM AUTO-SELECT POOL. TAG YOUR CARDS!
    // This is to prevent OPTIONS/MIXES from being randomly selected in place of an actual archetype:
    // A mod option to enable custom mixes will be added in the future.

    @SpireEnum
    public static AbstractCard.CardTags INCLUDE_SUPPORT;
    // If you are adding *new* orb archetypes, tag them with this. This API checks for this tag to know
    // whether or not it can add the "Orb Support" archetype to the pool. That archetype would not be added if you don't
    // roll any orbs.

    @SpireEnum
    public static AbstractCard.CardTags SUPPORT;
    // SUPPORT is excluded from the RNG selection pool unless a card with INCLUDE_SUPPORT is rolled as an archetype.
    // There are cards that support Defect Orbs but would be useless if the player has NO orbs in the game (Focus cards for example).
    // Of course, if you are making a custom character that uses MECHANIC and SUPPORT_MECHANIC - feel free to use these tags too.

    @SpireEnum
    public static AbstractCard.CardTags CUSTOM_MIX;
    // For exmaple, an option card that says "Poison + Discard" and adds a specific selection of only cards in those archetypes to a run.
    // Or maybe "Nothing but Claw and Double-tap."

    @SpireEnum
    public static AbstractCard.CardTags OPTION;
    // For a card that doesn't add an archetype to the pool itself, but perhaps edits it in some other way
    // For exmaple "Upgrade all poison cards if any" or something like that.

    // The latter 2 tags aren't currently utilized, but exist for future-proofing.

}

Clone this wiki locally