-
Notifications
You must be signed in to change notification settings - Fork 1
Using Archetype API
- Make a json in the template listed below.
- Add archetypeapi as a maven dependency.
- In the recievePostInitialize() of your mod add the following line of code.
if (Loader.isModLoaded("archetypeapi")) {
// The first line is for custom characters only:
setCharacterDefaultNumOfCards(TheDefault.Enums.THE_DEFAULT, 71);
loadArchetypes("yourModResources/localization/eng/ArchetypeAPIJsons/");
}The file path being the directory where you put all the json's, not any actual individual json file.
(the / at the end if important btw)
- Done.
-
Download the latest release of this mod via the Steam Workshop.
-
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>- 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)
If you have a card that fits in multiple ones (for example, "add 1 shiv to your hand and apply 5 poison") - put it in both Shiv and Poison archetypes. Duplicates are cleared so you can put the same card in as many places as you want.
If you are adding cards to an existing archetype like "Poison" name it something that differentiate your mod from others/the base game poison class. For exmaple "My Cool Mod's Poison".
If you are adding extra non-archetype specific (basic) cards to existing classes, tag that archetype as BASIC so that those cards always get loaded with the basic archetype.
- In the
recievePostInitialize()in your class with spireInitialiser add the following line of code.
if (Loader.isModLoaded("archetypeapi")) {
setCharacterDefaultNumOfCards(TheDefault.Enums.THE_DEFAULT, 71);
// Necessary for custom characters only
// It takes your AbstractPlayer.PlayerClass and the amount of cards you want to load as a base.
// For example, if you have 150 cards but want every run to have ~75, put 75
// If you skip this line it'll default to the max amount of cards your mod has.
// ONLY FOR CUSTOM CHARACTERS. Don't override the Ironclad/Defect/Silent - I already set those.
// Keep in mind that's it's not actually "75" cards usally, as starter cards don't count.
// (Silent and defect is 71, Ironclad is 72)
loadArchetypes("yourModResources/localization/eng/ArchetypeAPIJsons/");
}The file path being the directory where you put all the json's, not any actual individual json file.
(the / at the end if important btw)
- You are done!
{
"CHARACTER": "THE_SILENT", // The character enum for the class you're adding this archetype to.
"NAME": "Cool Poison Expac", // The name of the archetype as shown on the selection card.
"ARCHETYPE_NAME": "Poison", // The name of the basegame archetype you are expanding.
// If making a brand new one, put your own unique name in here.
// Other mods can put that name to expand *your* archetype too.
// When rolled randomly, ones with the same names include each-other.
// You can check the json names of the base classes in the resource fodler of this mod to find the correct names.
// DO NOT ADD SINGLE TAG IF EXPANDING BASE-GAME ARCHETYPES. Just having the same name is enough.
"CARD_TYPE": "SKILL", // The selection cards' type.
"IMG": "myModResources/images/cards/Card.png", // The selection cards' image.
// if you wish to use basegame images, put, for exmaple, "green/skill/adrenaline",
"TAGS": [
"SINGLE" // The tags of this archetype. VERY IMPORTANT. All of them are detailed below as well as in the tag patch.
// DO NOT ADD SINGLE TAG IF EXPANDING BASE-GAME ARCHETYPES. Just having the same name is enough.
],
"FEATURES": [
// The selection card has a tooltip that shows a couple of card names (usually 3, 1 of each rarity). Add them here.
"myModID:CardOfThisArchetype1",
"myModID:CardOfThisArchetype3",
"myModID:CardOfThisArchetype4",
],
"CARD_IDS": [ // The ID's of your cards!
"myModID:CardOfThisArchetype1",
"myModID:CardOfThisArchetype2",
"myModID:CardOfThisArchetype3",
"myModID:CardOfThisArchetype4"
.
.
.
]
}{
"CHARACTER": "THE_SILENT",
"NAME": "Cool Archetype",
"ARCHETYPE_NAME": "Unique",
"CARD_TYPE": "SKILL",
"IMG": "myModResources/images/cards/Card.png",
"TAGS": [
"SINGLE"
],
"FEATURES": [
"myModID:CardOfThisArchetype1",
"myModID:CardOfThisArchetype3",
"myModID:CardOfThisArchetype4",
],
"CARD_IDS": [
"myModID:CardOfThisArchetype1",
"myModID:CardOfThisArchetype2",
"myModID:CardOfThisArchetype3",
"myModID:CardOfThisArchetype4"
]
}
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 add unique archetypes 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!
// ALL BASEGAME ARCHETYPES ARE PRE-TAGGED. DO NOT ADD SINGLE TAG IF EXPANDING BASE-GAME ARCHETYPES.
// Just having the same name is enough.
// 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."
// This is NOT a tag for archetypes of cards that do, for example, Poison and Discard both.
// This is for fun custom mixes of cards taht should not show up when randomly drafting archetypes
// but should show when players choose to select it.
@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.
}