asacolips-projects / pbta

Run games for any PbtA system in Foundry VTT!
https://asacolips.gitbook.io/pbta-system
MIT License
3 stars 4 forks source link

Playbooks should unset attribute values when switching playbooks #217

Closed philote closed 2 months ago

philote commented 3 months ago

Currently Attribute grant values are set when a playbook is added to the actor sheet but not unset when it is removed. This leads to playbook specific data lingering on the playbook if you do not add a new playbook or the new playbook specifically does not grant a value for that attribute.

Example: Playbook 1 has attr1 with value "test" Playbook 2 has attr1 with value unset

If you add playbook1 to the actor sheet "test" into the variable 'attr1' then you switch to playbook2 -> on the actor sheet:

mclemente commented 2 months ago

Paraphrasing myself on Discord DMs:

The system assumes the playbook property of attributes is either exclusive to a single playbook or common to all playbooks, so having an empty feature shouldn't be happening, similar to a misconfiguration.

With that said, it is clear there is middle-ground where an attribute might be common to some playbooks and not all of them, so I'll introduce a change to allow the playbook property to also be an array, which should make it easier to filter out attributes that aren't common to all playbooks.


Implementation: TOML

[character.attributes.foo]
  playbook = ["bar", "test"]

Javascript

// game.pbta.sheetConfig
character = {
  attributes: {
    foo: {
      playbook: ["bar", "test"]
    }
  }
}