Skip to content
This repository has been archived by the owner on Jan 21, 2023. It is now read-only.

[Bug] - Lair actions appear whenever previous combatant's initiative matches the current combatant #287

Open
shinkei13 opened this issue Apr 16, 2022 · 0 comments
Labels
bug Something isn't working good first issue Good for newcomers
Milestone

Comments

@shinkei13
Copy link

Regardless of a combatant's lair action initiative setting, the prompt for a lair action will always show whenever two actors share initiative. While this can be mitigated by using Dexterity tiebreakers, if two actors share dexterity scores and initiative counts, the error will still occur.

I believe the offending lines of code are in line 98-116 of LairActionManagement.js:

    /* lair init should be inside this range or outside? */
    const inside = previousInit - currentInit > 0; 

    const containsLair = (combatant) => {
      const init = combatant.actor.data.data.resources.lair.initiative

      return previousInit >= init && init > currentInit;
    }

    const excludesLair = (combatant) => {
      const init = combatant.actor.data.data.resources.lair.initiative

      return init > currentInit || init <= previousInit;
    }
...
    const filterCondition = inside ? containsLair : excludesLair;

filterCondition in this case will always return true whenever inside returns false. If currentInit = previousInit then excludesLair will always be true.

@trioderegion trioderegion added bug Something isn't working good first issue Good for newcomers labels May 7, 2022
@trioderegion trioderegion added this to the 4.3.0 milestone Aug 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants