The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 895 - File: showthread.php PHP 7.3.33 (Linux)
File Line Function
/showthread.php 895 errorHandler->error




Users browsing this thread: 1 Guest(s)
Possible solution to the sap death bug

#1
Posts: 16
Threads: 3
Thanks Received: 0
Thanks Given: 0
Joined: May 2019
Reputation: 2
Status
None
Hi all,

I've been trying to patch the bug that causes "Sap" and "Poison" ticks to bypass reactive scripts, and I think I've come up with the solution. However, since it involves changes to the action queues, I think it would require significant testing before it can be considered a perfect fix. I haven't done the testing yet, which is why I'm not uploading a patch here. But I thought the explanation below might be of interest to someone, nonetheless.

The problem, in essence, is that there is handling to allow a second reactive script to be queued if the target has died, but there is not handling to allow that reactive script to fire under the same conditions.

The solution is to allow the "entity has died" override to occur before the "has reactive script fired already" check.

Code:
org $C24BFD
  TRB $3A56        ; clear "entity died since last 1F" (in vanilla, $33FC is checked first)
  BNE .has_died    ; allow script if has died
  TRB $33FC        ; clear "no 1F this batch" (in vanilla, $3A56 is checked second)
  BEQ .skip_it     ; bypass script if already run
org $C24C28
.has_died
  TRB $33FC        ; clear "no 1F this batch" (replaces redundant "LDA $3018,X")
org $C24C52
.skip_it


An attempt at describing the sequence of events that triggers the bug:
* Boss has Sap/Poison
* You attack boss, not doing enough damage to kill it, but the next sap will
* Boss's reaction script is queued
* During the attack animation, time proceeds, and the next sap tick is queued
* Boss's queue now looks like: [Reaction, Sap]
* Animation finishes, and main battle loop starts over, hitting the counterattack check
* Boss's reaction script fires, and the $33FC flag is cleared to indicate the script fired.
* Boss's sap fires, killing the boss, which adds another reaction script to the queue
* This reaction attempts to run, but is blocked by the $33FC, which won't be reset until the counterattack queue is empty.

Hopefully, my patch doesn't open up a wormhole to another dimension. And apologies if this bugfix is already common knowledge!

I think this fix would also address some other issues with reactive scripts, such as Chadarnook bypassing the short dialogue after getting killed by a reflected Bolt counter.
  Find
Quote  



Messages In This Thread
Possible solution to the sap death bug - by Bropedio - 12-10-2020, 05:01 PM

Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite