Golden Sun Hacking Community

Golden Sun Resources => Misc. GS Hacking => Topic started by: Rolina on 06, October, 2012, 09:00:49 AM

Title: Ailment and Debuff Formulas
Post by: Rolina on 06, October, 2012, 09:00:49 AM
We've got ideas about what formulas to use for everything but ailment and debuff success rates.  All we know is that luck is involved.

For those of you who've been looking around in the code, have you found anything related to this at all?  If not... care to start looking for it?  Understanding how ailments work is preeeety important if we ever want to add new ones or try to balance them by tweaking success rates.
Title: Re: Ailment and Debuff Formulas
Post by: Misery on 07, October, 2012, 09:47:51 AM
It's also known that relative power of user vs target in the element of the debuff/ailment used is involved, and that classes/enemies have weaknesses to certain effects. That won't do much good without any actual values, though.

Sala might have known something about it, iirc he was the one to bring up the weakness thing, and possibly the involvement of elemental power/resistance as well. Again, that won't do us much good.

This is probably the first thing I'm going to look into once I figure out how, ailments and debuffs are almost completely useless as it stands.
Title: Re: Ailment and Debuff Formulas
Post by: Rolina on 08, October, 2012, 04:41:18 AM
Well, if Sala did know something, then hopefully Jamie or Teawater could see if could share what he knows - or anyone else at the lighthouse, I imagine.
Title: Re: Ailment and Debuff Formulas
Post by: leaf on 08, October, 2012, 07:13:18 PM
Relevant:
http://forum.goldensunhacking.net/index.php?topic=1632.0

Sala says he doesn't have much else though.
Title: Re: Ailment and Debuff Formulas
Post by: Rolina on 09, October, 2012, 04:00:33 AM
Well, that at least points us in the right general area to look at least.  Still, if I'm to put up a pseudocode guestimate of what the formula looks like, it'd be this:

Base Chance - (luck + individual resistance)

Hopefully, we can find out a more accurate representation.  Specifically, the base chances for each ailment, plus the specific influence luck holds.  Is it that each point in luck is a 1% drop in chance, or perhaps is it weighted, or... well, who knows?
Title: Re: Ailment and Debuff Formulas
Post by: Daddy Poi's Oily Gorillas on 09, October, 2012, 07:47:12 AM
That topic doesn't say anything about the Ailment/Debuff formulas.

This seems to include the vulnerabilities in the class and enemy banks.

The potential code for this is around 080B0A1C = I think this is where luck is grabbed. And a glance down to 080B0A36 being x19 (a.k.a 25 in decimal) shows me how all this is bundled together. I think I shall look into exactly what this formula is soon...

Edit after Rolina's post:  Research should probably be placed on the entire function:  080B075C - 080B0A8E.
Title: Re: Ailment and Debuff Formulas
Post by: Rolina on 09, October, 2012, 07:59:00 AM
Quote from: Teawater on 09, October, 2012, 07:47:12 AM
This seems to include the vulnerabilities in the class and enemy banks.
Which, if my guess is right, is part of the formula.  Plus, it helps us when it comes to figuring out where to look.  Still, the more we can figure out the better, so anything you can find should help.

Right now, my guess is that each effect has a different base success rate - not just ailments, but all of them.  If we could locate where those are stored, I'm sure that'd help quite a lot as well.
Title: Re: Ailment and Debuff Formulas
Post by: Daddy Poi's Oily Gorillas on 09, October, 2012, 08:16:59 AM
From when I remember studying vulnerabilities last time, I believe the base percentages were hard coded in this function: 080B0514 ; So editing them is not exactly straight-forward, especially since some of those numbers can be used for multiple effects as seen by the branching pattern.
Title: Re: Ailment and Debuff Formulas
Post by: Rolina on 09, October, 2012, 08:46:33 AM
Regardless, knowing and writing down how it works is important.  Plus, I'd also like to get this done for GSU so that they have a comprehensive list in the wiki.
Title: Re: Ailment and Debuff Formulas
Post by: Daddy Poi's Oily Gorillas on 09, October, 2012, 11:52:55 AM
It looks like there's a part of the code where if defender's luck is 40+, about 8 of the effects are given a chance of 0%. (For example, x18 and x19 (May Inflict Poison/Venom)

Effect's can also have a base chance without a formula (When their numbers are negative ), but when the formula is used (x0-x64), I think it looks like this: Not sure if I made any mistakes.

success =
(((((((Attacker's elemental level - Defender's elemental level) - Floor(Defender's luck / 2)) * 3) + effect's base chance + (vulnerabity's 25)) * diminishing%) / 100)  >= rnd())

diminishing% = The direct target is 100, with this lowering for enemies further away.

Notes:
x52 = "82 - May force target out of battle" is always 0% when class is not NPC. (0% for player characters?)

These generate three random numbers... This would make, for example, a chance of 50% (one) to be 87.5% (three), I think.
x43 = "67 - Inflicts Seal"
x50 = "80 - Inflicts Death Curse"
x55 = "85 - May inflict Stun"

Hopefully I didn't get anything backwards or messed up. I've only looked at the stuff from 080B08C2 and down, but there may be some stuff above this address that may have conditions for when this formula is skipped.

Where attacker and defender labels are placed are just assumed, I didn't double check them, but it wouldn't make much sense otherwise.

« Last Edit: October 10, 2012, 01:32:55 PM by Teawater »
Title: Re: Ailment and Debuff Formulas
Post by: Rolina on 09, October, 2012, 01:02:33 PM
Wait, element level has influence?  Wow, that was unexpected.  Keep up the good work.
Title: Re: Ailment and Debuff Formulas
Post by: Daddy Poi's Oily Gorillas on 09, October, 2012, 01:15:42 PM
Yes, it appears it is just elemental level, though.  I didn't see anything on elemental power or resistance. (I'm assuming power/resistance just means how much damage is taken/given.)

P.S. =  I forgot to congratulate you on you 5000th post.  Congratulations!
Title: Re: Ailment and Debuff Formulas
Post by: Rolina on 10, October, 2012, 10:50:39 AM
Well, that's certainly interesting.  Completely unexpected, too.  I actually like that, to be honest.
Title: Re: Ailment and Debuff Formulas
Post by: Daddy Poi's Oily Gorillas on 26, October, 2012, 09:19:22 PM
I guess the chance that one may recover randomly from an ailment/debuff applies to this topic as well...

Formula located at: 08124810

Note: 5 or less turns must remain for this chance to be used.

(((Luck * 3) - (Turns * 5) + base_chance) * 655) >= rand()

Random number is 16-bit (Up to xFFFF)
If chance was 100% and you multiplied by 655, you'd get xFFDC.  Evidently, 656 would make x10040.



Base chances of recovering from an ailment, etc:

Attack = 30%
Defense = 20%
Resistance = 20%
Delusion = 30%
Confuse = 60%
Charm = 70%
Stun = 20%
Sleep = 50%
Psy-seal = 30%

I think that's all of them.
Title: Re: Ailment and Debuff Formulas
Post by: Rolina on 28, October, 2012, 01:17:41 AM
Oh, so it's not a flat turn rate?  Intersting...  Thanks for the find.  So luck isn't just ailment resist, it's ailment recovery as well...
Title: Re: Ailment and Debuff Formulas
Post by: Kide on 01, November, 2012, 05:10:47 PM
What about other battle effects that aren't exactly ailments or debuffs, such as 'may inflict double or triple damage' or 'may reduce HP to 1'? I believe those are unaffected by Luck. If so, would you know what are the chances of those happening? That's something I always wanted to know...
Title: Re: Ailment and Debuff Formulas
Post by: Aile~♥ on 01, November, 2012, 06:44:30 PM
All damage multiplying effects are indeed affected by Luck, as is the "HP to 1" effect.
Title: Re: Ailment and Debuff Formulas
Post by: Rolina on 01, November, 2012, 06:53:09 PM
Wait, so all effects, period?  So you can resist the "may do double damage"?
Title: Re: Ailment and Debuff Formulas
Post by: Knight of Purgatory on 01, November, 2012, 07:09:16 PM
I have no idea how the added effects may work, but I think all the "ignores defense", and " may deal triple damage" are affected by your luck only? Or it might be affected less by the enemies luck. No idea tho
Title: Re: Ailment and Debuff Formulas
Post by: Kide on 01, November, 2012, 08:26:01 PM
That's odd. So, Legend and Vengeance against bosses aren't as effective as I recall...

And since Teawater didn't list those, is it possible there's a whole new formula for them?
Title: Re: Ailment and Debuff Formulas
Post by: Aile~♥ on 01, November, 2012, 08:46:29 PM
They certainly do activate a lot, and are indeed effective boss-killers, but it's been my experience that they don't activate as often as it seems like they should against many bosses.

May Ignore 50% of Defence I think has a flat 50% activation rate, though I may be mistaken. The "Ignores Defence" effect is theoretically 100%, but it doesn't seem to be work out that way for me.
Title: Re: Ailment and Debuff Formulas
Post by: Rolina on 01, November, 2012, 08:53:01 PM
If luck does affect these, than a high luck unleash character would be freaking godly...  We've got to figure out how specifically these mechanics work, because if that works for more than just ailments, then it opens up one hell of a lot new options, such as varying degrees of effect activation (May do 2x damage, low rate - May do 2x damage, mid rate - May do 2x damage, high rate, etc)
Title: Re: Ailment and Debuff Formulas
Post by: Aile~♥ on 02, November, 2012, 08:43:53 AM
No, not your own luck, the target's luck. At least, that's what I think. Maybe I'm wrong.

But there are already 2 different versions of the damage multiplying effects which to the best of my knowledge have different effect rates. It seems like the 2x damage and 3x damage effects that appear later in the effect list trigger more often.
Title: Re: Ailment and Debuff Formulas
Post by: Kide on 02, November, 2012, 05:54:05 PM
QuoteIt seems like the 2x damage and 3x damage effects that appear later in the effect list trigger more often.

Exactly. And that's why I believe those effects don't depend on Luck, otherwise there would be distinct base chances for the same effect. (Although that's still possible, but make less sense in my mind...)
Title: Re: Ailment and Debuff Formulas
Post by: Aile~♥ on 02, November, 2012, 08:38:29 PM
Or it could be that the alternate 2x/3x damage effects work the same way effects number 67, 80, and 85 work.

At any rate, the HP to 1 effect is most definitely affected by Luck.
Title: Re: Ailment and Debuff Formulas
Post by: Daddy Poi's Oily Gorillas on 03, November, 2012, 08:07:59 AM
It's unlikely that 2x and 3x damaging effects generate 3 random numbers like those three effects, or else I would have noticed them in that function. I will indeed try to research them in-depth to see how they are different, though.

During my research, it seems like some effects labeled "?" may actually do something..



This is in the Start a turn function.  Most notably includes your action choices. (AKA: Attack, Defend, Item, Psynergy,Djinn, Summon, etc.) It is used during the actual attacks, and not during the selection of the attacks.
Quote from: wordpadCode: 081244F8

65 = May cayse double the damage
41 = ?
42 = May cause double the damage
43 = ?
44 = May cause triple the damage
68 = May cause triple the damage
89 = May multiply damage by 1, 2, or 3


0812451A = Code for effect 89.

Set the R6 value:
08124562 = Code for effects 65 and 68 ; R6 = x99
0812456E = Code for effect 41 ; R6 = x40
08124574 = Code for effect 43 ; R6 = x20

Set the R5 value:
0812457E = Code for effects 65 and 41 ; R5 = 2
08124588 = Code for effect 42 ; R5 = 1

0812458E = R0 = random number
08124592 = Random number is of byte.
08124596 = Checking random number against R6.

stuff...


081245D2 = Code for five effects:
36 = ? ; R5 = x3F (6 bits) 1.5625% chance?
37 = ? ; R5 = x1F (5-bits) 3.125% chance?
38 = ? ; R5 = xF (4-bits) 6.25% chance?
39 = ? ; R5 = x7 (3-bits) 12.5% chance?
40 = ? ; R5 = x3 (2-bits) 25% chance?

0812460E = Random number And R5



08124696 = ? = Calculate_Ailment_Success (Return Boolean)

As for the ailment success function. Effects could be assigned a costant base percent without the formula, or they could be assigned a base percent with the formula, I will look into these specific effects soon to see if they differ.



The unk_arg in the ailment success function I believe is supposed to be used with the "/100" to make a percent. This percent is probably for use with multi-target attacks. ; From center to outside: 100%, 60%, 30%, 30%, 30%, 30%. Atleast in the damage formula, anyway. ; (In the Start A Turn function, I see this value is 100%, but I'm not sure how that one is used, as I think that one may be executed only in certain cases, not sure how it works yet.)
Title: Re: Ailment and Debuff Formulas
Post by: Rolina on 05, November, 2012, 03:38:51 PM
Quote from: Kide on 02, November, 2012, 05:54:05 PM
QuoteIt seems like the 2x damage and 3x damage effects that appear later in the effect list trigger more often.

Exactly. And that's why I believe those effects don't depend on Luck, otherwise there would be distinct base chances for the same effect. (Although that's still possible, but make less sense in my mind...)
It's also why I wondered if caster luck was taken into account for those, despite it not usually being the case.  Maybe some are affected by luck, but others aren't.  Attacks like "May pierce 50% defense" and "May drop HP to 1" this makes sense for, but others, namely the chance for multipliers, it kind of... doesn't.
Title: Re: Ailment and Debuff Formulas
Post by: Salanewt on 21, May, 2014, 10:26:16 AM
Quote from: Teawater on 09, October, 2012, 11:52:55 AM
It looks like there's a part of the code where if defender's luck is 40+, about 8 of the effects are given a chance of 0%. (For example, x18 and x19 (May Inflict Poison/Venom)

Effect's can also have a base chance without a formula (When their numbers are negative ), but when the formula is used (x0-x64), I think it looks like this: Not sure if I made any mistakes.

success =
(((((((Attacker's elemental level - Defender's elemental level) - Floor(Defender's luck / 2)) * 3) + effect's base chance + (vulnerabity's 25)) * unk_arg) / 100)  >= rnd())

Notes:
x52 = "82 - May force target out of battle" is always 0% when class is not NPC. (0% for player characters?)

These generate three random numbers... This would make, for example, a chance of 50% (one) to be 87.5% (three), I think.
x43 = "67 - Inflicts Seal"
x50 = "80 - Inflicts Death Curse"
x55 = "85 - May inflict Stun"

Hopefully I didn't get anything backwards or messed up. I've only looked at the stuff from 080B08C2 and down, but there may be some stuff above this address that may have conditions for when this formula is skipped.

Where attacker and defender labels are placed are just assumed, I didn't double check them, but it wouldn't make much sense otherwise.

Good day! Just a bit curious, but would you mind explaining what "unk_arg" and "floor" mean in this instance? It kind of looks like you were saying that "unk_arg" is an unknown argument that may be related to calculating success rates for multiple enemies and/or the diminishing base damage formula, but it's just a bit too confusing for me to be sure.

It also looks base success rates are not assigned to any ability effect above #85 or below #8, meaning that anything outside of the 8-85 range either has a success rate of 100 (such as attack buffs) or one that is calculated differently (such as revive only working on downed units, etc.); these all branch to the 100% success rate value. Each effect within this range has a pointer that goes to its success rate value, meaning that a lot of them are shared among effects. There are also 16 base success rates. Of course, there are a couple flat duplicates in here, so I'll just list the success rates and provide some examples of effects that use them.

Base success rates (assigned in the function at 080B0514):
080B0660 - 70% (12/13 - Def debuffs)
080B0664 - 75% (16/17 - eRes debuffs)
080B0668 - 30% (22 - Charm)
080B066C - 45% (24 - Sleep)
080B0670 - 55% (18/19 - Poison/Venom, 25 - Seal)
080B0674 - 25% (26 - Haunt)
080B0678 - 20% (27 - Instant Death)
080B067C - 65% (20 - Delusion, HP Drain)
080B0680 - 35% (21 - Confuse, 34 - HP to 1)
080B0684 - Flat 60% (56 - Revive to 50%)
080B0688 - Flat 90% (57 - Revive to 80%)
080B068C - Flat 70% (73 - Revive to 60%)
080B0690 - 60% (8/9 - Attack debuffs, 28 - Curse, 32 - PP Drain, 80 - Curse)
080B0694 - 50% (35 - May ignore 50% of Def)
080B0698 - 40% (23 - Stun, 85 - Stun)
080B069C - Flat 100% (Def buffs, eRes buffs, Regen, Reflect, Break... seems to be the default for anything that either shouldn't fail or has its success rate calculated differently)


One point of interest is that the HP% revives actually seem to have a +10% success rate over the amount they revive you to. So like, 50% revive has a 60% success rate. It's still kind of dumb, but at least this mostly rules out the likelihood of the two being calculated in the same code. These are only base rates of course, so you still need to keep the formula(s) in mind when thinking about this.

So yeah. Hope this helps!

Edit: Teawater pointed out that the revive effects were flat success rates, meaning that they don't actually use the formula at all. Forgot to mention this, so I have tweaked the list to show this.
Title: Re: Ailment and Debuff Formulas
Post by: Daddy Poi's Oily Gorillas on 21, May, 2014, 12:09:14 PM
floor means round-down. So if your defense is 3... 3/2=1.5, 1.5 is rounded down to 1.
ceil would be round-up, but it's not used in this case, so...
round, you already know, (Anything below .5 is rounded down, anything above or equal to .5 is rounded up.)

@unk_arg, I think that's what it is.. Effects that cover over multiple enemies. The target being 100, and every enemy away being a lower number as so. (At least, that's what I think it is?)

(And when I say "argument" I really mean "argument". Because it's coming from the function's argument itself. (If I remember correctly.)


Hm... looks like the revives have flat base rates? If they branch to  080B069E, it's made negative, which cancels the formula.

I wonder if I studied something else on Revive a long time ago? Time to see what it was I was thinking... Edit again: It appears documenting it back then has proven to be useful!
Quote080B0740 = Ability_Effect_Revives(ability_effect) //If effect revives, return 1, else 0.
Title: Re: Ailment and Debuff Formulas
Post by: Salanewt on 21, May, 2014, 12:42:57 PM
Oh yeah! No idea why I didn't realize that before, but I know what that means. Thanks!

"unk_arg" makes sense. I could see it as being 100 for primary targets (or for target:all units), and then declining more the further away the other targets are from the primary target.

I think so, yeah; I should probably edit the previous post to mention that. I'm pretty sure there is a function in the general vicinity of this and the success rate calculation one that has something to do with the revive effects that you looked into.


Edit: Just to make sure, does the elemental level value part of the formula only count the level of the ability in question? Because unless I've failed with my calculation, it kind of looks like instant death (/condemn) can only have a success rate of up to about 58%, and this is if your elemental level is 13, theirs is 0, their luck is 0-1, they are vulnerable to it, and are the primary target. If I did this correctly though, then this means that delude and HP drain have a 103% success rate under similar conditions.
Title: Re: Ailment and Debuff Formulas
Post by: Daddy Poi's Oily Gorillas on 21, May, 2014, 12:50:00 PM
080B07AA = Function call is here.

It's in the same function as the formula, but this is near the beginning of the function. (I forgot what it does, but I do think that it's possible that I may have studied this entire function a long time ago.)

That part pretty much exits the function if you're using a Revive effect when you still have HP. (success=0)


@Your edit:

Elemental level code is at 080B0A08. There are two function calls pointing to the same function:
080B0028 = get_elemental_level(pc,element)

@Instant death
13 *3 = 39 + 20 = 59 + 25 = 84.

I wonder what happens when the ability is a non-element. I think it's a "0" for elemental levels.
Title: Re: Ailment and Debuff Formulas
Post by: Aile~♥ on 21, May, 2014, 01:36:22 PM
I would guess that elemental level for a non-elemental attack is assumed to be either 0 or 5. Either one has the same end result in the calculation.
Title: Re: Ailment and Debuff Formulas
Post by: Daddy Poi's Oily Gorillas on 21, May, 2014, 01:37:49 PM
It's 0. (You are right since x minus x is 0) By the way, I edited my post 5 minutes before you posted. :)
Title: Re: Ailment and Debuff Formulas
Post by: Salanewt on 21, May, 2014, 01:43:57 PM
Oh, whoops. Missed one of the brackets in the formula!

Well that makes it a bit better then. Still not ideal when considering that eLevel differences are usually much smaller and luck levels tend to be somewhere above 0 more often than not, but it's better than I thought. Thanks for pointing that out!
Title: Re: Ailment and Debuff Formulas
Post by: Aile~♥ on 21, May, 2014, 01:52:31 PM
Well, it's even worse than that since there normally isn't more than one spell to inflict any given ailment, and you aren't necessarily likely to have a particularly high elemental level in the element the foe is weakest to. So it's quite difficult to target a boss's weak point with an ailment.
Title: Re: Ailment and Debuff Formulas
Post by: Salanewt on 21, May, 2014, 02:16:24 PM
That's a good point, especially with most ailment abilities being either earth or wind-based. Anyway, I guess I can do one real example then. Dullahan and Dull (let's go with the Pure Mage class).

(((((((5 - 10) - Floor(59 / 2)) * 3) + 60 + (25)) * unk_arg) / 100)  >= rnd())

((-5 - 29) * 3) + 85 >= rnd())
= -102 + 85 >= rnd())
= -17% success rate >= rnd())
= Probably > 0, given that the effective floor is likely not a negative number (unsure) and that the rnd would probably make it a positive value. I think Teawater would have to clarify how the >= rnd()) part works to be sure, since I haven't really researched this stuff much myself.


Unless I horribly messed up again, that's still pretty bad. I'm positive it will still technically work if the RNG likes you enough and lands the effect anyway, it's just that the window for it to do so is really low.
Title: Re: Ailment and Debuff Formulas
Post by: leaf on 21, May, 2014, 02:37:51 PM
Luck is broken =3c

Although I don't see how it could "technically work" if the success rate is being calculated as negative.
Title: Re: Ailment and Debuff Formulas
Post by: Daddy Poi's Oily Gorillas on 21, May, 2014, 02:39:46 PM
@rnd() It amounts to generating a random percent up to like... 99.

The function is at 080B039C. (You'll see the call at the end of the formula.)

Basically, that function generates a random 16-bit number, multiplies by 100, then shifts out 16-bits. Which means you get a random percent from 0x0 to 0x63. ; 0-99 in dec.

0x0000 * 0x64 >> 16 = 0
0xFFFF * 0x64 >> 16 = 0x63

-17 will probably fail everytime?

@leaf: Maybe, maybe not... Maybe status ailments aren't meant to be used on bosses?
Title: Re: Ailment and Debuff Formulas
Post by: Salanewt on 21, May, 2014, 02:58:32 PM
Haha, probably wouldn't work most of the time! I'm just not entirely sure because Eclipse can sometimes lower it's attack (at least from what I remember, may be fuzzy). Kind of makes me wonder if summons maybe bypass elemental levels or something, since that seems to be the only way it would actually work at all.

So I take it that the ">= rnd()" part of the formula basically means that an effect is only guaranteed to work if it's at 99% or higher? Since that's greater/equal to rnd, which can be 0-99.

As far as using status ailments on bosses goes, I don't know. They could have made bosses immune to the deadlier ailments and/or effects without having to rely on luck or the formula to do it at any rate. So like, instead of a 40+ luck check, they could have included an enemy ID check to make a few groups of enemies and/or bosses immune to certain effects and then maybe had a luck check at 90+ or something. :/
Title: Re: Ailment and Debuff Formulas
Post by: Aile~♥ on 21, May, 2014, 03:12:37 PM
The point leaf is making is that that's the minimum possible hit chance (either 0% or 1%) to hit the boss with the ailment it has vulnerability to, and that's not even with capped Luck. Plus, that's the only class that gets access to Dull to the best of my knowledge, anyway.

Eclipse could theoretically have a debuff rate on Dullahan if being summoned by a Wind Adept character with 9 Jupiter Djinn set. (So Sheba summons Eclipse while Ivan supplies the Jupiter Djinn for the summon, for example.)

(((((((14 - 10) - Floor(59 / 2)) * 3) + 60 + (25)) * 100) / 100)  >= rnd())
= ((4 - 29) * 3) + 85 >= rnd()
= -75 + 85 >= rnd()
= 11% success rate if you can roll 0.

In fact, you actually require a Jupiter elemental level of 11 to have a 2% chance of dropping Dullahan's attack. (Again, that's assuming the percentile die used to calculate effect rate can roll 0.)
Title: Re: Ailment and Debuff Formulas
Post by: leaf on 21, May, 2014, 03:32:54 PM
Except... I'm pretty sure I've had eclipse drop dullahan's atk even without that, with only one set of jupiter djinn in the party. In fact, from what I remember, it's a fairly consistent drop.

Are we sure that we're not missing something here?
Title: Re: Ailment and Debuff Formulas
Post by: Salanewt on 21, May, 2014, 03:43:50 PM
Wooh, I knew there was a way to lower his attack! Thanks for pointing out the Jupiter djinn on Jupiter adept thing!

It's hard to say really. Do you remember other summons landing their effects more often? Since, I mean, if strategies against Dullahan that use Eclipse are as common as I think, then this formula wouldn't really make a whole lot of sense in that context.


[spoiler=Theoretical Rebalance]So uh, yeah. I get the feeling that, if one were to divide luck by 4 rather than 2 and buff the right luck values a bit, the ailment formula would be pretty balanced. Ability effects would be more useful without actually changing a whole lot, and super bosses like Dullahan could be given higher luck values to lower the impact of debuffs and ailments slightly. In fact, you could go a step further and increase the amount of luck needed for the poison/curse/death ailment immunity without worrying a whole lot about breaking them.


Example:
(((((((14 - 10) - Floor(96 / 4)) * 3) + 60 + (25)) * 100) / 100)  >= rnd())
= ((4 - 24) * 3) + 85 >= rnd()
= -60 + 85 >= rnd()
= 25% success rate.[/spoiler]
Title: Re: Ailment and Debuff Formulas
Post by: Aile~♥ on 21, May, 2014, 03:52:23 PM
It's possible that Eclipse's secondary effect chance is hardcoded to be different, or that the Vulnerability value is different for summons. Or that we have some parentheses in the wrong places. Or that secondary effect rate diffusion (the unk_arg value) is different depending on damage type, and may be set to something like 120, 125, or even 150 for the primary target of a summon.

It's also possible that the Vulnerability changes the multiplier after (eMod - Luck / 2) is calculated, so instead of a *3 it might be a *2.5 or even *2. I don't know anything about this stuff, so you'd have to ask Teawater.

@Sala: Dividing Luck by 4 seems a bit much, as you just demonstrated. 96 Luck and you still have a 25% chance to ailment him. Yes, it's a vulnerability, but that's still 96 freakin' Luck! Maybe divide it by 3?
Title: Re: Ailment and Debuff Formulas
Post by: Salanewt on 21, May, 2014, 04:27:46 PM
I don't know, either or could probably work. The downside to dividing by three is that keeping the same luck rate as the previous incarnation drops the rate down to 1%. Plus it is Dullahan.

Lowering luck to about 75 (which seems like a fair value for a bonus boss), we get:

[spoiler=/3](((((((14 - 10) - Floor(75 / 3)) * 3) + 60 + (25)) * 100) / 100)  >= rnd())
= ((4 - 25) * 3) + 85 >= rnd()
= -63 + 85 >= rnd()
= 22% success rate.[/spoiler]

Which isn't terrible, but then it still drops substantially if you don't stockpile all of your djinn onto your mono-elemental adept either way. If assuming vanilla classes and you go into Pure Mage, however:

[spoiler=/3 Vanilla Pure Mage](((((((5 - 10) - Floor(75 / 3)) * 3) + 60 + (25)) * 100) / 100)  >= rnd())
= ((-5 - 25) * 3) + 85 >= rnd()
= -9 + 85 >= rnd()
= -5% success rate.[/spoiler]

Then we're more or less at the same point as before, just with typically higher rates for common enemies. If we redo the /4 formula for Pure Mage (with a lower luck value):

[spoiler=/4 Vanilla Pure Mage](((((((5 - 10) - Floor(72 / 4)) * 3) + 60 + (25)) * 100) / 100)  >= rnd())
= ((-5 - 18) * 3) + 85 >= rnd()
= -69 + 85 >= rnd()
= 16% success rate.[/spoiler]

Then using Dull on Dullahan actually becomes possible, as would delude and whatnot.  Plus, if it weren't for that +25% vulnerability, then all four of these examples would fail anyway.
Title: Re: Ailment and Debuff Formulas
Post by: Daddy Poi's Oily Gorillas on 27, January, 2015, 07:23:50 PM
Quote from: Me on first page of this topicIt looks like there's a part of the code where if defender's luck is 40+, about 8 of the effects are given a chance of 0%. (For example, x18 and x19 (May Inflict Poison/Venom)


Quote from: From Plexa's PastebinQ: I saw you sleep-lock the Avimander and King Scorpion, I thought you couldn't do that?
A: Aha! The GS wikis will have you believe that 40 luck makes bosses immune to status conditions (and thus only the Chest Beaters and Moapa's knights are able to be afflicted with status conditions) but this isn't quite correct. The 40 luck = immunity seems to hold in the original golden sun, but in GS2 an amazingly helpful guy by the name of VanishMantle (http://www.twitch.tv/vanishmantle) discovered that there's actually separate status vulnerability portions of code for each of the bosses in the game. What this means is that bosses can be weak to certain status conditions or be susceptible to status conditions despite having 40 luck.

A great example of this is Moapa who has 40 luck, his knights which have 37 and the Avimander who has 41. It isn't hard to work out that Moapa is immune to all status conditions, while his knights (with 3 less luck) are rather prone to stuns and sleep. Very clearly, the Avimander is susceptible to sleep as well despite having the highest luck rating of all three. This illustrates that status vulnerability has other factors than just luck (otherwise Avimander would be immune) and the discovery that VanishMantle made.


^So I was browsing the pastebin, saw this post, and remembered that I never documented the first part of that function, did I? Maybe we should go and list the exceptions when the 40 luck cap/formula isn't used.

080B0782 = 100% chance to Ignore Defense for enemies in 080C6B18
080B06C8 = 100% chance to Trident for enemies in 080C6B76
080B07A8 = 0% chance if effect revives and you have HP.
080B07BE = 0% chance to cure poison if you're not poisoned. (Status effect 0x3)
Branch to 080B0808.
----
080B07D6 = 0% if not infected with Stun, Sleep, Psy-seal, or  ( 02000B91 = Turns until downed. ; Death Curse) (If any are 0, branches to 080B0832)
080B0808 = 0% if not infected with Delusion, (?), (?) (Status effect 0x4) (Will branch to above if all 0)

080B0832 = 0% if not infected with effects that are for status effect 64. (0x40 ; "Remove all status ailments")
080B08AC = 0% if ( 028=May inflict Death Curse) is 1 turn...

And then after that... is where the luck cap comes in.


---
It could be that this function isn't called for some bosses, though? (Either that, or it is called, but the boss weaknesses stuff could just be inserts in the damage function?) ; I'll need to do some research on the damage function, most likely. And I shall list them here, I guess.
Title: Re: Ailment and Debuff Formulas
Post by: Plexa on 28, January, 2015, 04:31:42 AM
Very interesting, I look forward to your result. Unfortunately I dont have any experience with the Aqua Hydra as he's a skippable boss :) I strongly suspect that all bosses in the Eastern Sea aside from Serpent/Poseidon can be afflicted by status conditions, or at least some status conditions.
Title: Re: Ailment and Debuff Formulas
Post by: Daddy Poi's Oily Gorillas on 28, January, 2015, 02:34:00 PM
Before I do a more thorough scan, though, can we be 100% sure that VanishMantle was correct about there really being separate sections of code for boss vulnerabilities?

The eight effects that get a 0% chance when the target has 40+ luck were these:

(Number in decimal so people can look them up in Atrius's Editor.)
18 = May inflict Poison
19 = May inflict Venom
26 = May inflict Haunt
27 = May inflict Death
28 = May inflict Death Curse
34 = May reduce HP to 1
80 = May inflict Death Curse
82 = May force target out of battle

Sleep and other status ailments/effects do not use the 40 luck cap.

You can set up to three status effects to be more vulnerable in the enemy editor of Atrius's Editor. (The ones labeled as unknown, but the fourth "unknown" in that row isn't used.) Avimander has one for Sleep, so he's 25% more vulnerable to sleep,
Title: Re: Ailment and Debuff Formulas
Post by: VanishMantle on 28, January, 2015, 05:48:52 PM
Hey just figured I would chime in about this. It is something I noticed more with TLA and balancing things for a difficulty patch, Risen Star, that I was working on. I noticed that a number of bosses no matter what I set their luck value to would still get hit with a status once inflicted they seemed like others hit them more easily. My original thought is that in TLA something else must factor into  what makes something immune or not. Thus the there must be something else that controls it. Which was my "there could be something else that controls it" I did not mean for it to a be a defined but that there could be since I could not explain why it was so.

My theory from hours of testing and scanning was that even if something is at "0" there is no pure zero and the boss could still be hit with a status affect. Again all pure conjecture on my part with hours of testing and such. Along with hours of frustration as playtesters destroyed bosses in my mod.

Again I wasn't sure because on bosses that should have been immune to poison I somehow could poison or could hit with other ones that should be a 0% chance.

Chances are I was mistaken about the formulas and code
Title: Re: Ailment and Debuff Formulas
Post by: Daddy Poi's Oily Gorillas on 28, January, 2015, 11:47:30 PM
Interesting. You can poison bosses that have 40+ luck?

Definitely worth looking into... Might be faster if someone provided a savestate of where a status effect would work when it is not supposed to. (Preferably before the "attack".)
Title: Re: Ailment and Debuff Formulas
Post by: VanishMantle on 29, January, 2015, 04:16:24 AM
I sadly don't have any save states but I know a lot of my play testers did some rather odd things to bosses. Again I am not sure if it was just a patch issue, or how the game handles RNG. IE if it stores the chance of success in a specific number then it looks to see if it matches that but again I am not 100% sure.

I just know it was a nightmare trying to make TLA difficult with the bosses without the status affects screwing with stuff. If it can happen I would say it will be a while for me to replicate in any sort of way that could be useful.

As stated though I could just be derping super hard and not have checked the boss's Luck was at 40+ or whatever.
Title: Re: Ailment and Debuff Formulas
Post by: Plexa on 29, January, 2015, 06:39:08 AM
In my experience, in TLA I haven't been able to poison anything with 40+ luck (then again there are surprisingly few things that can inflict poison in the speedrun route). Nor have I been able to inflict instant death, which I've done a lot of in GS1.