Author Topic: Changing details of Dark Wave  (Read 6818 times)

Pinkpuff

  • Flan Princess
  • *
  • Posts: 924
  • Find a Megalixir in Unprecedented Crisis!
    • View Profile
Changing details of Dark Wave
« on: August 16, 2013, 11:15:19 AM »
This command seems like it should have some straightforward parameters that would be great to be able to edit.

I believe it is known where to go to change the amount of HP the caster loses but I can't find off hand. Also I seem to recall it only allowing for 1/8, 1/4 or 1/2 of Max HP. Does anyone know what I'm talking about and where that address is? Is there a way we could jury rig it to be able to subtract different fractions, or maybe even have it "damage" a different stat or something?

Also I don't think anything was ever discovered with regards to how to change the damage dealt. On that note, is it possible to, say, make it dark elemental? Remove the check for undead, or make it check for different monster types? (Maybe you could make it into "Light Wave" or "Harm" that only affects undeads! Or maybe some kind of "Dragon Wave" or something for Kain for example.)
Let's dance!

Dragonsbrethren

  • Forum Overlord
  • *
  • Posts: 1,820
    • View Profile
    • Dragonsbrethren Industries
Re: Changing details of Dark Wave
« Reply #1 on: August 16, 2013, 11:35:15 AM »
Here's the HP damaging code, commented from a trace Grimoire LD did:

Code: [Select]
$03/E9EF   A6 A6    LDX $A6
$03/E9F1   BD 09 20 LDA $2009,x ; load Cecil's max HP, A = 272
$03/E9F4   20 85 84 JSR $8485
$03/8485   4A LSR A ; A = 136
$03/8486   4A LSR A ; A = 68
$03/8487   4A LSR A ; A = 34
$03/8488   60 RTS
$03/E9F7   85 A9 STA $A9 ; $00A9 = 34
$03/E9F9   38 SEC
$03/E9FA   BD 07 20 LDA $2007,x ; load Cecil's current HP, A = 168
$03/E9FD   E5 A9 SBC $A9 ; subtract value at $00A9 (34) from A (168)
$03/E9FF   9D 07 20 STA $2007,x ; store result as Cecil's current HP, A = 134

To quote myself from the original posts, "I'd be cautious changing that bitshift subroutine, since it's probably used for other things." But you can certainly change it to bitshift more, replace it with a fixed value, modify other stats, etc. I don't think anyone ever dug into the special condition for undead or anything else related to it.

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Changing details of Dark Wave
« Reply #2 on: August 16, 2013, 12:14:16 PM »
That's actually very interesting Pinkpuff, yes. By just that old piece of code, there is a way to make it change another stat all together. At the time I wasn't very well acquainted with the character stats, but now I am quite a bit more proficient in the character's data so what you're asking is very simple.

Code: [Select]
00 -Character Identifier - 81
01 - Class - 09
02 - Level - 01
03 - ??? - 00
04 - ??? - 00
05 - ??? - 00
06 - ??? - 00
07 - HP (1) - 55
08 - HP (2) - 00
09 - Max HP (1) - 55
0A - Max HP (2) - 00
0B - MP (1) - 19
0C - MP (2) - 00
0D - Max MP (1) - 19
0E - Max MP (2) - 00
0F - Strength - 03
10 - Agility - 07
11 - Vitality - 02
12 - Wisdom - 08
13 - Will - 03
14 - Modified Strength - 03
15 - Modified Agility - 07
16 - Modified Vitality - 02
17 - Modified Wisdom - 08
18 - Modified Will - 03
19 - ???- 00
1A - ??? - 00
1B - X's to hit - 01
1C - Accuracy - 28
1D - Attack Power - 03
1E - ???- 00
1F - ??? - 00
20 - ??? - 00
21 - ??? - 00
22 - ??? - 00
23 - Magic Evasion - 06
24 - ??? - 00
25 - ??? - 00
26 - ??? - 00
27 - ??? - 00
28 - ??? - 00
29 - Physical Evasion - 1E
2A - Physical Defense - 03
2B - ??? - 00
2C - ??? - 00
2D - ??? - 04
2E - ??? - 15
2F - ??? - 0A

Say you wanted Dark Wave to reduce MP instead of HP, you would change

$03/E9F1   BD 09 20   LDA $2009,x   ; load Cecil's max HP, A = 272

to...

$03/E9F1   BD 0D 20   LDA $200D,x   ; load Cecil's max MP, A
-----------------------
and...

$03/E9FA   BD 07 20   LDA $2007,x   ; load Cecil's current HP, A = 168

to...

$03/E9FA   BD 0B 20   LDA $200B,x   ; load Cecil's current MP, A

-----------------
Finally...

$03/E9FF   9D 07 20   STA $2007,x   ; store result as Cecil's current HP, A = 134

to...

$03/E9FF   9D 0B 20   STA $200B,x   ; store result as Cecil's current MP, A =

Now the obvious problem with this is that nothing prevents the player from not using it when they have 0 MP left.

I did not know about the Undead = 1 Damage effect for Dark Wave, I was under the impression until recently that it was just resistance to the Dark Element. I'll try to take a look for it and see what I can come up with.

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Changing details of Dark Wave
« Reply #3 on: August 16, 2013, 10:45:07 PM »
Oh ho? Looks like I was wrong! I was going through our available information and recalled that Phoenix said there was a Death check to activate when Cecil has less than 1/8 HP. That not only applies to HP. If you tie the command to Cecil's MP he will Die if he uses it with less than 1/8 of his MP, meaning that the original intent of "reliance = death" is kept fully intact and the consequence of using Dark Wave too much can be severe.

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Changing details of Dark Wave
« Reply #4 on: August 16, 2013, 11:34:54 PM »
Hmm... would it be possible to have Dark Wave deplete the party's GP instead of the caster's HP, thus making it a Coin Toss?

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Changing details of Dark Wave
« Reply #5 on: August 16, 2013, 11:47:13 PM »
Changing it to 7E16A0 Might be able to make that happen, granted if it is loaded in battle, but that's a lot of money lost! We still have no idea the formula for this thing, and I have scoured as far as I can in that regard.

I'm at a loss to look on how to make Dark Wave better, damage wise. Obviously it's based on Weapon/Str but to what accord is still unknown.

Dragonsbrethren

  • Forum Overlord
  • *
  • Posts: 1,820
    • View Profile
    • Dragonsbrethren Industries
Re: Changing details of Dark Wave
« Reply #6 on: August 17, 2013, 12:15:36 AM »
The formula for the amount subtracted? That's in that disassembly I commented above. Nothing says you have to use 1/8th, could easily use a smaller amount or a fixed value.

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Changing details of Dark Wave
« Reply #7 on: August 17, 2013, 12:22:27 AM »
Didn't you say not to touch that 1/8 Subroutine though lest it be used by another part of the game? But yes, on second look you could easily make it a static value.

Dragonsbrethren

  • Forum Overlord
  • *
  • Posts: 1,820
    • View Profile
    • Dragonsbrethren Industries
Re: Changing details of Dark Wave
« Reply #8 on: August 17, 2013, 12:48:05 AM »
Yeah, but you could easily write your own subroutine to do different values (regardless of whether or not that one's used, you'd need to do any expansion elsewhere anyway).

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Changing details of Dark Wave
« Reply #9 on: August 17, 2013, 01:03:53 AM »
Coin Toss in FFV was really the only worthwhile version, imo. it was a huge amount of nonelemental damage for a huge amount of GP. Made for a great desperation move to beat particularly tough bosses. If Dark Wave has a unique damage subroutine (which is plausible, since it apparently has a unique undead check) we could reproduce this technique. Think I'll look into that tomorrow.

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Changing details of Dark Wave
« Reply #10 on: August 17, 2013, 01:45:26 PM »
Meh - forgot how bad I am at tracing stuff with snes9x debugger. I can't find Dark Wave's damage subroutine. I'm abandoning this ship for now.

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Changing details of Dark Wave
« Reply #11 on: September 02, 2013, 12:16:25 PM »
Finally after All of This time I have Located the building blocks of Dark Wave's formula!

I found this in a stupidly simple manner, I breakpointed on the Command Used in the character information in battle and followed it until I came across the answer. It turned out to be not very complicated at all. Let's hope Jump and Focus are as simple...


The two stats that are taken into account are the Physical Attack Multiplier - 001B and Physical Attack Base -

The formula appears to be Physical Attack Multiplier x Physical Attack Base - 25%/50%/75% = Dark Wave's Damage

From the Bab-il Docs here's how to change the formula of Dark Wave to use what you please...



I feared at first that I was just changing the ordinary damage calculation formula, but as this picture would attest the damage formula stayed put.




Code: [Select]

An asterisk (*) before a description for the data indicates that only records
for characters have or use that type of data (equipment is a good example of
this). Two asterisks (**) before a description for the data indicate that only
monsters have or use that type of data (creature type data, for example).
Three asterisks (***) after a description of the data indicates that the
reader is requested to refer to the monster data document for a more complete
description (again, the creature type data is a good example).

Offset Meaning
------ -------
00     *character id/handedness
           bits 0-4: character id
           bit 5: unknown
           bit 6: left hand equippable
           bit 7: right hand equippable
01     *sprite/class
           bits 0-3: sprite/class id
           bits 4-6: unknown
           bit 7: in back row
02     level
03-06  current status anomalies
07-08  current hp
09-0A  maximum hp
0B-0C  current mp
0D-0E  maximum mp
0F     *base strength
10     *base agility
11     *base vitality
12     *base wisdom
13     *base willpower
14     *modified strength
15     modified agility
16     *modified vitality
17     black magic power/modified wisdom
18     white magic power/modified willpower
19     attack elemental
1A     *attack strong vs. creature types***
1B     physical attack multiplier
1C     physical attack percent
1D     physical attack base
1E     attack status 1***
1F     attack status 2***
20     elements weak vs***
21     elements very weak vs***
22     magical defense multiplier
23     magical defense percent
24     magical defense base
25     elemental defense (if immunity bit wasn't set)***
26     elemental defense (if immunity bit was set)***
27     *defense strong vs. creature types***
28     physical defense multiplier
29     physical defense percent
2A     physical defense base
2B     status immunity 1***
2C     status immunity 2***
2D-2F  unknown
30     *helmet
31     *armor
32     *gauntlet
33     *right hand-item
34     *right hand-quantity
35     *left hand-item
36     *left hand-quantity
37-39  *experience
3A     unknown
3B     speed modifier. lower = faster. for autobattles, starts at 01;
       otherwise starts at 10. slow adds +08, (upper bound 20) haste adds -3
       (lower bound 0C)
3C     unknown
3D-3F  *experience to level up
40     **creature types***
41-50  unknown
51     next command # (from 00 to 1D)
52     next sub-action (item or spell number)
53     next action monster target(s)
54     next action party target(s)
55-5F  unknown
60-61  relative speed. equal to (Cecil's agi * 32) / (our agi * 0A). if Cecil
       isn't in the batle, an arbitrary character is picked instead. lower
       number = faster speed.
62-6F  unknown
70     **level and boss bit***
71-72  unknown
73     **item byte***
74-7F  unknown

In RAM (LoRom/HiRom) at...

0x03E71B - BD 1B 20 - (LDA 7E201B) - Looks at the value in 201B - Physical Attack Multiplier
0x03E730 - BD 1D 20 - (LDA 7E201D) - Looks at the value in 201D - Physical Attack Base

In ROM at...

0x1E91B - BD 1B 20 - (LDA 7E201B) - Looks at the value in 201B - Physical Attack Multiplier
0x1E930 - BD 1D 20 - (LDA 7E201D) - Looks at the value in 201D - Physical Attack Base


For instance say I wanted to change the Dark Wave into an attack that looked not purely at Physical attributes but instead looked at Wisdom and the Physical Attack Base to deal damage, that way it would remain useful as the Dark Knight continues to increase in level and should they wish for the Paladin to keep it they could allow him to use some Wisdom boosting equipment to keep the attack relevant.

So Chillyfeez looks like you can get your Gil Toss after all! To change and alter the power of Dark Wave is just a matter of knowing the stats and equipment pools of your Dark Wave recipient!

 :edit:Fixed a Glaring issue with my addressing (I left the 7 from the initial LoRom/HiRom location)
« Last Edit: September 09, 2013, 12:39:11 AM by Grimoire LD »

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Changing details of Dark Wave
« Reply #12 on: September 02, 2013, 04:44:09 PM »
Sweet - nice going, Grimoire. And good idea breakpointing the command slot.

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Changing details of Dark Wave
« Reply #13 on: September 02, 2013, 05:13:20 PM »
Well I have a bit of bad news... Kick uses the same exact formula as Dark Wave (except without the Zombie = 1 damage deal). Therefore they're shared. So if you change Dark Wave's formula you are also changing Kick. Bah.

Pinkpuff

  • Flan Princess
  • *
  • Posts: 924
  • Find a Megalixir in Unprecedented Crisis!
    • View Profile
Re: Changing details of Dark Wave
« Reply #14 on: September 02, 2013, 05:57:03 PM »
(except without the Zombie = 1 damage deal)

Speaking of that, do we know how to change that "Zombie" part to some other race or combination thereof?
Let's dance!