Repository navigation
Spell02 Status Effects
← Part 1: Basic Damaging Spell | Next: Part 3: Unit Stat Upgrades →
In this lesson, we’ll build a spell that grants a status effect to every unit (friendly and enemy) on an entire floor.
Our card, Give Everyone Armor, grants Armor 2 to all friendly and enemy units in the target room. Along the way, you'll learn how room-wide targeting works, how status effects are defined, and how to use localization replacement tokens for game keywords.
Download the custom card art:
- Download Art: GiveEveryoneArmor.png
-
Save Location: Save it to your mod project under
textures/GiveEveryoneArmor.png.
In Plugin.cs, add "json/spells/GiveEveryoneArmor.json" to your AddMergedJsonFile call. Then create json/spells/GiveEveryoneArmor.json and add:
{
"$schema": "https://github.com/Monster-Train-2-Modding-Group/Trainworks-Reloaded/releases/latest/download/schema.json",
"cards": [
{
"id": "GiveEveryoneArmor",
"cost": 1,
"names": {
"english": "Give Everyone Armor"
},
"descriptions": {
"english": "Apply [armor] [effect0.status0.power] to all units."
},
"rarity": "uncommon",
"targets_room": true,
"targetless": true,
"class": "ClassBanished",
"card_art": "@GiveEveryoneArmorCardArt",
"pools": [
"MegaPool"
],
"effects": [
"@GiveAllUnitsArmor"
]
}
],
"effects": [
{
"id": "GiveAllUnitsArmor",
"name": "CardEffectAddStatusEffect",
"target_mode": "room",
"target_team": "both",
"param_status_effects": [
{
"status": "armor",
"count": 2
}
]
}
],
"game_objects": [
{
"id": "GiveEveryoneArmorCardArt",
"type": "card_art",
"extensions": {
"card_art": {
"sprite": "@GiveEveryoneArmorSprite"
}
}
}
],
"sprites": [
{
"id": "GiveEveryoneArmorSprite",
"path": "textures/GiveEveryoneArmor.png"
}
]
}In Part 1, we targeted a single character with an arrow. Here, we target the floor itself:
-
targets_room: true&targetless: true: When dragged, the card highlights the room rather than displaying a directional targeting arrow toward an individual unit. -
target_mode: "room": Instructs the effect to target character in the room. Withtarget_teamwe determine which team gets targeted. -
target_team: "both": Ensures the effect applies to both Monsters (friendly) and Heroes (enemies).
"descriptions": {
"english": "Apply [armor] [effect0.status0.power] to all units."
}-
[armor]: A dynamic localization tag that automatically inserts the localized term for Armor in bold text. -
[effect0.status0.power]: Traverses the card's data structure to read the count (power) of the first status effect (status0) in the first effect of the card (effect0) (here, it will evaluate to2).
Important
Remember never hardcode numeric values in your card text! Status stack counts can be dynamically modified by upgrades such as Doublestack or Dualism. Using [effect0.status0.power] guarantees that description text stays accurate when card upgrades are added to the card.
"effects": [
{
"id": "GiveAllUnitsArmor",
"name": "CardEffectAddStatusEffect",
"target_mode": "room",
"target_team": "both",
"param_status_effects": [
{
"status": "armor",
"count": 2
}
]
}
]-
name:CardEffectAddStatusEffectis the general-purpose effect that applies a status effect to the targeted units. -
param_status_effects: A list defining the status to apply:-
status: The internal ID of the status effect. Note that internal IDs don't always match the lowercase display name (e.g., Quick is internally namedambush). -
count: The number of stacks applied.
-
-
param_int(optional): When usingCardEffectAddStatusEffect,param_intacts as a percentage chance (0–100) to apply the effect. If omitted, it defaults to 100%.
Warning
Keep only one status effect inside the param_status_effects array. If multiple entries are provided, CardEffectAddStatusEffect randomly picks only one entry when the card is cast, like Psuedoscience from Lazarus Leage. If you need a card to apply multiple different status effects at once, use multiple CardEffectAddStatusEffect effects each applying the status effects you wish to add.
- Build your solution and verify the compiled mod output is in
BepInEx/plugins/<YourMod>/. - Launch Monster Train 2 and check the BepInEx console log for clean startup with no errors.
- Start a battle with several friendly and enemy units present in a room:
- Verify the card displays the name Give Everyone Armor, costs 1 Ember, and shows the text: "Apply Armor 2 to all units."
- Cast the card into the room: confirm that every unit on the floor—both allies and enemies—receives 2 stacks of Armor.
Now that you can apply status effects across floors, head to Part 3: Unit Stat Upgrades (Not Razorsharp Edge) to learn how to alter unit attack and health using CardUpgrades.
Need Help? Got Feedback?
We're in the Shiny Shoe Discord Server - #mt2-modding