Skip to content

ItemDefinitionEnchantScroll ​

Inherits: ItemDefinition < DatabaseResource < Resource

Enchantment scrolls that can permanently or temporarily enhance equipment items Uses effects system for actual enchantment functionality

Properties ​

intenchant_effect_id
floatenchant_duration-1.0
booloverride_effect_durationtrue
Array[int]allowed_equipment_types[]
boolallows_weaponsfalse
boolallows_any_equipmentfalse
Stringenchant_category"general"
boolconflicts_with_categoryfalse
boolconsume_on_usetrue

Methods ​

boolcan_use( user: Entity, item_instance: ItemInstance = null )
boolexecute_use( user: Entity, item_instance: ItemInstance )
Stringget_use_action_name( _item_instance: ItemInstance )
boolcan_enchant_equipment( equipment_definition: ItemDefinitionEquipment )
boolcan_enchant_item_instance( item_instance: ItemInstance )
boolapply_enchantment_to_item( target_item: ItemInstance, user: Entity = null )
Stringget_enchant_source()
Stringget_compatible_equipment_types_text()
booltargets_weapons()
booltargets_armor()
Array[Dictionary]validate_enchant_scroll()
booluse_enchant_scroll( scroll_item: ItemInstance, target_equipment: ItemInstance, user: Entity )

Property descriptions ​

int enchant_effect_id ​

The effect applied when this enchantment scroll is used on equipment

float enchant_duration = -1.0 ​

Duration override for all effects (-1 = permanent, >0 = temporary in seconds)

bool override_effect_duration = true ​

Whether to override individual effect durations (scroll is king)

Target Restrictions

Array[int] allowed_equipment_types = [] ​

Array of equipment type IDs this enchantment can be applied to

bool allows_weapons = false ​

Whether this enchantment can be applied to weapons specifically

bool allows_any_equipment = false ​

Whether this enchantment can be applied to any equipment if no specific types are set

Enchantment Categories

String enchant_category = "general" ​

Category of enchantment for organization and conflict resolution

bool conflicts_with_category = false ​

Whether this enchantment conflicts with others in the same category

Consumption

bool consume_on_use = true ​

Whether this scroll is consumed when used

Method descriptions ​

bool can_use( user: Entity, item_instance: ItemInstance = null ) ​

Check if the enchant scroll can be used

bool execute_use( user: Entity, item_instance: ItemInstance ) ​

Execute enchant scroll usage - this would trigger the enchanting UI/process The actual enchanting logic would be handled by the enchanting system

String get_use_action_name( _item_instance: ItemInstance ) ​

Get display name for enchant scroll action

bool can_enchant_equipment( equipment_definition: ItemDefinitionEquipment ) ​

Check if this enchantment can be applied to a specific equipment item

bool can_enchant_item_instance( item_instance: ItemInstance ) ​

Check if this enchantment can be applied to a specific equipment item instance

bool apply_enchantment_to_item( target_item: ItemInstance, user: Entity = null ) ​

Apply this enchantment to a target equipment item instance New single enchant system - replaces existing enchants

String get_enchant_source() ​

Get the source identifier for this enchant scroll

String get_compatible_equipment_types_text() ​

Get a list of compatible equipment types for display

bool targets_weapons() ​

Check if this enchantment targets weapons

bool targets_armor() ​

Check if this enchantment targets armor

Array[Dictionary] validate_enchant_scroll() ​

Validate the enchantment scroll configuration

bool use_enchant_scroll( scroll_item: ItemInstance, target_equipment: ItemInstance, user: Entity ) ​

Apply this enchant scroll to target equipment This is the main entry point for the enchanting system