forked from nisovin/MagicSpells
    
        
        - 
                Notifications
    
You must be signed in to change notification settings  - Fork 72
 
Spell chaining
        JasperLorelai edited this page Nov 26, 2024 
        ·
        9 revisions
      
    A spell system is multiple spells chained together. There's always one or multiple entry-point main spells that casts sub-spells, which might cast its sub-spells and such.
- Main spells are the entry point of a spell chain like Passive spells, spells with 
cast-item-<type>, spells cast by commands, etc. - They are cast with the 
fullcast mode. - If a chain's sub-spells are configured to be helper spells and the main spell is not, permissions to cast the spell are only checked for the main spell, meaning you only need to grant (teach or give 
grantpermissions) the main spell. 
- All sub-spells (non-entry-point spells) are cast with the 
partialcast mode, skipping some processing, but the mode can be overridden as the cast arguments page covers. - Usually, all spells generate 5 spell permissions, which takes a toll on plugin load time. For that reason, it is recommended that all sub-spells should be configured as helper spells to skip unnecessary checks.
 
- They are spells that are configured with 
helper-spell: true. - They cannot be listed in 
ListSpellor bound withBindSpell. - They will not generate any spell permissions at all.
 - All players can cast them without having them in their spell book (taught or granted). They cannot be cast by the 
/castcommand by default by non-ops because themagicspells.command.cast.self.helperpermission is not given by default. If you do give it out, an alternative to preventing command casting iscan-cast-by-command: false. - Since 4.0 Beta 17 Passive Spells marked as Helper Spells will trigger for all players.
 
main_spell:
    spell-class: ".MultiSpell"
    # granted to everyone
    always-granted: true
    # or we remove the above and set
    permission-name: pyro
    spells:
      # default "partial" cast mode, no msg
      - sub_spell_dummy
      # full mode
      - sub_spell_msg(mode=full)
sub_spell_dummy:
    spell-class: ".instant.DummySpell"
    helper-spell: true
    str-cast-self: "<red>this won't be sent</red>"
sub_spell_msg:
    spell-class: ".instant.DummySpell"
    helper-spell: true
    str-cast-self: "<lime>this will be sent</lime>"