Jagusti / fvtt-wfrp4e-gmtoolkit

Utility module with tweaks, enhancements and macros to help GMs with game management when running Warhammer Fantasy Roleplay (4e) sessions in Foundry Virtual Tabletop.
MIT License
15 stars 9 forks source link

Help for adding more than one advantage at a time #253

Closed TheFirst05 closed 10 months ago

TheFirst05 commented 10 months ago

Context

What is the motivation or use case?

I'm attempting to make a macro that semi-automates the Assess Action from Group Advantage. The bare-bones functionality would be: roll Intuition on a selected token, and if successful, increase Group Advantage by 2 (or 3 if +6SL). Here's my current code, using GM Toolkit functionality.

const assess = async function (actor) {
    let hasIntuition = game.gmtoolkit.utility.hasSkill(actor, "Intuition", "silent")
    if (hasIntuition != null) {
        const test = await actor.setupSkill(game.i18n.translations.NAME.Intuition, { appendTitle: " to Assess" });
        await test.roll();
        if (test.result.outcome == "success") {
            game.gmtoolkit.advantage.update(token, "increase");
            game.gmtoolkit.advantage.update(token, "increase");
        };
    }
}
assess(actor);
// To do: check if SL > 6 (Astounding Success) and then increased Advantage by +3. 
// To do: If Intuition doesn't exist, roll Initiative instead. 

Unfortunately, using game.gmtoolkit.advantage.update, it only gives 1 extra advantage, not 2.

What do I like to happen?

Do you know what I'd need to do to increase Group Advantage several times with a single macro activation? Any help or advice appreciated :)

If it is currently impossible to make the above macro work with the current GMtoolkit, would it be feasible to update the GMtoolkit to be able to handle multiple advantage increases at once? If you feel it's appropriate, you could even add an "Assess" macro to the toolkit.

Thank you in advance for any insight you could give me on the subject.

Jagusti commented 10 months ago

Unfortunately, using game.gmtoolkit.advantage.update, it only gives 1 extra advantage, not 2.

I'm not expecting to change this anytime soon, so you probably want to use actor.modifyAdvantage(2), which is a built-in system method.

If you feel it's appropriate, you could even add an "Assess" macro to the toolkit.

There are a few different things I'd like to do with Group Advantage, including things like this, but being realistic I'm not likely to get to it any time soon.

TheFirst05 commented 10 months ago

Thank you very much. that worked perfectly! Really appreciate it!

but being realistic I'm not likely to get to it any time soon.

That's absolutely fine! Thanks for pointing me in the right direction.