Charms
Ownership of charms can be checked with the PlayerData.instance.gotCharm_X
var, where X is the ID found in the following list. Checking if they are
equipped can be checked with PlayerData.instance.equippedCharm_X
. The cost to
equip charms can be changed with PlayerData.instance.charmCost_X
.
Note
Using PlayerData.instance.GetBool("gotCharm_X")
or
PlayerData.instance.GetInt("charmCost_X")
is prefered, as that way
other mods can make their changes to the desired values.
Overriding values
You can directly set PlayerData
values, however, this permanently changes a
save file. It's often better to use the
GetPlayerIntHook
. This makes the
change only apply when the mod is active, which is generally preferable.
using Modding;
// This changes the cost of Wayward Compass to 0
public class Example : Mod {
public override void Initialize() {
ModHooks.GetPlayerIntHook += GetInt;
}
private int GetInt(string name, int orig) {
return name == nameof(PlayerData.charmCost_2)
? 0
: orig;
}
}
For the actual behaviour of charms, it varies from charm-to-charm. However,
a large amount can be found on HeroController constants such as RUN_SPEED_CH
and RUN_SPEED_CH_COMBO
for Sprintmaster, GRUB_SOUL_MP
and GRUB_SOUL_MP
for Grubsong, ATTACK_DURATION_CH
for Quickslash, and more.
Sprites
If you mean to replace a charm, then you can change the sprites used for it. There are two main areas a charm sprite pops up, one being the inventory and the other being shops. You can change them as follows:
Given a sprite, one can replace it in the inventory using CharmIconList
,
which allows you to just assign to its sprite list, indexed by charm ID.
CharmIconList.Instance.spriteList[i] = sprite;
A few charms, such as grimmchild and the unbreakable charms have separate fields in the CharmIconList class.
The sprites for the kings soul and shade soul also have to be defined by code when the CharmDisplay starts.
For this you can use the On
hook for CharmDisplay.Start
. For brevity, only the handler will
be shown below.
public void OnCharmDisplayStart(On.CharmDisplay.orig_Start orig, CharmDisplay self)
{
self.whiteCharm = kingsSoulSprite;
self.blackCharm = shadeSoulSprite;
orig(self);
}
Values
ID | Name | LangName | Add.Bool |
---|---|---|---|
01 | Gathering Swarm | CHARM_NAME_1 | None |
02 | Wayward Compass | CHARM_NAME_2 | None |
03 | Grubsong | CHARM_NAME_3 | None |
04 | Stalwart Shell | CHARM_NAME_4 | None |
05 | Baldur Shell | CHARM_NAME_5 | None |
06 | Fury of the Fallen | CHARM_NAME_6 | None |
07 | Quick Focus | CHARM_NAME_7 | None |
08 | Lifeblood Heart | CHARM_NAME_8 | None |
09 | Lifeblood Core | CHARM_NAME_9 | None |
10 | Defender’s Crest | CHARM_NAME_10 | None |
11 | Flukenest | CHARM_NAME_11 | None |
12 | Thorns of Agony | CHARM_NAME_12 | None |
13 | Mark of Pride | CHARM_NAME_13 | None |
14 | Steady Body | CHARM_NAME_14 | None |
15 | Heavy Blow | CHARM_NAME_15 | None |
16 | Sharp Shadow | CHARM_NAME_16 | None |
17 | Spore Shroom | CHARM_NAME_17 | None |
18 | Longnail | CHARM_NAME_18 | None |
19 | Shaman Stone | CHARM_NAME_19 | None |
20 | Soul Catcher | CHARM_NAME_20 | None |
21 | Soul Eater | CHARM_NAME_21 | None |
22 | Glowing Womb | CHARM_NAME_22 | None |
23 | Fragile Heart | CHARM_NAME_23 | None |
Fragile Heart (Repair) | CHARM_NAME_23_BRK | brokenCharm_23 | |
Unbreakable Heart | CHARM_NAME_23_G | fragileHeart_unbreakable | |
24 | Fragile Greed | CHARM_NAME_24 | None |
Fragile Greed (Repair) | CHARM_NAME_24_BRK | brokenCharm_24 | |
Unbreakable Greed | CHARM_NAME_24_G | fragileGreed_unbreakable | |
25 | Fragile Strength | CHARM_NAME_25 | None |
Fragile Strength (Repair) | CHARM_NAME_25_BRK | brokenCharm_25 | |
Unbreakable Strength | CHARM_NAME_25_G | fragileStrength_unbreakable | |
26 | Nailmaster’s Glory | CHARM_NAME_26 | None |
27 | Joni’s Blessing | CHARM_NAME_27 | None |
28 | Shape of Unn | CHARM_NAME_28 | None |
29 | Hiveblood | CHARM_NAME_29 | None |
30 | Dream Wielder | CHARM_NAME_30 | None |
31 | Dashmaster | CHARM_NAME_31 | None |
32 | Quick Slash | CHARM_NAME_32 | None |
33 | Spell Twister | CHARM_NAME_33 | None |
34 | Deep Focus | CHARM_NAME_34 | None |
35 | Grubberfly’s Elegy | CHARM_NAME_35 | None |
36 | White Fragment | CHARM_NAME_36_A | royalCharmState |
Kingsoul | CHARM_NAME_36_B | ||
Void Heart | CHARM_NAME_36_C | gotShadeCharm | |
37 | Sprintmaster | CHARM_NAME_37 | None |
38 | Dreamshield | CHARM_NAME_38 | None |
39 | Weaversong | CHARM_NAME_39 | None |
40 | Grimmchild | CHARM_NAME_40 | grimmChildLevel |
Carefree Melody | CHARM_NAME_40_N |