-
Notifications
You must be signed in to change notification settings - Fork 1
Using Archetype API
Gremious edited this page Apr 26, 2019
·
30 revisions
- 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")) {
setCharacterDefaultNumOfCards(TheDefault.Enums.THE_DEFAULT, 71); // Necessary for custom characters only
loadArchetypes("yourModResources/localization/eng/ArchetypeAPIJsons/");
}The file patch 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)
- 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 patch 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 Archetype", // The name of the archetype.
"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.
],
"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",
"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 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.
}