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)
Psycho Cyan Bug Fix

#1
Posts: 18
Threads: 3
Thanks Received: 0
Thanks Given: 0
Joined: Nov 2019
Reputation: 0
Status
None
Psycho Cyan bugs have been impacting WC players recently which caused me to look into fixes. Most places online point to:
http://www.rpglegion.com/ff6/hack/psycho.htm

The bug fixed by this patch seems caused by death/petrify/zombie calling c246a9 which sets the entity's bit at 0x3a56. If those status effects are later removed the entity's bit is still set. This causes Retort to skip checking if the attack is a normal attack at c24c95 and skip checking if the user is the target of the attack and not attacking themselves at c24c9b.

From the C2 disassembly:
Code:
C2/4C8B: 2C 56 3A     BIT $3A56      (has entity died since last executing Command 1Fh,
                                     "Run Monster Script", counterattack variant?)
C2/4C8E: E2 20        SEP #$20       (Set 8-bit accumulator)
C2/4C90: D0 0B        BNE $4C9D      (Branch if so.  this is a "catch-all" to allow
                                     counters when not normally permitted.)
C2/4C92: A5 B1        LDA $B1
C2/4C94: 4A           LSR
C2/4C95: B0 27        BCS $4CBE      (Branch if it's a counterattack, periodic
                                     damage/healing, or a special command like a
                                     status expiring or an equipment auto-spell.
                                     iow, No counter if not a normal attack.)
C2/4C97: A5 B8        LDA $B8
C2/4C99: 05 B9        ORA $B9
C2/4C9B: F0 21        BEQ $4CBE      (No counter if not target of attack, or if
                                     targeting yourself)

The existing fix clears the entity's bit at 0x3a56 when death/petrify are removed but it does not fix the bug for zombie. This can be verified on a rom with the patch applied by inflicting zombie on Cyan, using a Revivify on him, then using retort. He will counter even if not targeted by the next attack. As a result, the full psycho cyan bug can still be achieved by inflicting Cyan with zombie, removing it, using Retort, and then turning Cyan into an Imp.

All three statuses can be fixed with the following:
Code:
 0265ba: 0x20 0x9c 0x46                | JSR $469c
 0265bd: 0xb9 0x18 0x30                | LDA $3018
 0265c0: 0x1c 0x56 0x3a                | TRB $3a56
 0265c3: 0x60                          | RTS

# petrify/death:
 0245f2: 0x20 0xba 0x65                | JSR $65ba

# zombie:
 0245ae: 0x20 0xba 0x65                | JSR $65ba

The addresses are for an unheadered rom and 0x65ba is any free space in C2. These changes require 10 bytes of free space (2 bytes less than the existing fix).

The second part of the bug is using retort and then inflicting Cyan with imp. This will cause the next attack targeting Cyan to counter with a normal attack which will not clear the retort bit. As a result, Cyan will counter every attack with a normal attack.

As a fix, I clear the retort bit when a character has imp set (or cleared) which will also prevent the first normal counter attack after turning into an imp:
Code:
 0265c4: 0xfe 0x30 0x2f                | INC $2f30, X
 0265c7: 0xbb                          | TYX
 0265c8: 0x5e 0x4c 0x3e                | LSR $3e4c, X
 0265cb: 0x1e 0x4c 0x3e                | ASL $3e4c, X
 0265ce: 0x60                          | RTS

# imp set/clear:
 0245ed: 0x20 0xc4 0x65                | JSR $65c4

The addresses are for an unheadered rom and 0x65c4 is any free space in C2. These changes require 11 bytes of free space.
  Find
Quote  
[-] The following 4 users say Thank You to AtmaTek for this post:
  • Gi Nattak (05-22-2021), kjinn22 (05-30-2021), madsiur (05-24-2021), Warrax (05-23-2021)



Messages In This Thread
Psycho Cyan Bug Fix - by AtmaTek - 05-22-2021, 03:37 AM
RE: Psycho Cyan Bug Fix - by assassin - 05-22-2021, 08:08 PM
RE: Psycho Cyan Bug Fix - by Warrax - 05-24-2021, 03:50 PM
RE: Psycho Cyan Bug Fix - by seibaby - 05-24-2021, 07:21 PM
RE: Psycho Cyan Bug Fix - by Warrax - 05-26-2021, 07:23 PM

Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite