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

Move some renderChatMessage handlers to other hooks #176

Merged
merged 1 commit into from
Dec 21, 2024

Conversation

xyzzy42
Copy link
Contributor

@xyzzy42 xyzzy42 commented Sep 23, 2024

These handlers were acting on old chat messages when scrolling back in the chat history as if they were current.

Also fixes a few bugs.

Use isThaumaturge() instead of checking translated class name. Fixes an issue where dual-class thaum didn't update weakness.

The check for the EW save being used didn't take into account that the EW modifier will show up in the save context for saves where it wasn't used, but with enabled set to false. This caused the EW save to get removed on the first save rolled, even if it wasn't against the EV target.

Move the update vulnerability and esoteric warden attack handlers to createChatMessage. They only run on new messages this way. They both have a different user take an action than the one who created the message, so need to run for all users on each chat message.

For the esoteric warden save handler, it's the same user who rolls the save as will update the EW effect, so it's done in preCreateChatMessage and only the rolling user will run the hook.

Get target of strike from message.target, instead of doing lookup from thaum module specific flag.

The esoteric warden check would iterate over every item of every target of every attack and save message. Speed this up by doing the fast checks first. I.e., don't look at the targets if the message isn't an attack. Then just look at the effects on the attacker to see if they are an EV target of anyone. And then see if thaum(s) that has them as EV target is in the message target list.

These handlers were acting on old chat messages when scrolling back in
the chat history as if they were current.

Also fixes a few bugs.

Use isThaumaturge() instead of checking translated class name.  Fixes an
issue where dual-class thaum didn't update weakness.

The check for the EW save being used didn't take into account that the
EW modifier will show up in the save context for saves where it wasn't
used, but with enabled set to false.  This caused the EW save to get
removed on the first save rolled, even if it wasn't against the EV
target.

Move the update vulnerability and esoteric warden attack handlers to
createChatMessage.  They only run on new messages this way.  They both
have a different user take an action than the one who created the
message, so need to run for all users on each chat message.

For the esoteric warden save handler, it's the same user who rolls the
save as will update the EW effect, so it's done in preCreateChatMessage
and only the rolling user will run the hook.

Get target of strike from message.target, instead of doing lookup from
thaum module specific flag.

The esoteric warden check would iterate over every item of every target
of every attack and save message.  Speed this up by doing the fast
checks first.  I.e., don't look at the targets if the message isn't an
attack.  Then just look at the effects on the attacker to see if they
are an EV target of anyone.  And then see if thaum(s) that has them as
EV target is in the message target list.
@mysurvive mysurvive merged commit 31effc9 into mysurvive:main Dec 21, 2024
2 checks passed
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

Successfully merging this pull request may close these issues.

2 participants