foundryvtt / pf2e

A community contributed game system for Pathfinder Second Edition.
https://foundryvtt.com/packages/pf2e
Apache License 2.0
415 stars 348 forks source link

Choices from an ActiveEffectLike array don't respect predicates #14574

Closed pedrogrullada closed 6 months ago

pedrogrullada commented 6 months ago

If you prepare an array with an ActiveEffectLike, and then use that array for the choices in a ChoiceSet, the user will be shown all choices regardless of the predicate set in each choice. This can notably be observed in a conscious mind granted by Psychic Dedication, which later takes Psi Development: the already chosen cantrip is not deducted from the choices.

As a way to reproduce, make a feat with the following rule elements, and note the arbitrary predicates. Regardless, when added to a character, both choices will be offered.

{
  "key": "ActiveEffectLike",
  "mode": "override",
  "path": "flags.pf2e.testArray",
  "priority": 10,
  "value": [
    {
      "label": "Choice A",
      "predicate": [
        "can-choose-A"
      ],
      "value": "choice-a"
    },
    {
      "label": "Choice B",
      "predicate": [
        "can-choose-B"
      ],
      "value": "choice-b"
    }
  ]
}
{
  "choices": "flags.pf2e.testArray",
  "flag": "testChoice",
  "key": "ChoiceSet",
  "rollOption": "test-choice"
}
CarlosFdez commented 6 months ago

This looks more like a feature request, not a bug report. Why is the expectation that the choiceset would respect the predicates, rather than the ae-like would only add options that get predicate (such as separate ae-likes per entry that keep adding to the list, each one individually predicated).

I think the choiceset respecting the predicates might be cleaner, I'd like a bit more context about this feature.

pedrogrullada commented 6 months ago

To give a bit more context: each conscious mind is defining a list of their respective standard and surface cantrips, predicated on the presence of the Psychic Dedication feat. Then it's used by a Choice Set in two instances: when the feature is added via the Psychic Dedication feat, and also when taking Psi Development later. This is done via AE-likes to avoid having to make multiple Choice Sets for each conscious mind in Psi Development.

As for why not use multiple predicated AElikes, this is the approach I take in #14483, but it was implemented originally by Tikael (#14069) in the way I exemplify in the issue description with the expectation that the predicates in each choice would be respected. I can't speak for him obviously, but it seems like a reasonable expectation to predicate the array in the AELike, whatever that may be, and then have it behave like any old array of choices you would input manually, respecting its predicates. I hope that helps explain it a bit!

CarlosFdez commented 6 months ago

I can see the value in adding it, I'm more asking if you knew the original context by which choice sets pulling from flags existed in the first place. If you don't though that's fine as well.

pedrogrullada commented 6 months ago

Got it, my bad. The only other instance I'm aware of is automaton enhancements, but that's separate AE-Likes adding choices, as opposed to a single one adding predicated choices.