Magic: Crafting

Part of my experimentation with ideas for interesting magic systems

Something I always want out of magic systems is true spell crafting, whether its premeditated and UI based like in The Elder Scrolls, or done on-the-fly as in Magicka. In this experiment I’m trying to find a happy middle ground between the two; one that supports the depth and possibilities of a more complex system while still allowing players to adapt as they play & avoid spending too much time ‘stuck’ in the UI.

Here’s an example of how this spell is expressed in code:

local comp = {
    Name = "HEAL",
    Type = "SPELL",
    Cost = 100,
    Invoke = function( self, ply )
        print( "Try invoke HEAL" )
        local trigger = self.SubComponents["Trigger"].Value
        local invoke = function()
            local ent = MM_InvokeComponent( ply, self.SubComponents["Patient"].Value )
            ent:AddBuff( 4 )
            MM_Net_Invoke( ent, self.Name .. " " .. ent:Nick() .. " because " .. trigger )
        end
        MM_InvokeComponent( ply, trigger, { invoke } )
    end,
    SubComponents = {
        -- Ent to heal
        ["Patient"] =
        {
            Type = "TARGET",
            RequiredType = "Entity",
            Value = "TARGET_SELF",
        },
        -- Trigger
        ["Trigger"] =
        {
            Type = "TRIGGER",
            RequiredType = "Number",
            Value = "TRIGGER_HURT",
            -- Value = { "TRIGGER_TIME", 0 },
        },
    },
}
MM_AddComponent( comp )

Each SubComponent here will eventually be switchable in-game using a node based UI.

One idea for the possible gameplay is that players start with no knowledge but can find these components littered around the map; each one opening up new possibilities for spell combos.