Users browsing this thread: 1 Guest(s)
Changing physical damage calculations?

#11
Posts: 32
Threads: 4
Thanks Received: 0
Thanks Given: 0
Joined: Mar 2012
Reputation: 0
Status
None
It took a long time to figure it out, but I think I did, even if the results are a little sloppy. Starting at C2:6669, I copied (and adjusted for branching and spell ID) the code that Madsiur came up with, and then added to it the code used by the Magicite item (whose data immediately follows the Tempest's Wind Slash ability), right up to the RTS. I then used the Soul Sabre's pointer to point to the first line of data that the code used (6669, so 69 46). It seems to work like a charm. This is what it looks like, somewhat:

Code:
starting at C2/6669:
20 5A 4B     JSR    (Random Number Function: 0 to 255)  
C9 80        CMP     (compare to 128)
B0 1B        BCS    (50% chance exit function)
20 5A 4B     JSR    (Random Number Function: 0 to 255)  
C9 80        CMP    (compare to 64)
B0 04        BCS    (25% chance branch)
A9 BC        LDA    (Magnitude8 spell number 75% chances)
80 02        BRA   (branch to clear battle power)
A9 D9        LDA    (Megathrust spell number 25% chances)
9C A6 11     STZ    (clear battle power)
80 03        BRA   (branch to store the spell number)
20 DC 37     JSR   (Picks random Esper, not Odin or Raiden)
8D 00 34     STA   (Save the spell number)
EE 70 3A     INC   (Increment the number of attacks remaining)
60           RTS

Would I be correct in assuming that everything between the final BRA and the RTS could safely be shorn from the code? They refer specifically to the Magicite item's functions, which obviously aren't used here. The ability works perfectly as it is, and I know I'm probably preaching to the choir, but getting those results felt *fantastic*.
  Find
Quote  

#12
Posts: 290
Threads: 3
Thanks Received: 40
Thanks Given: 1
Joined: Apr 2012
Reputation: 9
Status
None
For efficiency's sake, the latter seven bytes of the Magicite code block are re-used by the Tempest function. You can get rid of the JSR (and the branch right before it), but if you don't save the spell number (STA $3400) then nothing will be cast when the actual effect goes off. I'm not entirely clear of the purpose of INC $3A70 (probably has something to do with ending the actual attack sequence), but I'd leave that alone as well.


GET A SILK BAG FROM THE GRAVEYARD DUCK TO LIVE LONGER.

Brave New World
  Find
Quote  

#13
Posts: 32
Threads: 4
Thanks Received: 0
Thanks Given: 0
Joined: Mar 2012
Reputation: 0
Status
None
Another question!

Supposing I wanted an effect similar to the Man Eater's doing double damage to human targets, only instead of human, I wanted it to target another special status, such as 0 MP = Death or Undead. Would such a thing be possible to engineer? I'm not quite sure what it is, in the "2x damage against humans" code that actually points to the "human" status, if any.
  Find
Quote  

#14
Posts: 3,970
Threads: 279
Thanks Received: 236
Thanks Given: 58
Joined: Oct 2011
Reputation: 65
Status
Tissue-aware
(05-11-2012, 09:32 PM)Marketa Lazarova Wrote: I'm not quite sure what it is, in the "2x damage against humans" code that actually points to the "human" status, if any.

Code:
C2/38F2: B9 95 3C     LDA $3C95,Y   (load special byte 3)
C2/38F5: 89 10        BIT #$10    (check if target is human)
C2/38F7: F0 04        BEQ $38FD   (Exit if target not human)
C2/38F9: E6 BC        INC $BC
C2/38FB: E6 BC        INC $BC     (Double damage dealt)
C2/38FD: 60           RTS

It'S the BIT #$10 that checks for that. First the special byte 3 is loaded from the RAM. Here what is on special byte 3:

Code:
$3C95 : Special Byte 3 (Bit 0 = Dies at 0 MP, 1 = ???, 2 = No name, 3 = ???
                            4 = Human, 5 =  ???, 6 = Auto critical if Imp, 7 = Undead)

So it's bit 4 (00001000) which equal 16 (#$10). You could check anything else on that byte. To check bit 0 you would do a BIT #$01, bit 1 you do a BIT #$02, bit 2 you do a BIT #$04 and so on...

Now you would need to find the RAM byte which contain you status (which I haven't found) and replace the byte number (LDA $3C95,Y).

I have a thread with the RAM info I collected: https://www.ff6hacking.com/forums/showth...p?tid=1408

You could have a look at it.

Edit: I was looking way too far. the status you are looking for is bit 0 on special byte 3.
You can also check for any of 2 status which would leave the 2x human damage. (bit 0 + bit 4 = 16+1 = #$11)

  Find
Quote  

#15
Posts: 32
Threads: 4
Thanks Received: 0
Thanks Given: 0
Joined: Mar 2012
Reputation: 0
Status
None
I think I understand. For each bit I want to check, I double the value of the number by the 89, starting with 01 (0 MP=Death), then on to 02, 03, 08, 10, 20, 40 and 80. So if I wanted to make the Man Eater weapon do double damage to undead enemies, I would change the BIT #$10 (checks for Human) into BIT#$80. I think I have the desired effect, here, because double damage to undead enemies is exactly what is happening. Thank you!
  Find
Quote  

#16
Posts: 3,970
Threads: 279
Thanks Received: 236
Thanks Given: 58
Joined: Oct 2011
Reputation: 65
Status
Tissue-aware
(05-12-2012, 12:20 PM)Marketa Lazarova Wrote: I think I understand. For each bit I want to check, I double the value of the number by the 89, starting with 01 (0 MP=Death), then on to 02, 03, 08, 10, 20, 40 and 80. So if I wanted to make the Man Eater weapon do double damage to undead enemies, I would change the BIT #$10 (checks for Human) into BIT#$80. I think I have the desired effect, here, because double damage to undead enemies is exactly what is happening. Thank you!

Without a long explanation, a bit set is like a binary number which is a number in base 2, so yeah you double every time. if we take 00000100, it equals 32 in base 10 (the base we use). then you have to convert in hex (base 16) that number, which is 0x20 or $20 or #$20. Usually we go from binary to hex, but converting in base 10 help people to get the idea, which is the case with you.
  Find
Quote  



Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite