News:

The forum has been updated to SMF (2.1.3)!
Please be patient as we work to polish up the place and update features as we can.

Main Menu

Master Formula List

Started by Salanewt, 25, May, 2014, 01:47:41 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Salanewt

Happy to help!


Also, I think I have almost figured out the damage calculation stuff. I will do it later because it's just a tad confusing to put into standard mathematical notation. It essentially boils down to "(eStat_Diff / 2) = additional % of damage to add/subtract" though, but it's not 100% exact when the difference is low. Or, rather...

Where eStat_Diff = attacker's ePow - defender's eRes.

eStat_Diff of 200 = 200% damage (you have 200 and they have 0)
eStat_Diff of 100 = 150% damage
eStat_Diff of 0 = 100% damage
eStat_Diff of -100 = 50% damage
eStat_Diff of -199 = 0% damage

Give or take a point or two sometimes, particularly for low eStat differences. Unlike the rest of the formulas, the "effect only" one does not use RNG; damage should be pretty consistent because of this.

Oh yeah baby, £ me harder.

Fusion is just a cheap tactic to make weak Adepts stronger.

Yoshi's Lighthouse is a hacking website in progress. Why not check it out if you like Yoshi or the Mario & Luigi games?

Daddy Poi's Oily Gorillas

#41
@Multiply by 1.28

Take a look at the table the function reference... see what happens when you multiple by 1.28? The numbers should match:

Examples:
0x64 * 1.28 = 0x80
0xC8 * 1.28 = 0x100

As you can see, the numbers (0x80 and 0x100) represent the 0x64 and 0xC8 numbers, pretty much... but it's as though invisible decimal places have been added. (If it helps you understand.)

In the end, I think it might be a similar trick to how random numbers are multiplied and divided/shifted, except they try to complicate it a bit.

That's how I see it, anyway.

---

@The unknown I was talking about: I think it was a value retrieved from the stack. The instruction of note is at 08121354, so I was a bit lazy to scroll for where a value was placed there.


--

Edit: Almost forgot, but can you verify if the def_mod is the same percentage for the other formulas as well? ("1" will probably still be 50%, but the others?)
Golden Sun Docs: Broken Seal - The Lost Age - Dark Dawn | Mario Sports Docs: Mario Golf & Mario Tennis | Misc. Docs
Refer to Yoshi's Lighthouse for any M&L hacking needs...

Sometimes I like to compare apples to oranges. (Figuratively) ... They are both fruits, but which one would you eat more? (If taken literally, I'd probably choose apples.)
Maybe it is over-analyzing, but it doesn't mean the information is useless.


The only GS Discord servers with significance are:
Golden Sun Hacking Community
GS Speedrunning
/r/Golden Sun
GS United Nations
Temple of Kraden

Can you believe how small the Golden Sun Community is?

2+2=5 Don't believe me? Those are rounded decimal numbers. Take that, flat earth theorists! :)

Salanewt

#42
Yeah, I saw the table! Everything in the spoiler is what I have noticed so far by looking through that function; the "during" segments are the 1.28 thing, while the BL and "after" segments only seem to apply to the effect only formula. It seems that having a negative eStat difference will grab negative numbers from the table, while a positive eStat one will grab the others.

[spoiler=.txt file, contains code references]
(((Base Damage * eStat_var) * 100)/[LSR 10] * unk_arg * (multi_mod * 100)/100)) * def_mod
"multi_mod" = 100% for primary, 50% secondary, 30% tertiary, 10% everyone else
"def_mod" = 100% for normal, 50% for 50% damage off, 40% for 60% off, 10% for 90%


BL (080AD130)
r2 = x100
r0 = ePow-eRes
r1 = 0
r5 = x100
- r2 added to r5 for BL (080B02DC)
r6 = base damage

During (1):

r0 = ePow-eRes (moved to r6) -> x05
r1 = 0
r2 = xC8 (200, sets ePow/eRes difference cap)
r3 = xFF38 (-199, set ePow/eRes difference floor)
r5 = #080C6B04

During (2):

r0 = 5
r1 = 0 -> +1 (loop)
r2 = +4 (loop)
r3 = xC8 -> LDSH r12 + r4 (loop) [x64 on the first loop, x00 on second, xFF9C on third]
r4 = 0 -> +r2 (loop, moved from r2)
r6 = ePow-eRes
r12 = #080C6B04 (moved from r5)

During (3):

r0 = 0 (if ePow-eRes difference is positive), xFF9C (if negative) -> positive sum of r6-r0 -> sum of (r0*r2)
r1 = 0 -> x64
r2 = 0 -> x80
r5 = #080C6B04 -> 0 (if positive), xFF80 (-127, if negative)
r6 = ePow-eRes

During (4/after division)

r0 = r0/r1
r1 = x60
r2 = x64
r3 = r0-r1
r5 = 0 (if positive), xFF80 (-127, if negative)
r6 = ePow-eRes
r7 = 0 (moved from r8) (if = 1, r3 = r0 LSR x1F, then (r3+r0)/2; doesn't seem to happen with effect only formula)

End (During (5)):

r0 = r0+r1
r1 = x100

After:

r0 = ePow-eDef output damage? -> x100 (moved from r5) -> r0*r3 -> Output Damage
r1 = x100
r2 = x64
r3 = base damage (moved from r6) -> r3*r0 (before r0 = x100)
r4 = ??? (x08 or x0C so far)
r5 = x100
r6 = base damage
[/spoiler]


The downside is that the linked function was hard to follow and I was doing this late last night before bed, so a couple of the registers might be incorrect here or there... But I think I understood most of it. I do know that for the initial linked function (not the 1.28 one), it basically divides the output damage by 16 (LSR x10) before returning to the main formula. The looping part also threw me for a loop (haha) for a bit, but I think I still understand it well enough.


Unknown: Groovy, I might take a look at that soon-ish then.

As for the def_mod part, I can definitely look into it later. I'm hoping that, by figuring out exactly how this 1.28 function works, I/we can use our research to discover exactly how the other damage formulas are laid out. Especially since it seems like most (if not every) damage formula uses it.
Oh yeah baby, £ me harder.

Fusion is just a cheap tactic to make weak Adepts stronger.

Yoshi's Lighthouse is a hacking website in progress. Why not check it out if you like Yoshi or the Mario & Luigi games?

Daddy Poi's Oily Gorillas

#43
@jj: Huh... so you call those states? I suppose that's fair enough since the game refers to them as Status.. ("Normal status." is a string in the game.) ; I'm more familiar with calling them status effects/ailments/(de)buffs. ; As for the plural form of status, I would have probably used statuses since "state" and "states" seem to go together, but I'm sure many people have many ways of looking at it?

I suppose the spoiler that I had earlier might hint which statuses are checked, but it's been like forever since I've looked into it, so...

@Salanewt:
"(Output Damage(multi_mod * 100)/100))*def_mod" = Multiplying by 100, only to divide by 100... that reverts the number back to what it was before you multiplied, so there's likely an error there.

@Unknown: Good, I guess that'll save me the time it takes to look it up, I guess.

@def_mod: Sounds good!!
Golden Sun Docs: Broken Seal - The Lost Age - Dark Dawn | Mario Sports Docs: Mario Golf & Mario Tennis | Misc. Docs
Refer to Yoshi's Lighthouse for any M&L hacking needs...

Sometimes I like to compare apples to oranges. (Figuratively) ... They are both fruits, but which one would you eat more? (If taken literally, I'd probably choose apples.)
Maybe it is over-analyzing, but it doesn't mean the information is useless.


The only GS Discord servers with significance are:
Golden Sun Hacking Community
GS Speedrunning
/r/Golden Sun
GS United Nations
Temple of Kraden

Can you believe how small the Golden Sun Community is?

2+2=5 Don't believe me? Those are rounded decimal numbers. Take that, flat earth theorists! :)

jjppof

If everyone here say status, I can say status too.  :happy:

Salanewt

#45
Probably, that formula is horribly incomplete. Though taking another look at it, the "Output Damage" part should multiply with the bracket stuff before getting divided... Although that's a placeholder for the rest of the formula anyway, so it probably doesn't matter quite as much if it weren't a placeholder.

But basically, this one formula that I'm trying to look at doesn't actually use the base damage of the ability in its calculation; that comes after all of the complicated eStat variation stuff. I think the end result will probably look something like this:

(((Base Damage * eStat_var) * 100)/[LSR 10] * unk_arg * (multi_mod * 100)/100)) * def_mod
"multi_mod" = 100% for primary, 50% secondary, 30% tertiary, 10% everyone else
"def_mod" = 100% for normal, 50% for 50% damage off, 40% for 60% off, 10% for 90%

The "eStat_var" is what I'm trying to figure out right now. It basically handles the variation as "ePow - eRes" for the ability's element (should it have one), and uses that number between -199 and 200 for calculating something. I'm pretty sure that also comes from the effect only formula, but I'll double check later (haven't really taken a look at the code before this one BL). It also looks like it's used by almost every other damage formula, so I'm probably going to post it as its own formula when I'm ready to add the finished version of this. The downside is that it looks like there are certain parts that are either not used by this damage formula or are used only under certain circumstances.

Edit: The difference will effectively appear to be "(Base Damage * (eStat_diff))/100" or something. For example:

(50 * (200-50))/100
= (50 * (150))/100
= 7500/100
= 75

But the formula itself is much more complicated than that. I have no idea why this is the case. Maybe the programmer who designed this had an hourly wage as opposed to a contractual one and stretched their efforts needlessly just to go home with a higher pay cheque. Maybe not.

Anyway, back to the pre-edit stuff!


And I'll take a closer look at the "multi_mod" stuff a bit later as well. I could have sworn that something was multiplied by 100 at some point, but there's also a good chance that I messed that up because it was later at night. Although that could also have been for the def_mod... You know, I think it was. I'll check later though!


Oops, I had one register incorrectly labeled as the element ID rather than the eStat difference. Fixed!

Oh yeah baby, £ me harder.

Fusion is just a cheap tactic to make weak Adepts stronger.

Yoshi's Lighthouse is a hacking website in progress. Why not check it out if you like Yoshi or the Mario & Luigi games?

Daddy Poi's Oily Gorillas

#46
Turns out the unknown I didn't know was the multiplier that ability effects use.

This starts right at Effect Only formula:
[spoiler=large image][/spoiler]
Just a moment ago, I was working on this incomplete image tutorial. Not sure if I'll finish it off or not, though.

Yes... imgur is good. photobucket resizes large images, but imgur doesn't!
Golden Sun Docs: Broken Seal - The Lost Age - Dark Dawn | Mario Sports Docs: Mario Golf & Mario Tennis | Misc. Docs
Refer to Yoshi's Lighthouse for any M&L hacking needs...

Sometimes I like to compare apples to oranges. (Figuratively) ... They are both fruits, but which one would you eat more? (If taken literally, I'd probably choose apples.)
Maybe it is over-analyzing, but it doesn't mean the information is useless.


The only GS Discord servers with significance are:
Golden Sun Hacking Community
GS Speedrunning
/r/Golden Sun
GS United Nations
Temple of Kraden

Can you believe how small the Golden Sun Community is?

2+2=5 Don't believe me? Those are rounded decimal numbers. Take that, flat earth theorists! :)

Salanewt

#47
Nice work! I've added a bit more to the WIP formula I have thanks to your post:

If Cloak is not in use;
And if ailment success /= 0 (if there is one);
And if damage > 0;
(((Base Damage * eStat_var) * 100)/65536 * ability_mul * (multi_mod * 100)/100)) * def_mod
"ability_mul" = Ability effect multipliers (see respective multiplier effects), defaults to 1 when there is no effect
"multi_mod" = 100% for primary, 50% secondary, 30% tertiary, 10% everyone else
"def_mod" = 100% for normal, 50% for 50% damage off, 40% for 60% off, 10% for 90%

Obviously the "eStat_var" part is the incomplete part, but I haven't quite worked out a good way to write out an effective formula for it. Getting there though.

The linked function in the second red section links to another function, and that is the function that does all of the weird calculations with the base damage and eStat difference. It's then multiplied and divided a bit before being brought bad to the original function. To make a long story short, you could expect to see values well over x100000 if following the formula as it's coded in the game.


I was also mistaken on the "effective calculation" before, but I don't really care about fixing that one when this is the important one...


Edit: I removed the "Confirmed" and "Unconfirmed" headers from the first post because it kind of looks like we're on a roll with confirming them. So... the first has been replaced with "Vanilla" for now. I'll probably change it again later though, it's just a placeholder until I decide whether to add a second section for "Custom" formulas that are available as hacks or just keep it as a list of strictly unmodified formulas. About 99% sure it will be the latter.
Oh yeah baby, £ me harder.

Fusion is just a cheap tactic to make weak Adepts stronger.

Yoshi's Lighthouse is a hacking website in progress. Why not check it out if you like Yoshi or the Mario & Luigi games?

Daddy Poi's Oily Gorillas

#48
QuoteNice work! I've added a bit more to the WIP formula I have thanks to your post:
Thanks, and you are welcome.

QuoteI could have sworn that something was multiplied by 100 at some point
I still don't remember seeing anything about the multi_mod being multiplied by 100... Hmm... But if you find anything, then be sure to enlighten me. :)

By the way, I've just updated my image tutorial in my previous post. It seems that's all the effect-only stuff... (I omitted the "But it has no effect" part in case it was used elsewhere as well? Not sure.)

Quote"Confirmed" and "Unconfirmed" headers from the first post because it kind of looks like we're on a roll with confirming them.
Sounds good. I was wondering what the point of having those were if we were most likely not going to have any unconfirmed ones. (Or as many, anyway.)

---

I believe you forgot to list the Critical Hit/Unleash formula(s)... (Along with the the effects that are related.)

----

Looking at the Added Damage formula, I see something that tells me Attack + (Attack/4) as part of the formula... It might be with just one enemy, though? 304 Wild Gryphon

Added Damage:

max(0, userAttack - targetDef + (abilityPower * 2)) * elementalFunction(eStatDiff)

Note: It's possible that abilityPower being multiplied by 2 is undone... in which case, it could be that (userAttack - targetDef) is divided by 2...?

Multiplier:

max(0, userAttack - targetDef) * elementalFunction(eStatDiff) * abilityPower / 10


---
Now back to the 1.28 function: If you look at the call at 080B0350 (and the code around it.), it's almost like it's doing x*128/100. (Unless I'm mistaken?) That's mainly what's needed, however, I have a feeling the table was suppose to be used to change the scaling? (But they ended up keeping it linear?) Probably similar to Stat Growths? Hm..

if arg r1 = 0: (ePow - eRes) * 1.28 + 0x100

if arg r1 = 1: (ePow - eRes) * 1.28 / 2 + 0x100

Theories: (wip?)
If you have an eStatDiff of -200, the damaged returned might be 0. (if r1=1: 0x80)
eStatDiff of -100, you get 0x80... (if r1=1: 0xC0)
eStatDiff of 0, you get 0x100... (if r1=1: 0x100)
eStatDiff of 100, you get 0x180... (if r1=1: 0x140)
eStatDiff of 200, you get 0x200... (if r1=1: 0x180)

It pretty much looks like the function at 0x080B02DC returns base 16 percentages. So the parent-level function will need to shift 8-bits out after multiplying? (Um... will still need to look into this further, though.)

Hmm.. By the way, Is the r2 arg for the function at 080B03E0... is it a percentage done in base 16? If so... hehe.... so two base 16 percentages are multiplied together, making it so you have to shift 16 bits.
Golden Sun Docs: Broken Seal - The Lost Age - Dark Dawn | Mario Sports Docs: Mario Golf & Mario Tennis | Misc. Docs
Refer to Yoshi's Lighthouse for any M&L hacking needs...

Sometimes I like to compare apples to oranges. (Figuratively) ... They are both fruits, but which one would you eat more? (If taken literally, I'd probably choose apples.)
Maybe it is over-analyzing, but it doesn't mean the information is useless.


The only GS Discord servers with significance are:
Golden Sun Hacking Community
GS Speedrunning
/r/Golden Sun
GS United Nations
Temple of Kraden

Can you believe how small the Golden Sun Community is?

2+2=5 Don't believe me? Those are rounded decimal numbers. Take that, flat earth theorists! :)

Salanewt

Multi: Yeah, I've been thinking about it and it doesn't make sense to me anymore. Just removed it from the WIP formula in my text file.

Critical hit, right. Thanks for posting it! I'll wait until we're a bit closer to figuring out this eStat calculation stuff before adding them, since it may help.


As for that last one, yep. This is basically what I have as far as tracking the difference (excluding mostly irrelevant registers):

During (1):
r0 = ePow-eRes (moved to r6) -> x05

During (2 - Loop):
r6 = ePow-eRes

During (3):

r0 = 0 (if ePow-eRes difference is positive), xFF9C (-99, if negative) -> positive sum of r6-r0 -> sum of (r0*r2)
r1 = 0 -> x64
r2 = 0 -> x80
r5 = #080C6B04 -> 0 (if positive), xFF80 (-127, if negative)
r6 = ePow-eRes

During (4 - Post-division)

r0 = r0/r1
r1 = x60
r2 = x64
r3 = r0-r1
r5 = 0 (if positive), xFF80 (-127, if negative)
r6 = ePow-eRes

During (5 - End):

r0 = r0+r1
r1 = x100


So basically, the value is multiplied by 128 at some point and then divided by 100 shortly after. It kind of looks like 256 is added to it at some point as well, which is when it gets back to the previous function:

r0 = ePow-eDef output damage? -> x100 (moved from r5) -> r0*r3 -> Output Damage
r1 = x100
r2 = x64
r3 = base damage (moved from r6) -> r3*r0 (before r0 = x100)
r4 = ??? (x08 or x0C so far)
r5 = x100
r6 = base damage

And then it's multiplied by 100 again after the output is multiplied by the base damage, but before it is divided/shifted at the end of the function.


Looking at the image again, it's kind of weird that they added exceptions for Doom Dragon in this part of the code rather than have an external function like with Agatio/Karst.
Oh yeah baby, £ me harder.

Fusion is just a cheap tactic to make weak Adepts stronger.

Yoshi's Lighthouse is a hacking website in progress. Why not check it out if you like Yoshi or the Mario & Luigi games?

Daddy Poi's Oily Gorillas

Seems after you understand it a bit, the functions aren't really that confusing... Except for the reason behind making it longer than it needs to be.

By the way, Even the documentation at GameFaqs seem to have it right (At least I think they do? I only checked the Element part.):  http://www.gamefaqs.com/gba/561356-golden-sun-the-lost-age/faqs/22880

Special Physical Attacks:
    Damage = [Base Damage * Mult Mod] + Add Mod
    If Elemental, Damage = [Damage * (1 + Relative Power / 400)]

Basic Psynergy Attacks:
    Psynergy has own Base Damage
    Damage = [Psynergy Base Damage * (1 + Relative Power / 200)]


They're calling eStatDiff by Relative Power. :)

! + (100 / 400) = 5/4 = 125%
1 + (100 / 200) = 3/2 = 150%
Golden Sun Docs: Broken Seal - The Lost Age - Dark Dawn | Mario Sports Docs: Mario Golf & Mario Tennis | Misc. Docs
Refer to Yoshi's Lighthouse for any M&L hacking needs...

Sometimes I like to compare apples to oranges. (Figuratively) ... They are both fruits, but which one would you eat more? (If taken literally, I'd probably choose apples.)
Maybe it is over-analyzing, but it doesn't mean the information is useless.


The only GS Discord servers with significance are:
Golden Sun Hacking Community
GS Speedrunning
/r/Golden Sun
GS United Nations
Temple of Kraden

Can you believe how small the Golden Sun Community is?

2+2=5 Don't believe me? Those are rounded decimal numbers. Take that, flat earth theorists! :)

Salanewt

Yeah, I noticed that Gamefaqs thing as well a couple days ago. It is pretty accurate as far as end result, but it would be cool to understand how exactly it's done in the code for future reference. It would also be less confusing to call it relative power now rather than change it in the formula later at any rate! :happy:

Plus, thinking about it, their calculation for relative damage makes much more sense. The reason why I have been ignoring it is because it's done differently in the code, and the first post is pretty much reserved for formulas as they are executed in the code; makes it less confusing for those who may want to look at the code themselves in the future. Plus with the whole "lacking decimal numbers" thing, you basically have to multiply a number by a certain amount and then divide it to get a fraction.

If Cloak is not in use;
And if ailment success /= 0 (if there is one);
And if base damage > 0;
((Base Damage * Relative Power) * ability_mul * multi_mod /100) * def_mod
"ability_mul" = Ability effect multipliers (see respective multiplier effects), defaults to 1 when there is no effect
"multi_mod" = 100% for primary, 50% secondary, 30% tertiary, 10% everyone else
"def_mod" = 100% for normal, 50% for 50% damage off, 40% for 60% off, 10% for 90%

So that's basically what the full formula comes to. The "Relative Power" bit (as it shall now be called to avoid confusion) is the part that we should try confirming at some point.
Oh yeah baby, £ me harder.

Fusion is just a cheap tactic to make weak Adepts stronger.

Yoshi's Lighthouse is a hacking website in progress. Why not check it out if you like Yoshi or the Mario & Luigi games?

Daddy Poi's Oily Gorillas

#52
Okay...

I'm just saying that the guide is very accurate at the simplifying part.

Remember these?
Quoteif arg r1 = 0: (ePow - eRes) * 1.28 + 0x100

if arg r1 = 1: (ePow - eRes) * 1.28 / 2 + 0x100

All you have to do is divide by 256 or 0x100, and you get these: (Literally.) The formula that I made above was before I checked with the Faq.
Quoteif arg r1 = 0: (ePow - eRes) /200 + 1

if arg r1 = 1: (ePow - eRes) /200 / 2 + 1

Relative Power ... and the "what it should be" sound like two slightly different things? Um? I think.
Golden Sun Docs: Broken Seal - The Lost Age - Dark Dawn | Mario Sports Docs: Mario Golf & Mario Tennis | Misc. Docs
Refer to Yoshi's Lighthouse for any M&L hacking needs...

Sometimes I like to compare apples to oranges. (Figuratively) ... They are both fruits, but which one would you eat more? (If taken literally, I'd probably choose apples.)
Maybe it is over-analyzing, but it doesn't mean the information is useless.


The only GS Discord servers with significance are:
Golden Sun Hacking Community
GS Speedrunning
/r/Golden Sun
GS United Nations
Temple of Kraden

Can you believe how small the Golden Sun Community is?

2+2=5 Don't believe me? Those are rounded decimal numbers. Take that, flat earth theorists! :)

Salanewt

That's certainly true, yeah! Like, I will add the "simplified" version(s) to the first post, but I didn't want to put them up until after we confirmed the formula as calculated in the function (one for the casual readers, and one for the coders).

I've also been pretty busy with my studies, so I haven't really been looking into this a lot lately... Sorry! Is the bottom one what I should add to the first post then?
Oh yeah baby, £ me harder.

Fusion is just a cheap tactic to make weak Adepts stronger.

Yoshi's Lighthouse is a hacking website in progress. Why not check it out if you like Yoshi or the Mario & Luigi games?

Daddy Poi's Oily Gorillas

#54
Yes. The code does divide by the 256 that I just posted in my previous post...  In three different functions (The parent functions to the child function you were probably looking at.).... (It's actually like hitting two birds with one stone, because it's shifting the other bits due to multiplying other numbers as well.)

Function 1 shifts 9 bits... 8 from the percent, 1 from actual dividing of attack - defense... I think
Function 2 shifts 16 bits.... 8 from the percent, and 8 from the percentArg. And same with Function 3.



If Cloak is not in use;
And if ailment success /= 0 (if there is one);
And if base damage > 0;
((Base Damage * ((Relative Power/200) + 1)) * ability_mul * multi_mod /100) * def_mod
"Relative Power" = User's Elemental Power - Target's Elemental Resist
"ability_mul" = Ability effect multipliers (see respective multiplier effects), defaults to 1 when there is no effect
"multi_mod" = 100% for primary, 50% secondary, 30% tertiary, 10% everyone else
"def_mod" = 100% for normal, 50% for 50% damage off, 40% for 60% off, 10% for 90%



Fixed! (I think?)


Formulas: (Mostly a WIP, so you can probably confrrm them, if you want.)

Added Damage: (Left out crit/multi_mod/effect_mod)
max(0, max(0, ((userAttack - targetDef) / 2) + abilityPower) * (1 + (Relative Power/400)))
max(0, max(0, ((userAttack - targetDef) / 2) + abilityPower) * (1 + ( Int(Relative Power*256/400)/256 )))
max(0, max(0, ((userAttack - targetDef) / 2) + abilityPower) * (1 + ( Int(Relative Power*0.64)/256 )))

Multiplier: (Left out crit/multi_mod/effect_mod)
max(0, max(0, (userAttack - targetDef) / 2) * (1 + (Relative Power/400))) * abilityPower / 10
max(0, max(0, (userAttack - targetDef) / 2) * (1 + ( Int(Relative Power*256/400)/256 ))) * abilityPower / 10
max(0, max(0, (userAttack - targetDef) / 2) * (1 + ( Int(Relative Power*0.64)/256 ))) * abilityPower / 10

Effect Only:
((Base Damage * (1 + (Relative Power/200))) * ability_mul * multi_mod /100) * def_mod
((Base Damage * (1 + ( Int(Relative Power*256/200)/256 ))) * ability_mul * multi_mod /100) * def_mod
((Base Damage * (1 + ( Int(Relative Power*1.28)/256 ))) * ability_mul * multi_mod /100) * def_mod

Where /200 and /400 occur, there is a rounding error, because the game rounds off to the nearest 1/256th before actually multiplying to anything.... To fix the rounding error, multiply the numerator by 256, get a decimal number, remove the decimal places, and then divide by 256 (To undo what you multiplied by earlier. Because * 256/256 is *1, which doesn't change anything.)


By the way, you left out multi_mod and effect_mod from your healing formula. (I'm going to assume the majority of the damage functions use these, so you can probably abbreviate on them.)

Quote from: Some battle related functions that go with stats - Their stat-like behavior is probably why they're in Party Mechanics080AFF28 = get_summons_total(addr) addr is where to list the summons.
080AFF7C = get_summon_address(summon)
080AFF94 = obtain_summon(summon)
080AFFAC = get_elemental_levels(pc,pc_ram_addr,sp) pc can be 0-7 for PCs, or 8+ for enemies.; Return 0.
080B0028 = get_elemental_level(pc,element)
080B005C = get_enemy_elemental_attr(enemy)
080B0084 = update_elemental_pow_resist(pc_slot, pow_res_ram_addr) Includes base levels and djinn, not sure about item bonuses.
080B0144 = find_matching_class(pc,pc__ram_addr,item)
080B0288 = get_class_address(class)
080B0298 = Djinn set/removal calculations (grabs/updates class ID (possibly abilities too)? and links update_elemental_pow_resist)
080B02D4 = Call 080B0298.
080B02DC = toElementalHexPercent(Relative ePower, eHalfEffective) (Converts to hex percentage. (Multiply by 1.28 or 0.64 and add 256. Equivalent to (1 + Relative Power / 200) and (1 + Relative Power / 400), but those have a rounding error.) In parent function mult. with value and shift out 8 bits.) It's like converting 100 to +50% in hex. (If eHalf, +25%) (150% and 125%)
080B0378 = Random Number Generator //Returns 16-bit (x0000-xFFFF)
080B039C = Return random number x0-x63.
080B03AC = calcAttack(attack,targetDef,power,Relative ePower) targetDef could be 100%, 50%, or 0% of value depending on effect. Used by Added Damage & Multiplier
Return max(0, max(0, ((userAttack - targetDef) / 2) + abilityPower) * (1 + (Int(Relative ePower*256/400)/256)))
080B03E0 = calcCast(abilityPower,Relative ePower,percent) (From left?) elemental pow/resist related  *Called from Summon and Effect Only formulas...
Return abilityPower * (1 + (Int(Relative ePower*256/200)/256) * hexPercent
080B0408 = calcHeal(Same as above, but it multiples arg r1 by 2 and subtracts by 200 at beginning.) (From Center?) *Called from Healing formula(s).
Return abilityPower * ((Int(ePower*256/100)/256) * hexPercent

080B0434 = get_elemental_attr(pc)
080B0460 = get_item_criticals(pc_addr)
080B04BC = unleash_check(pc) Returns ability to cast. (Unleash if chance succeeds, or attack.)
080B0514 = Base Ability Effect Success Chances?
080B06A8 = Return 1 if enemy found in table 080C6B18, else 0.
080B06C8 = Return 1 if enemy found in table 080C6B76, else 0.
080B06E8 = is_vulnerable/weakness(pc_addr, ability_effect)
080B0740 = Ability_Effect_Revives(ability_effect) //If effect revives, return 1, else 0.
080B075C = Calculate_Ailment_Success(attacker,defender,element,effect,percentMod)

I figure the three functions calcAttack, calcCast, calcHeal, are the base calculations, while the battle mechanics themselves use modifiers like multi_mod, effect_mod, and def_mod.


It appears that PP Recovery doesn't have a random value that gets added.
Golden Sun Docs: Broken Seal - The Lost Age - Dark Dawn | Mario Sports Docs: Mario Golf & Mario Tennis | Misc. Docs
Refer to Yoshi's Lighthouse for any M&L hacking needs...

Sometimes I like to compare apples to oranges. (Figuratively) ... They are both fruits, but which one would you eat more? (If taken literally, I'd probably choose apples.)
Maybe it is over-analyzing, but it doesn't mean the information is useless.


The only GS Discord servers with significance are:
Golden Sun Hacking Community
GS Speedrunning
/r/Golden Sun
GS United Nations
Temple of Kraden

Can you believe how small the Golden Sun Community is?

2+2=5 Don't believe me? Those are rounded decimal numbers. Take that, flat earth theorists! :)

Daddy Poi's Oily Gorillas

#55
I see this is a master formula list... but it is pretty small... It also looks like most formulas use a random number... and since the RNG is like a formula, I have a question? Does it fit here as well?


GS1/GS2:
seed = seed * 1103515245 + 12345
return seed << 8 >> 16 (16-bit random number.)
The initial seed should start at 0.

GS3: (Seems to do this type of thing in various places, but I'm not certain if there are any exceptions.)
seed = seed * 69069 + 1
return seed >> 16

Another function will do this after updating seed:
return ((seed >> 16) * range) >> 16 (Random number from 0 to range-1)
Not sure if the initial seed is 0 or not.

In all cases, seed is a 32-bit number.
Both RNGs are listed here: https://en.wikipedia.org/wiki/Linear_congruential_generator


GS3 might have another function, because the one listed with range is from 02171A64... and my scanner detects it only being called FIVE times!:
02171678
021716D4
02171810
021718BC
02172FF4


Other random number calculations found (Same seed * 69069 + 1 stuff , all numbers from in battle....)
02003624 (Arm function)
020059C0
02015D80
0202D454
0210F750
02110C78
021120B0,02112108
021194C4
02119634 = Function for calculating it as it should have been....
02119A54
0211AE54
0211CD4C
...there are way too many to list... of course, most of them are appearing with-in functions and are not a function themselves. (Except for two and maybe three/etc.)
Perfect to use as an access polnt to studying GS3's data, though!
(Also, compilers are weird, so not so sure about blaming the dev for having it everywhere.... Since a simple define in c language(s) is not a function, but some sort of substitution/etc..)
Golden Sun Docs: Broken Seal - The Lost Age - Dark Dawn | Mario Sports Docs: Mario Golf & Mario Tennis | Misc. Docs
Refer to Yoshi's Lighthouse for any M&L hacking needs...

Sometimes I like to compare apples to oranges. (Figuratively) ... They are both fruits, but which one would you eat more? (If taken literally, I'd probably choose apples.)
Maybe it is over-analyzing, but it doesn't mean the information is useless.


The only GS Discord servers with significance are:
Golden Sun Hacking Community
GS Speedrunning
/r/Golden Sun
GS United Nations
Temple of Kraden

Can you believe how small the Golden Sun Community is?

2+2=5 Don't believe me? Those are rounded decimal numbers. Take that, flat earth theorists! :)

Salanewt

The RNG function fits!

Also, thanks for the contributions to this topic. :P
Oh yeah baby, £ me harder.

Fusion is just a cheap tactic to make weak Adepts stronger.

Yoshi's Lighthouse is a hacking website in progress. Why not check it out if you like Yoshi or the Mario & Luigi games?

Salanewt

Okay, I threw a new one in here involving the ePower boosts you get from summons! I really need to update this thing more. :P
Oh yeah baby, £ me harder.

Fusion is just a cheap tactic to make weak Adepts stronger.

Yoshi's Lighthouse is a hacking website in progress. Why not check it out if you like Yoshi or the Mario & Luigi games?

Daddy Poi's Oily Gorillas

#58
Good job! But I recommend also listing the 10, 30, 60, 100, thing as well.. (And if GS1 can have summons that raise EPower for multiple elements at once or not?)


--
Also, I thought I found an error with one of the percents somewhere.... that I think I messaged you about a very long time ago... I can't remember if you ever fixed it or not, though.


---
I think I'd like to know which abilities have the Stun effect... so I can figure out why one stun generates three RNs... ; Would be funny if it was to mimic the animation or something. ; Otherwise, it could be related to a Type...? (Weapon Type, Ability Type, etc?)
Golden Sun Docs: Broken Seal - The Lost Age - Dark Dawn | Mario Sports Docs: Mario Golf & Mario Tennis | Misc. Docs
Refer to Yoshi's Lighthouse for any M&L hacking needs...

Sometimes I like to compare apples to oranges. (Figuratively) ... They are both fruits, but which one would you eat more? (If taken literally, I'd probably choose apples.)
Maybe it is over-analyzing, but it doesn't mean the information is useless.


The only GS Discord servers with significance are:
Golden Sun Hacking Community
GS Speedrunning
/r/Golden Sun
GS United Nations
Temple of Kraden

Can you believe how small the Golden Sun Community is?

2+2=5 Don't believe me? Those are rounded decimal numbers. Take that, flat earth theorists! :)

Salanewt

Oh yeah, that's a good point; I'll add it soon!

I think I remember you mentioning that once? I just fixed Sleep's percentage earlier so that may have been it.


As for the other Stun, I think Fire Puppet uses it (effect 85). Not sure about any others, since usually an ability will use 23.
Oh yeah baby, £ me harder.

Fusion is just a cheap tactic to make weak Adepts stronger.

Yoshi's Lighthouse is a hacking website in progress. Why not check it out if you like Yoshi or the Mario & Luigi games?