Spell Configuration Reference

Complete reference for all spell configuration properties in OpenRoads.

📚 Table of Contents

🎯 Configuration Overview

Every spell is defined by a set of properties that control its behavior, requirements, and effects. This reference covers all available properties and their usage.

Basic Structure

name: "Spell Name"                    # Required
description: "What the spell does"    # Required
element_required: "fire"              # Optional
min_spell_level: 10                   # Optional
min_phys_level: 0                     # Optional
sp_cost: 15                           # Required
cast_time: 0                          # Optional
cooldown: 3                           # Optional
target_type: "enemy"                  # Required
required_items: []                    # Optional
effects: []                           # Required
messages: {}                          # Optional
restrictions: {}                      # Optional
custom_handler: ""                    # Optional (JSON only)

✅ Required Properties

These properties must be present in every spell definition.

name (string)

The display name of the spell as shown to players.

Rules:

  • Must be a non-empty string

  • Should be descriptive and unique

  • Used in spell lists and messages

  • Can contain spaces and special characters

description (string)

A brief description of what the spell does.

Rules:

  • Must be a non-empty string

  • Should clearly explain the spell's purpose

  • Shown in spell information displays

  • Keep under 100 characters for readability

sp_cost (number)

The spell point cost to cast the spell.

Rules:

  • Must be a positive integer

  • Should scale with spell power

  • Consider player SP pools when setting

  • Minimum value: 1

target_type (string)

Defines what the spell targets.

Valid Values:

  • "self" - Targets the caster only

  • "enemy" - Requires an enemy target

  • "player" - Requires a player target

  • "room" - Requires a room ID

  • "none" - No target required

effects (array)

List of effects the spell produces when cast.

Rules:

🔧 Optional Properties

These properties have default values and can be omitted.

element_required (string)

Restricts the spell to specific elemental mages.

Valid Values:

  • "fire" - Fire mages only

  • "water" - Water mages only

  • "air" - Air mages only

  • "earth" - Earth mages only

  • "" or omitted - Any element can cast

min_spell_level (number)

Minimum spell level required to cast.

Rules:

  • Default: 0 (no requirement)

  • Must be non-negative integer

  • Should scale with spell power

  • Consider progression balance

min_phys_level (number)

Minimum physical level required to cast.

Rules:

  • Default: 0 (no requirement)

  • Must be non-negative integer

  • Rarely used (most spells use spell level)

  • Useful for hybrid combat/magic spells

cast_time (number)

Casting time in seconds before the spell takes effect.

Rules:

  • Default: 0 (instant cast)

  • Must be non-negative integer

  • Longer cast times should mean more powerful spells

  • Can be interrupted by damage or movement

cooldown (number)

Cooldown time in seconds before the spell can be cast again.

Rules:

  • Default: 0 (no cooldown)

  • Must be non-negative integer

  • Should scale with spell power

  • Prevents spell spam

required_items (array)

List of items that must be in the caster's inventory.

Rules:

  • Default: [] (no items required)

  • Items are consumed on successful cast

  • Item names must match exactly

  • Case-sensitive matching

custom_handler (string, JSON only)

Name of the Go function to handle custom spell logic.

Rules:

  • Only available in JSON spell definitions

  • Must match a function in the Go code

  • Used for complex spells that can't use standard effects

  • See JSON Spell Guide for details

💬 Messages Configuration

Customize messages for different spell casting situations.

Basic Messages

Cast Time Messages

Broadcast Messages

Message Properties

Property
Description
Placeholders

success

Successful spell cast

%s (target), %d (numbers)

miss

Spell effect failed

%s (target)

failure_element

Wrong element

None

failure_level

Insufficient level

%d (required), %d (current)

failure_sp

Insufficient SP

%d (needed), %d (have)

failure_target

Invalid/missing target

None

failure_items

Missing required items

%s (item name)

failure_cooldown

Spell on cooldown

None

cast_start

Cast time begins

None

cast_complete

Cast time finishes

None

cast_interrupt

Cast interrupted

None

broadcast_cast

Others see casting start

%s (caster name)

broadcast_effect

Others see spell effect

%s (caster name)

Message Placeholders

  • %s - String values (names, items, etc.)

  • %d - Numeric values (levels, damage, SP, etc.)

🚫 Restrictions Configuration

Control when and where spells can be cast.

Combat Restrictions

Rules:

  • Cannot have both combat_only and non_combat_only true

  • Default: false for both (can cast anytime)

Instance Restrictions

Rules:

  • Default: 0 (no limit)

  • Applies to summoning spells and persistent effects

  • Prevents spell stacking abuse

Location Restrictions

Rules:

  • Default: [] (no restrictions)

  • Room IDs must be strings

  • required_rooms and forbidden_rooms can both be used

  • If required_rooms is set, spell can only be cast in those rooms

Element Restrictions

Rules:

  • Default: false

  • When true, element_required must be set

  • Stricter than just element_required

✅ Property Validation

The spell system validates all properties when loading spells.

Validation Rules

String Properties

  • Must not be empty (except element_required)

  • Must be valid UTF-8

  • Length limits apply to some fields

Numeric Properties

  • Must be non-negative integers

  • SP cost must be at least 1

  • Level requirements cannot exceed reasonable limits

Array Properties

  • Can be empty

  • String arrays must contain valid strings

  • Effect arrays must contain valid effect objects

Enum Properties

  • target_type must be one of the valid values

  • element_required must be valid element or empty

Validation Errors

Common validation errors and solutions:

Invalid target_type:

Negative values:

Empty required fields:

📊 Default Values

Properties that are omitted use these default values:

Property
Default Value
Notes

element_required

""

No element restriction

min_spell_level

0

No level requirement

min_phys_level

0

No physical level requirement

cast_time

0

Instant cast

cooldown

0

No cooldown

required_items

[]

No items required

messages

{}

Default messages used

restrictions

{}

No restrictions

📋 Examples by Category

Beginner Spell

Intermediate Spell

Advanced Spell

Utility Spell

Support Spell

🎓 Conclusion

Understanding spell configuration is essential for creating balanced, functional spells. Use this reference to ensure your spells have all required properties and follow best practices.

Next Steps

  1. YAML Spell Tutorial - Learn to create spells

  2. Spell Effects Reference - Understand effects

  3. Practice - Create your own spells using this reference!

Remember: Well-configured spells enhance gameplay and provide clear feedback to players. Take time to craft good messages and appropriate restrictions! ✨

Last updated

Was this helpful?