Users browsing this thread: 1 Guest(s)
Debilitator Reset

#1
Posts: 3,969
Threads: 279
Thanks Received: 236
Thanks Given: 57
Joined: Oct 2011
Reputation: 65
Status
Tissue-aware
Debilitator Reset
by madsiur
version 1.0a
released on 01/21/2022
apply to FF3us 1.0 (no header)
wiki entry
download
readme

Files

Code:
debilitator_C2_nh.ips: Patch using RAM that use free space in bank $C2
debilitator_C2.asm: bass assembly file of the above patch
debilitator_EX_nh.ips: Patch using RAM that use free space in bank $EE
debilitator_EX.asm: bass assembly file of the above patch
debilitator_NR_C2_nh.ips: Patch using no RAM that use free space in bank $C2
debilitator_NR_C2.asm: bass assembly file of the above patch
debilitator_NR_EX_nh.ips: Patch using no RAM that use free space in bank $EE
debilitator_NR_EX.asm: bass assembly file of the above patch

Description

This hack remove the last elemental weakness set by the debilitator on a monster before setting the current elemental weakness picked in the debilitator special effect code, meaning a monster can only have one current elemental weakness set by the debilitator.

To achive this, the RAM hack use 6 bytes of free RAM to store the last elemental weakness set by the debilitator; $3E2D, $3E2F, $3E31, $3E33, $3E35 and $3E37, also known as $3E25,Y (or $3E25,X) in the code for a character/monster. The "no RAM" hack use more ROM space and reload the elemental weaknesses from the monster data before applying the new weakness set by the debilitator.

The bank $C2 RAM hack use 23 bytes of free space at $C26469 and the EX hack use the same amount at $EEAF01. The "no RAM" hack use 59 bytes of free space at the same offsets. Those free space offsets can be changed in a ASM file by changing the offset of the "seek" macro call. All hacks insert a JSL or JSR in the debilitator special effect code at $C23AA8.

To assemble the hack use bass v14 by typing a command such as "bass -o rom.smc debilitator_C2.asm".
  Find
Quote  
[-] The following 3 users say Thank You to madsiur for this post:
  • Gi Nattak (01-17-2022), SSJ Rick (01-19-2022), Warrax (01-18-2022)

#2
Posts: 3,969
Threads: 279
Thanks Received: 236
Thanks Given: 57
Joined: Oct 2011
Reputation: 65
Status
Tissue-aware
Seibaby pointed out that I can achieve the same result by reloading the elemental weakness(es) from the monster data instead of using RAM, so I'll release when I get the time a patch version that does this. The version using RAM will be kept in case a hack has other means of setting an elemental weakness, outside the debilitator or with the monster data.
  Find
Quote  

#3
Posts: 3,969
Threads: 279
Thanks Received: 236
Thanks Given: 57
Joined: Oct 2011
Reputation: 65
Status
Tissue-aware
I've added a "no RAM" hack, it use more ROM space but no free RAM. See original post and readme for details. Here's the code, I don't know if it could be optimized. I tested on monsters that have an have not the ID MSB set and it work in both cases.

Code:
// debilitator special effect hook
seek($C23AA8)
jsl free_space      // jump to free space
nop
nop

// new code
seek($EEAF01)       // you can change this free space offset as long as it's not in bank $C2
free_space:
phx                 // save X
pha                 // save current debilitator element
tya                 // transfer monster index (#$08 to #$12) to A
lsr                 // divide by 2
sec
sbc #$04            // subtract 4 (characters are indexes #$00 to #$03)
tax                 // transfer monster index (#$00 to #$05) to X
phx                 // save it
lda $3F52           // load monster ID MSB byte, bits 0-5 being the MSB of each monster ID
loop:
cpx #$00
beq end_loop        // end loop when X == 0 (decreased monster index)
lsr                 // shift MSB byte right
dex                 // X = X - 1
bra loop            // branch to check if we've reach 0
end_loop:
and #$01            // isolate monster ID MSB
continue:
rep #$20            // 16-bit A
xba                 // put monster ID MSB in high byte
sep #$20            // 8-bit A
plx                 // restore monster index (#$00 to #$05)
lda $3F46,x         // load monster ID low byte (#$00 to #$FF)
rep #$30            // 16-bit A, 16-bit X
asl
asl
asl
asl
asl                 // multiply monster ID by 32
tax                 // transfer monster data index to X
sep #$20            // 8-bit A
lda $CF0019,x       // load weak to element(s) in monster data
sta $3BE0,y         // make monster weak to its original elements
pla                 // restore current debilitator element
ora $3BE0,y         // add debilitator element to those already set as weak to
sta $3BE0,y         // make monster weak to those elements
sep #$10            // 8-bit X
plx                 // restore X
rtl
  Find
Quote  
[-] The following 1 user says Thank You to madsiur for this post:
  • Gi Nattak (01-22-2022)

#4
Posts: 22
Threads: 0
Thanks Received: 0
Thanks Given: 0
Joined: Apr 2017
Reputation: 0
Status
None
post deleted
  Find
Quote  



Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite