mysurvive / pf2e-thaum-vuln

Improvement for Thaumaturge Exploit Vulnerability
MIT License
10 stars 11 forks source link

Fix Amulet's Abeyance #123

Closed xyzzy42 closed 4 months ago

xyzzy42 commented 4 months ago

The hook methods are not necessarily run by the thaum, so they can't be part of the Amulet object since the actor might not have one.

The solution is to make them static methods. Since they never use "this" anywhere it isn't a problem to do this and the methods don't even change at all. Which isn't surprising, since before the Amulet class was made they worked without getting called on the thaum.

For the checkChatForAbeyanceEffect() method, this is called on the actor taking damage. It could be the thaum, but it could be an ally too. But this method only removes an effect, it doesn't need to know anything about the thaum, so no problem.

listenForAbeyanceChat() does need to find a thaum, but the message it's trigged on is a damage roll by an enemy and targetting the thaum or an ally. In the ally case, neither the message actor nor the target is the thaum. The thaum is just (maybe) within 15' of the target. So the method can't have an Amulet object instance until it finds a thaum.