Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent Tags #157

Open
nanubula opened this issue Oct 21, 2024 · 0 comments
Open

Prevent Tags #157

nanubula opened this issue Oct 21, 2024 · 0 comments

Comments

@nanubula
Copy link
Contributor

nanubula commented Oct 21, 2024

Prevent tags are not working as intended. Hoping this writeup could be helpful in maybe @MathiasGruber coming up with a solution. I could try to help but I'm still fuzzy on the combat code, and you could probably come up with something better, faster. Will tinker around anyway.

Debuff and Buff Prevent

Both of these have a line that permanently sets the chance to trigger at 100% after successfully passing the check once.

const { power } = getPower(effect);
const mainCheck = Math.random() < power / 100;
if (mainCheck) {
  const info = getInfo(target, effect, "cannot be debuffed");
  HERE --> effect.power = 100; <--
  return info;

This check seems to happen at least once on each enemy action, like moving even though it wouldn't affect your debuffs.
In the example of the 40% chance to prevent debuff armor, it would work like this:

  • ROUND 1
  • Enemy Move, Check debuffPrevent() 40% chance, roll 70, fail
  • Enemy Move, Check debuffPrevent() 40% chance, roll 30, pass, set chance to 100%
  • Enemy Move, Check debuffPrevent() 100% chance, pass, set chance to 100%
  • ROUND 2
  • Enemy Debuff, Check preventCheck() 100% chance, fail to debuff
  • etc, always at 100% every round until the duration ends

Removing the effect.power = 100 would prevent this from having a near 100% chance, but still not have the desired effect @theeneon and @d3t0ur outlined in #154 because it would be the same as the other prevents (heal, flee, move, stun).
It seems the intent here was to provide temporary immunity for a round like they suggested, but instead it's permanent.

Other Prevents

The other xPrevent methods like stunPrevent don't effectively do anything other than print misleading messages because the other action methods like stun() refer to a preventCheck method that does the same % chance calculation again, which could potentially be different from the result of the check in stunPrevent. The results that come from preventCheck are the real results that determine whether the stun can go through (which it then has to pass its own stun % check, but unrelated).
These checks also seem to happen multiple times per action in different checks of the action and could give different results each time for the same prevent tag.
So currently to successfully prevent with these tags you must pass it per tag(?), per action, instead of the desired per round.

Potential Solution

I think setting the effect's power/chance like you did in buff/debuff prevent to 100% to start is good so they can have immunity, but

  • After the round is over, the power should reset to the original
  • This check should only happen once per round, not once per action. If there's 6 actions (3 per participant) in a round and you have a 40% chance to gain debuff immunity on all of them, by the last action you had an effective 95.3% chance 1-(1-p)^n
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant