lipefl / swade-tools

A Fondry VTT module with automations for Savage Worlds (SWADE)
15 stars 13 forks source link

globalMods #266

Closed EternalRider closed 3 months ago

EternalRider commented 1 year ago

add globalMods and damage attribute effect modifier.

ItemRoll.js - replace

    addSkillMod(){
        this.addModifier(this.item.system.trademark,gb.trans('TrademarkWeapon.Label','SWADE'))
        this.addModifier(this.item.system.actions.traitMod,gb.trans('ModItem'));
        if (this.actor?.system?.stats?.globalMods?.attack && this.actor?.system?.stats?.globalMods?.attack.length > 1) {
            this.actor?.system?.stats?.globalMods?.attack.forEach(el => {
                this.addModifier(el.value,el.label);
            });
        }
    }

    addDmgMod(){
        this.addModifier(this.data.dmgMod,gb.trans('ModItem'));
        if (this.actor?.system?.stats?.globalMods?.damage && this.actor?.system?.stats?.globalMods?.damage.length > 1) {
            this.actor?.system?.stats?.globalMods?.damage.forEach(el => {
                this.addModifier(el.value,el.label);
            });
        }
    }

CharRoll.js - rollAtt - add

        this.actor.system.stats.globalMods[attribute].map(e=>{
            this.addModifier(e.value,e.label);
        })

CharRoll.js - rollSkill - replace

        if (item===undefined){
            item = await game.packs.get(gb.systemSetting("coreSkillsCompendium")).getDocument(await game.packs.get(gb.systemSetting("coreSkillsCompendium")).index.find(el => el.name == skillName)._id);
            skillName=`${gb.trans('Unskilled')} (${skillName})`;
            dieType=4;
            this.addModifier(-2,gb.trans('Unskilled'));
            if (item.system?.attribute != "") {
                this.actor.system.stats.globalMods[item.system.attribute].map(e=>{
                    this.addModifier(e.value,e.label);
                })
            }

            if (wildCard){
                wildDie=6;
            } 

        } else {
            dieType=item.system.die.sides;

            if (wildCard){
                wildDie=item.system["wild-die"].sides;
            } 

            this.addModifier(gb.skillModifier(item),gb.trans('ModSkill'))
            if (item.system?.attribute != "") {
                this.actor.system.stats.globalMods[item.system.attribute].map(e=>{
                    this.addModifier(e.value,e.label);
                })
            }

            if (item.system.attribute=='agility'){
                this.agilityMods();
            }
        }

CharRoll.js - changeStr- add

                    if (this.actor.system.attributes[data.name].die.modifier){
                        this.addModifier(this.actor.system.attributes[data.name].die.modifier,gb.trans(`Attr${data.short.charAt(0).toUpperCase()}${data.short.slice(1)}`,'SWADE'));
                    }
                    this.actor.system.attributes[data.name].effects.map(e=>{
                        this.addModifier(e.value,e.label);
                    })
                    this.actor.system.stats.globalMods[data.name].map(e=>{
                        this.addModifier(e.value,e.label);
                    })

image

Neurochimp commented 11 months ago

I came here to put in a ticket for this after my last session. I tried to use a global mod for Blindness & it didn't come through in SWADE Tools. Hope it's something that can be worked in. If the following picture helps, this is how they are implemented as effects in English. global

EternalRider commented 11 months ago

I came here to put in a ticket for this after my last session. I tried to use a global mod for Blindness & it didn't come through in SWADE Tools. Hope it's something that can be worked in. If the following picture helps, this is how they are implemented as effects in English. global

That's what I done at this issue. You can edit these js file that I wrote in first level.

lipefl commented 11 months ago

Added in v1.14.7

Neurochimp commented 11 months ago

Thank you!

Neurochimp commented 11 months ago

I tried testing this over the weekend and unfortunately I'm not seeing the global damage mod show up in the chat with the damage roll. Going to test the others over the holiday. Was able to confirm though that global damage does show up when I don't have SWADE tools on - just had core running, nothing else.

lipefl commented 11 months ago

I'll reopen to investigate.

lipefl commented 11 months ago

Fixed in v1.14.8 Thanks!

Neurochimp commented 10 months ago

Thank you!

Neurochimp commented 3 months ago

Been a long time & I haven't tried any custom Global Mods. I built one for one of my players this week & unfortunately it did not work in SWADE Tools. It does work in Core with the base game. Attaching some screen clippings of what I see. First pic is the global mod as an effect - works in vanilla but not in tools. Global_Mod _Issue Second two shots are of two PCs - the top most part off the clip is rolled in core where it includes the modifier in the roll - present in the popup dialogue as well; the lower pics show it present on the character sheet, but then the last part of the clip shows what happens in SWADETools. Coryn_Error_1 Rums_Error_1 If you could look into this, I'd appreciate it. I was on v11 till today. Seeing the same behavior on v12 as v11 last night. Thanks again.

Neurochimp commented 3 months ago

Sorry the pics are so big!

lipefl commented 3 months ago

After looking at the code, I think global trait was skipped. All the other are working, right? Unfortunately, i can only update for v12 (v1.16)

Neurochimp commented 3 months ago

Yeah, I am on v12 now. Took the plunge after giving 2 weeks for Savage Worlds update to get quick fixes on any breaking bugs.

I tried - system.stats.globalMods.attack just now & that does work.

lipefl commented 3 months ago

Added in v1.16.1 Thank you!