Skip to content

Dynamically adjust spell configuration nodes via api. #393

Open
@NeumimTo

Description

@NeumimTo

Copying conversation from discord server channel:

NeumimTo 19.12.2020

Hey, I would like to dynamically adjust spell numerical values depending on ingame conditions/player state.
So far it seems nearly impossible to achieve such thing.

For example

dodge:
    spell-class: ".buff.DodgeSpell"
    toggle: true
    duration: <value that is unique depending on a player that casts the spell>
    distance: 2
    spells:
        - particleProjectileSpellName

Any chance to make this thing more accessible, or provide necessary hooks that other plugins could use?
I looked at the code, and only thing that came to my mind is to somehow make MobConfig to have an unique spell definition per player.
eg:

dodge_player1:
    duration: 1000
   ...
dodge_player2:
    duration: 2000

which is a sollution i dont really like

The easiest and least destructive way to allow such thing seems to be editing Spell#getConfigInt/Long/... methods
pseudocode

    protected int getConfigInt(String key, int defaultValue, Player caster) {
        return thirdPartyHookEnabled && hook.supportsNode(key) ? callhook(key, caster) : config.getInt("spells." + internalName + '.' + key, defaultValue);
    }

JasperLorelai 19.12.2020
This was something that was planned. We wanted to have MS variable replacement supported in configuration options. I looked into it before and I agree that one of the easiest ways to do that is through the getConfig methods. We'd need to add a player argument and make it read the values every time the spell is casted.

I could help to complete this task if theres someone willing to guide me thru codebase

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions