Users browsing this thread: 1 Guest(s)
Cancel on Party -> Cancel on Opposition

#1
Posts: 377
Threads: 34
Thanks Received: 10
Thanks Given: 7
Joined: Dec 2018
Reputation: 18
Status
Moog
The following is code to change the behavior of the most significant bit flag in the Spell data's special targeting byte.

This flag, named "Cancel on Party, costs MP", prevents a spell from targeting Player characters.

That's problematic for several reasons.  First, there's the matter that spells are more finicky when targeting MONSTERS than they are when targeting players, either because of animation issues or because the systems aren't designed to handle monster targets.  Second, the description is deceptive; it makes it seem like the spell won't friendly fire, when in fact the flag simply prevents players from being targets.

This flag is most prominent on Esper spell data, but it could come up frequently if players are editing with FF3USME and misunderstand what the flag actually does.

So, to address this apparent disconnect, I've written these 18 bytes of assembly to change how the flag works.  Now, if cast by a monster the flag removes any monster targets, and if cast by a player it removes any player targets.

Code:
===========================
Abort on Party, costs MP
===========================
Adjusts the Abort on Party flag so that monsters won't cast on monsters and players won't cast on players when it is set.
Previously, it strictly protected players from the spell, regardless of who cast it

C2/5905:
    22 F6 B3 C4            JSL Freespace            [Tested at C0D620, BC Code goes to F02000]
    EA EA                            NOPx2

[Freespace, 18 bytes used]
C4/B3F6:
    A5 BA        LDA $BA
    10 0B        BPL $590B      (branch if not abort on characters)
    7B           TDC            (Accumulator = 0)
    E0 08        CPX #$08       (set Carry if caster is monster.  note that "caster" can
                                      also mean "reflector", in which case a good part of
                                      this function will be skipped.)
    B0 04        BCS    0x04            [If monster, skip]
            
    64 B8        STZ $B8        (clear character targets)
    80 02            BRA    0x02            [Skip to exit]
    64 B9        STZ $B9        (clear enemy targets)
    A5 BA        LDA $BA            [Load the flags again, because normal execution needs to use them]
    6B            RTL        [Return to normal execution]
No .ips patch this time, if you wish to use this code it's best to use a hex editor, especially because the free space I've selected may not be free in your project.
  Find
Quote  



Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite