DEGENESIS-FoundryVTT icon indicating copy to clipboard operation
DEGENESIS-FoundryVTT copied to clipboard

spent ego bonus accumulates on combat actor

Open dmdorman opened this issue 2 years ago • 3 comments

When spending ego and then rolling initiative on an actor that is in combat the bonus from ego stacks. From what I've seen this does not happen to actors that aren't in combat. And it doesn't happen when opening the character sheet from the right hand side.

Steps to reproduce:

  • create an actor
  • add the actor to the scene
  • create an encounter and add actor to encoutner
  • begin combat
  • open character sheet by clicking on the actor token in the scene
  • increase 'SPEND EGO'
  • click 'INITIATIVE'
  • repeat the previous 2 steps

The image below is what I got from doing this a few times

image

dmdorman avatar Jan 30 '23 04:01 dmdorman

After poking around this more I don't think it'll come up in normal play as you'd have to go out of your way to not roll anything other than initiative or the modifier would go down.

Anyways I'm sure there's a better way to do this fixes it between rounds

Hooks.on("combatRound", function () {
    const encounter = game.combats.combats.find(e => e.active === true)

    encounter.combatants.forEach(function(combatant, index) {
        const itemIds = combatant.actor.items.filter(e => e.name === 'Spent Ego Bonus').map(function (value, index) {
            return value._id
        })

        combatant.actor.deleteEmbeddedDocuments('Item', itemIds)
    })    
});

dmdorman avatar Jan 30 '23 05:01 dmdorman

Will look into that, thanks for feedback :)

greedyj4ck avatar Jan 30 '23 07:01 greedyj4ck

I checked and tested some functionality. Main conclusions are:

  1. Rolling initiative from character sheet does not update initiative value in combat tracker
  2. Combat tracker initiative roll does not use spend ego points
  3. Functionality spend ego points works weird to say the least, entire feature needs a rework.

greedyj4ck avatar Feb 01 '23 20:02 greedyj4ck

I think this fix was implemented back in a days. Closing for now as resolved.

greedyj4ck avatar May 11 '24 18:05 greedyj4ck