Author Topic: Percentage value for sadness, anger damage change and the limit bar change?  (Read 5970 times)

Tenko Kuugen

  • Public Enemy
  • *
  • Posts: 1416
    • View Profile
    • Twitter
I know this has to be handled in the .exe somewhere but don't quite know where to start looking
Sadness reduces damage by 30%, Anger reduces accuracy as far as I remember
I'm not sure on the exact percentage changes to how fast the limit bar changes under those statuses.

What I am looking for is to completely null the limit bar increase under sadness, increase damage taken by 50% under Anger and increase Limit bar gain to 1.5 and halve accuracy under Anger
If all of the values are clean percentage cuts, that should all be possible. If the functions are more complex, I'll need one of the .exe wizards like NFITC to look into the value ranges of those things

Does anyone know where exactly sadness and anger are handled in the .exe?

Bosola

  • Fire hazard!
  • *
  • Posts: 1748
    • View Profile
    • My YouTube Channel
I've seen the accuracy function for the PSX, though as I'm typing on a phone it's a bit tricky for me to point you to to it. The accuracy probably won't be applied as a percentage though. Those maths operations will have gone through an optimising compiler and usually come out at the end very fast but not very flexible (they will use bitshifts as much as possible). At least that's how it is on PSX, and I've no reason to think the PC build will be any different.

You'll likely need to patch the assembly rather than change a single value, but it's really not as hard as people make out.
« Last Edit: 2014-02-16 12:27:18 by Bosola »

nfitc1

  • *
  • Posts: 2984
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
If the functions are more complex, I'll need one of the .exe wizards like NFITC to look into the value ranges of those things

Does anyone know where exactly sadness and anger are handled in the .exe?
Indeed! This is one of those problems only I have the brains to solve.  ;D Your wish has been heard!!
Actually, probably a lot of other people could too, but since you called me out I guess I'll have to step up. I'll even break my MO and solve your problem for you!

It completely depends on the value you want to change it to.

Sadness:
Code: [Select]
If Target's Status includes Sadness
Damage = Damage - (Damage * 3 / 10)
End If
Return Damage

That comes off the wiki which I wrote so you know it's accurate.  ;D

Damage is multiplied by 3 then divided by 10 and the result is subtracted from the calculated damage and stored AS damage. It is a percentage change that happens in that order. The 3 and the 10 can be easily changed to anything, even to increase damage, but in the end it's still a percentage.

This starts at 0x5DE958 and the relevant values are at 0x5DE972 (0x1DDD72) and 0x5DE974 (0x1DDD75). That's the multiplier and divisor respectively.

Fury is essentially identical, but with the penalty to accuracy:
Code: [Select]
If NOT Acc = 255
   If Actor's Status includes Fury
Acc = Acc - (Acc * 3 / 10)
   End If
End If
Return Acc

This starts at 0x5DE582 and the relevant values are at 0x5DE5A5 (0x1DD9A5) and 0x5DE5A8 (0x1DD9A8). That's the multiplier and divisor respectively.

Now for the Limit bar (Dang this was hard to track down):
The checks start at 0x5DF28C. This checks Fury and will bit shift the damage factor consideration ( 256 * (300 * MHP) / HPLimitDivisor ) to the left by 1 (doubles the factor)
Sadness check starts at 0x5DF2A9 (which doesn't happen if the Fury check succeeds). This checks Sadness and will bit shift the damage factor consideration ( 256 * (300 * MHP) / HPLimitDivisor ) to the right by 1 (halves the factor)
It is not a hard thing to nullify these factors or multiply them by different amounts, but I'll get to that at a later time. I just have to prove how awesome I am. :)
« Last Edit: 2014-02-18 01:39:25 by NFITC1 »

Tenko Kuugen

  • Public Enemy
  • *
  • Posts: 1416
    • View Profile
    • Twitter
That's great work as always NFITC1
Finally Fury and Sadness get the nerf / improve hammer they have needed for a long time.
Hoping you'll tell me how the shifting is manipulated and what the results are. I assume shifting it two paces will either quadruple or null the limit gain entirely.

Would shifting it three paces give you a negative gain on sadness or would it flow over?
Lastly, since it checks for accuracy and damage in those functions, is it possible to replace the accuracy check in fury with a damage check? I.e. instead of decreasing accuracy, increase damage under fury? I have to assume some value defines what it checks against but alas I can only do what people explain to me when it comes to the .exe


Bosola

  • Fire hazard!
  • *
  • Posts: 1748
    • View Profile
    • My YouTube Channel
You won't be able to 'replace' the fury accuracy check with a damage change, as accuracy is considered before base damage, but you could add a fury check to whichever damage formulae you wanted to affect. You could add a sub in an empty part of the executable (I know there's a big sea of nops in the PSX battle overlay) and add calls wherever necessary. The function bodies don't have gaps between them, though, so you would need to either move stuff around and update lookups or do some optimization to make your caller functions smaller, so the extra calls will fit.

The other thing you could do is replace an existing damage sub. If you're getting rid of frog, for example, you could probably replace it with a status check of your own.

On PSX the current damage is passed around subs on the register R4. Check out the q-gears source for a good reverse of that whole section.

As for shifting, a right shift by N places will divide the number by 2 to the power of N. A left shift will do the opposite. If you want to null the limit gain I assume you could just set the factor to zero.
« Last Edit: 2014-02-16 12:35:39 by Bosola »

nfitc1

  • *
  • Posts: 2984
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
You won't be able to 'replace' the fury accuracy check with a damage change, as accuracy is considered before base damage, but you could add a fury check to whichever damage formulae you wanted to affect. You could add a sub in an empty part of the executable (I know there's a big sea of nops in the PSX battle overlay) and add calls wherever necessary. The function bodies don't have gaps between them, though, so you would need to either move stuff around and update lookups or do some optimization to make your caller functions smaller, so the extra calls will fit.

Correct. Sadness is just a separate function that damage types X1 and X2 call. That pointer can be changed easily to point to another section of unreferenced code and execute any other factors you want. Accuracy is the same way.
Fury is a function that can easily be dummied out. It's called in a some accuracy formulae with the understanding that adjusted accuracy will be returned. It's easy to write "return what you're passed" and just ignore the rest of the code.
In either case, modifying either accuracy or damage modifying methods would either mean dummying out what's there and/or writing new ones.

Hitachis

  • *
  • Posts: 49
    • View Profile
Hey

are you guys working on a limit break mod?

thanks

and take care
« Last Edit: 2014-02-16 15:33:20 by Hitachis »

Tenko Kuugen

  • Public Enemy
  • *
  • Posts: 1416
    • View Profile
    • Twitter
Bosola and NFITC1 you guys are moving a little over my head
I'm not in a position where I can change functions. I already balanced a whole disc around having specific statuses so I can't just remove frog, mini or another status. Changing sadness and fury however is still within boundaries as they're statuses that are basically only player inflicted (for the most part)

Since replacing fury's accuracy check is not possible, can I null the check and instead clone the sadness damage modifier function (but instead use it for fury) and simply use values that would increase damage? ( for example, times 10 divided by 3, dealing 33% extra damage. Unless I am overseeing some horrible formula thing here )

Of course I have not the slightest damn idea how to do that. Still waiting for NFITC1 to explain how the limit bar values work

Bosola

  • Fire hazard!
  • *
  • Posts: 1748
    • View Profile
    • My YouTube Channel
If you want to do something other than modify a value (i.e. add new behaviour), then you're going to have to implement it either by finding an AI hack (which I don't think is possible in this case), or modifying the executable. You do that by either getting to grips with assembler and the toolchain for modifying the executable, or hoping that someone else will write it for you out of the goodness of their hearts (they might; they might not). If you can write FFVII AI scripts confidently, you should be able to learn x86 assembler (or MIPS for the PSX) without massive amounts of trouble.

You can't just replace the accuracy check with a damage transformation, because at the point the accuracy check is run, base damage hasn't been calculated. You're going to have to add a call to your fury function after base damage calculation. Your fury function will probably operate in a similar way to the sadness function, yes. Where the calls go depends on which damage equations you want to affect.

If it were me, I would be lazy and just add the fury damage multiplier to all physical attacks. I'd probably just insert a call to my own function in the space I freed up by making the back row check smaller. I would check how the berserk function looks up attacker statuses, then use that to look up the fury flag instead. From there, I'd do whatever maths I needed to with the current damage register, then jump back to the next sub. I suppose you could hardcode the jumps rather than making a proper function if you wanted to make this as easy as possible. I could only tell you where these subs are in the PSX version, though.
« Last Edit: 2014-02-16 17:49:21 by Bosola »

Tenko Kuugen

  • Public Enemy
  • *
  • Posts: 1416
    • View Profile
    • Twitter
Considering I'm literal lightyears behind on my own I have no time to learn ASM. In simpler words, NFITC1 might be great enough to write it for me or I will give up on it for now steal it when someone else does it in the coming years.
And I can piece together some AI stuff but that's far from being able to write any confidently.

I'd actually want all damage to be multipled by 150% but it stands to reason I'll do with whatever I'm given. Having the sadness damage and fury accuracy values is a good start but ultimately won't be useful without the limit bar changes. The whole fury damage multipler function is just a bonus. I'd be perfectly happy with just being able to cut accuracy in half, null limit bar increase during sadness and reduce damage by 40%, two of which I've already changed from NFITC1s first post