Final Fantasy Hacktics

Modding => PSX FFT Hacking => Topic started by: Eternal on January 22, 2012, 06:10:32 pm

Title: ASM Request: Stat Down Skills Accept Element
Post by: Eternal on January 22, 2012, 06:10:32 pm
Exactly what it says on the box, folks. I'm requesting that formulas 15, 1A, 1D, 2B, 55, and 56 accept elements- namely Dark- so that bosses can be immune to them. Not sure how difficult this would be to do, but I'm sure it can benefit quite a few folks.
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Pickle Girl Fanboy on January 26, 2012, 11:47:07 am
It makes more sense for stat changes to decay back to their original values over a period of time.  That's the hack I'd request, since it fixes all the problems with stat buffs (Yell, Accumulate, Reactions) and debuffs (SP Break, PA Break, Dances).

They should decay back to their original values at a rate of 1 point every (n) clockticks, where the modder decides what (n) is.  This will also require a fix for A Save, which IIRC increments the original stat value, though this change isn't kept after battle.

Think about it: no more Yell SCC, no more run away/Accumulate/1HKO, no more easy equipment stealing/farming, no more 5 Dancer/5 Bard kill squad, and it will FINALLY fix (as in unbreak) Speed Save.
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: RavenOfRazgriz on January 26, 2012, 01:36:56 pm
Quote from: Eternal248 on January 22, 2012, 06:10:32 pm
Exactly what it says on the box, folks. I'm requesting that formulas 15, 1A, 1D, 2B, 55, and 56 accept elements- namely Dark- so that bosses can be immune to them. Not sure how difficult this would be to do, but I'm sure it can benefit quite a few folks.


I would like these Formulae accepting various elements too.  I cannot imagine it being very hard at all, since it's just read hit rate, modify XA (except with Cancel, which sets it to 0), and these routines are already encapsulated somewhere.

Quote from: Pickle Girl Fanboy on January 26, 2012, 11:47:07 am
It makes more sense for stat changes to decay back to their original values over a period of time.  That's the hack I'd request, since it fixes all the problems with stat buffs (Yell, Accumulate, Reactions) and debuffs (SP Break, PA Break, Dances).

They should decay back to their original values at a rate of 1 point every (n) clockticks, where the modder decides what (n) is.  This will also require a fix for A Save, which IIRC increments the original stat value, though this change isn't kept after battle.

Think about it: no more Yell SCC, no more run away/Accumulate/1HKO, no more easy equipment stealing/farming, no more 5 Dancer/5 Bard kill squad, and it will FINALLY fix (as in unbreak) Speed Save.


I don't think you realize how improbable something like this would be to code, and how counterintuitive it would be for the player as it probably wouldn't display anything when your stat decrements back down.

This also wouldn't "fix" Speed Save much.  You don't need 40 Speed.  You really only need to get 3-4 points, which is pretty easy to do off an R-Ability.  If you're building more Speed than that, you're an idiot.
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Pickle Girl Fanboy on January 26, 2012, 02:09:29 pm
Basically, I'm requesting a hack that gives certain stat changes a CT, just like status effects.  The wiki shows that the game keeps track of both original SP/PA/MA and Current SP/PA/MA.

http://ffhacktics.com/wiki/Formula_Hacking

Quote# 0x0030 Original PA
# 0x0031 Original MA
# 0x0032 Original SP
# 0x0033 PA bonus from items & ?? (?)
# 0x0034 MA bonus from items & ?? (?)
# 0x0035 SP bonus from items & ?? (?)
# 0x0036 PA // Shouldn't this be Current PA?
# 0x0037 MA // Shouldn't this be Current MA?
# 0x0038 SP // Shouldn't this be Current SP?


As for the animation, you're right, we probably can't add a "(SP/PA/MA) decays 1 Point!" dialog along with the -1 SP/PA/MA symbol (which should be the correct color).  Not yet, at least.  But once someone disassembles and documents the routines that do this, we should be able to add this in.

I bet that FDC already encountered these routines, while moving the checks for various things to the AI flags.  I'm further betting that he already linked several of these routines to the AI flags.  It shouldn't be that much of a stretch to give stat deviations from original stat values a CT, and then to link the  -1 (stat) symbol's appearance to the triggering of the stat change decay.

I imagine it has some of the difficulties of creating a new status effect slot, since it requires most of the same things.  Namely, a CT and a link to an symbol, along with whatever is required to code the if(then,otherwise).

EDIT

Just thought of something.  This could be a way to create a "Regenerate (n) MP every turn or every (x) clockticks" hack.  Since the game keeps track of both the max MP and current MP, you could code something that checks if a unit's max MP = current MP, and if it doesn't then increment current MP by a static amount, or a % of original MP every (n) clockticks, or at the beginning of every unit's turn.  It might be a good idea not to show the increase, since it would slow the game down - unless you did it along it's own, individual CT, like the Dance and Sing moves, and have static changes to everyone which show all at once.

Or I could be totally talking out my ass.
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Pride on January 26, 2012, 02:34:18 pm
"Original" in that context completely misleading. It is the units RAM PA/MA/SP before boosting equipment is added. Abilities or Reactions that increase those stats will still affect the "original" value. So the game does not keep track of those stats at their original value. It recalculates the units stats at the end of a battle by their raw value.
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Glain on January 26, 2012, 02:40:41 pm
Argh. Why does anything ever not accept elements? Does that even make sense? I mean, you can flag an ability as non-elemental if that's what you want. The element check, and everything that goes along with it (cancel/half/weak/absorb/etc), should really be done at the end of the formula after damage is already calculated. Not to mention all the XA modification stuff (strengthen, etc) is ridiculous and should be applied to the final damage and not the XA. As it stands (for the original post) this is 6 separate hacks and probably none of the formulas have enough space, so they'd all have to be rewritten in kanji space. It seems like the right way to do this is to rewrite the entire formula section... which FDC is already doing.

PGF, your proposed change would probably require wading through tons of ASM that hasn't been documented in BATTLE.BIN and trying to figure out what it all does. Then, you'd need variables for every unit (counters) to determine what phase of the stat decrement you're currently on. Where do those go? Then, you'd need to write custom code for the code to handle all of that, which has to be put somewhere (kanji space?) How much space do we have? Space space space. Not to mention you'd have to jump to new code in tons of different routines and handle all the logistics of doing that and jumping back while preserving register values. Let's just say it wouldn't be a ton of fun.

Plus with what Pride says about the original values not being stored, you'd have to put those somewhere too (for each unit). More space, woo!
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: RavenOfRazgriz on January 26, 2012, 02:48:05 pm
Quote from: Glain on January 26, 2012, 02:40:41 pm
Argh. Why does anything ever not accept elements? Does that even make sense? I mean, you can flag an ability as non-elemental if that's what you want. The element check, and everything that goes along with it (cancel/half/weak/absorb/etc), should really be done at the end of the formula after damage is already calculated. Not to mention all the XA modification stuff (strengthen, etc) is ridiculous and should be applied to the final damage and not the XA. As it stands (for the original post) this is 6 separate hacks and probably none of the formulas have enough space, so they'd all have to be rewritten in kanji space. It seems like the right way to do this is to rewrite the entire formula section... which FDC is already doing.


Final damage on basically ALL THE MULTIPLIERS is another aspect of FDC's Formula Hack I basically forced him to do at gunpoint.  With floating-point multiplication.  ALL THE ROUNDING is abolished.  Granted, this (making these formulae accept Elementshit) is still kind of a big thing for a lot of people in making stat manipulation something that can exist in the game without it being horribly derp.

Quote from: Glain on January 26, 2012, 02:40:41 pmPGF, your proposed change would probably require wading through tons of ASM that hasn't been documented in BATTLE.BIN and trying to figure out what it all does. Then, you'd need variables for every unit (counters) to determine what phase of the stat decrement you're currently on. Where do those go? Then, you'd need to write custom code for the code to handle all of that, which has to be put somewhere (kanji space?) How much space do we have? Space space space. Not to mention you'd have to jump to new code in tons of different routines and handle all the logistics of doing that and jumping back while preserving register values. Let's just say it wouldn't be a ton of fun.

Plus with what Pride says about the original values not being stored, you'd have to put those somewhere too (for each unit). More space, woo!


You used a lot more words to describe this than I would have given a fuck to.  You'd need at least 5 CTs, tons of space to actually write the "decaying" code, more room to copy over all the Raw stats for every unit in the fight before it begins, a way to adjust those Raw stats when gear is swapped or broken, etc... 

Tl;dr this ain't fuckin' happening, PGF.
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Pickle Girl Fanboy on January 26, 2012, 03:01:57 pm
lol I'm goin down!

Seriously though, I know I saw somewhere - probably during the discussion about changing the Unarmed Attack formula to (original PA * current PA) * (Brave / 100) - that someone mentioned A Save increments original PA.  My erroneous belief that the game tracks original SP/PA/MA led to the flash of inspiration which begat my posts.

Since your SP/PA/MA aren't updated when you level up in battle, but only after battle, I should've known that the game doesn't track pre-raw, raw, or original SP/PA/MA.  The posts in the unarmed attack formula hack topic screwed me up.

Oh well.  Something else for tethical to do right the first time.

EDIT

I also should have noticed that original refers to the stat before the equipment-based stat bonuses, which change the hardcoded minimum stat to the minimum plus the equipment bonus; since it's impossible to remove those bonuses unless you remove the equipment.
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Choto on January 26, 2012, 05:56:05 pm
As a consolation, I believe FDC was implementing a cap at stat growth somewhere, which shouldn't be painful at all to code as you could probably integrate it into the formula rewrites. This will at least prevent most of the stat abuse. Then again I could be wrong
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: RavenOfRazgriz on January 26, 2012, 06:25:42 pm
Quote from: Choto on January 26, 2012, 05:56:05 pm
As a consolation, I believe FDC was implementing a cap at stat growth somewhere, which shouldn't be painful at all to code as you could probably integrate it into the formula rewrites. This will at least prevent most of the stat abuse. Then again I could be wrong


Xifanie wrote that.  It's completely independent of the Formula Hack for various reasons.
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Choto on January 26, 2012, 06:32:35 pm
Quote from: RavenOfRazgriz on January 26, 2012, 06:25:42 pm
Xifanie wrote that.  It's completely independent of the Formula Hack for various reasons.


Doh, my bad. Thats why I included the disclaimer at the end. Where is that hack? I didn't see it in her hack thread.
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: RavenOfRazgriz on January 26, 2012, 06:35:40 pm
It's in the thread somewhere, as I recall.  It's just not included in the OP.  I have no idea why it's not.  ARH 1.1 isn't in her OP either, as I recall.
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Choto on January 26, 2012, 07:32:13 pm
Found it, for those interested, this was from Xifanie:

Stat gain/break cap + Maintenance prevents stat break
WW/XX = Lower Limit which the stat can be reduced.
YY/ZZ = Upper Limit which the stat can be raised.
For example, a lower limit of 1/3 and a upper limit of 1/4 for someone with 18PA, would be:
lower cap: 18PA - (18PA * 1/3) = 12PA
upper cap: 18PA + (18PA * 1/4) = 22PA
This hack takes full consideration of equipment.

BATTLE.BIN
0x000EDB8C
77777777
77777777
77777777
77777777
77777777
984B6DAC
9C4B6EAC
1980033C
CC086324
2218A300
C0010434
1A006400
10300000
D0FFC724
0300EA2C
2230A600
03000210
00000000
FC520508
21400901
9100CB90
04006B31
02000B14
00000000
22400901
3A000A10
00000000
2150C700
36004B91
30004A91
22706A01
0300CA90
30000D34
1800AA01
12500000
06800C3C
21604C01
03000714
01000D34
0300C624
02008C25
0300A715
00000000
0600C624
04008C25
CA108A91
7800CC90
7900CD90
006A0D00
2160AC01
7A00CD90
006C0D00
2160AC01
18004C01
12600000
19000B3C
1A008B01
12600000
2538C001
21708E01
WW000A34
XX000C34
18004E01
12500000
1A004C01
12500000
2250CA01
22504701
YY000B34
ZZ000C34
18006E01
12580000
1A006C01
12580000
2158CB01
22586701
2A680A01
02000D10
00000000
25404001
2A686801
02000D10
00000000
25406001
1580033C
8C4B6A8C
904B6B8C
944B6C8C
984B6D8C
9C4B6E8C
63000634
6B350608
01000734

BATTLE.BIN
0x00126598
1580033C
8C4B6AAC
904B6BAC
E8520508
944B6CAC

Does this mean that if you have an item that gives +X PA, and it gets broken, and the decrease would bring it below the cap, it would stay at the cap instead of falling lower? run on sentences ftw
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Pickle Girl Fanboy on January 27, 2012, 11:43:36 am
What does it mean by "Considers Equipment?"  Explanation requested.
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Rfh on February 10, 2012, 04:47:25 pm
Choto, Can you post the only part of the hack ''Maintenance prevents stat break''
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: RavenOfRazgriz on February 11, 2012, 02:22:13 am
Still pushing for someone to actually fulfill Eternal's request here.  The Stat Break Limitation hack is a sub-par answer because there's no player-end feedback for knowing when the "cap" on either side was reached, and according to Austin it apparently has quite a few bugs anyway in terms of both function and display.
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Glain on February 11, 2012, 12:29:12 pm
Does anyone know if calling elemental cancel (0x00186ff8) at the end of a routine that does something other than damage would work, or would we have to slog through "Is the element cancelled? Branch to somewhere where we don't perform the action!"?
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Glain on February 14, 2012, 05:09:33 pm
How about a universal elemental-cancel hack, or even a broader universal elemental-everything hack? Any reason not do it that way?
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: RavenOfRazgriz on February 14, 2012, 07:12:44 pm
Quote from: Glain on February 14, 2012, 05:09:33 pm
How about a universal elemental-cancel hack, or even a broader universal elemental-everything hack? Any reason not do it that way?


I can't think a reason not to.  Can you do a pair of universal status routine too, one regular and one 2D-ified?  Just grab any flag that seems unused and set it as a flip-switch.  I mean, fuck, may as well go the whole nine yards if you're gonna do it.  I assume this'll also have the Weapon Strike fix built-in too, with that random unused flag being used as the on-off switch for weapon element. 

Tl;dr - Do everything, do it right the first time.
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Glain on February 14, 2012, 07:51:07 pm
Nah, I'm not looking to do any of the other stuff here; too messy. The only thing I'm thinking about doing is adding the call to 0x00186ff8 to the routine that calls the formulas, right after the formula call. Except now that I've investigated it, I think "apply elemental" is a better name than "elemental cancel". It's got control statements for half/weak/cancel/absorb, multiplies "weak" damage by 2, halves "half" damage, etc, and nullifies "cancel" actions (sets them to 0% hit among other things).

It even checks to see if you have oil status and multiplies XA by 2 for fire abilities, but I think where I call it, it's gonna be too late for that, because we've already calculated damage, unless I hack it to just modify the final damage.
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Pride on February 14, 2012, 08:07:08 pm
Yeah its too late, that's why Oil doesn't work in vanilla. Its an easy enough fix.
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Glain on February 14, 2012, 08:48:12 pm
Hm... with the hack as it stands, weak and half can get reapplied (for a total of 1/4 * damage or 4 * damage).
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Pride on February 14, 2012, 09:19:23 pm
Can you post it here? We can take a look together and see if there's an easy way to fix it
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Glain on February 14, 2012, 09:23:19 pm
The only thing I did was change the formula-calling routine's return statement into a tail call of the apply elemental function.
(RAM 0x18b9f0: "jr r31" -> "j 0x00186ff8")

The problem is, various formulas do the half/weak calculation themselves, whereas other ones probably rely on 0x186ff8 to do it. I could hack 0x186ff8, but I'd have no way to know whether the half/weak has already been applied...
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Glain on February 15, 2012, 07:06:26 pm
All right. I nop'd out all other calls to the apply elemental routines and rewrote part of it to do absorption correctly. We shouldn't be seeing any more x4 or /4. This time I've got a patch... try it out? (Back up ISO, heh)


<Patch name="All formulas apply elemental">
    <Description>All formulas apply elemental</Description>
    <Location file="BATTLE_BIN" offset="1249F0">
      FE1B0608
    </Location>
    <Location file="BATTLE_BIN" offset="11FFE0">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="121794">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="121E2C">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="122D20">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="12361C">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="F5C78">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="11DF1C">
      1980083C
      902D098D
      8C2D0A8D
      04002B95
      00000000
      43580B00
      04002BA5
      06004BA5
      00000000
      00000000
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="11DF64">
      1980083C
      902D098D
      8C2D0A8D
      10002395
      04002485
      00086334
      40200400
      100023A5
      040024A5
      060044A5
    </Location>
  </Patch>
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Austin on February 17, 2012, 04:32:18 pm
Just tried testing this really fast, I made the knight break skills dark elemental and made my chemists immune to dark. It looks like it works mostly, you get a 00% hit chance and the chemists always dodge the attacks. However, when it would activate their reaction ability afterwards it would always miss. Like they could have sunken state and go to activate it, but it would say it missed and they wouldn't turn invisible.
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Glain on February 19, 2012, 06:45:33 pm
For some reason, the Sunken State reaction doesn't appear to reset the ability's element (0x801938f7), so since the attack was Dark elemental, it thought the reaction was also Dark elemental. I was under the impression the ability element was always set when an action was taken...

I'm not sure how Sunken State got around it... maybe it's hardcoded or something?
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Austin on February 19, 2012, 09:12:09 pm
Dunno, it's not just sunken state though. Any kind of reaction that would activate on the person being hit would miss. Not that I tried every single one, but I imagine that's the case from the few I did try.
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Glain on February 20, 2012, 09:59:29 am
I think my strategy for fixing this is going to be to set the ability element byte back to 00 (non-elemental) after doing the apply elemental calculation; that way, if an ability sets its element, it'll get that element, otherwise it'll be non-elemental.

The other thing I'm curious about is whether weapon element is working for things like normal attacks, since I'm not checking the element of the weapon, but the element of the ability. If not, I might have to do something like the swordskill hack to determine the element to use. I may also be able to put strengthen in there and fix oil as well...
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Glain on February 20, 2012, 10:16:09 pm
All right, here's version 2 of the patch. I don't have strengthen in yet and oil isn't fixed, but weapon element on attack should work and counters shouldn't take the element of the attack that triggered them anymore.


  <Patch name="All formulas apply elemental">
    <Description>All formulas apply elemental</Description>
    <Location file="BATTLE_BIN" offset="1249F0">
      FE1B0608
    </Location>
    <Location file="BATTLE_BIN" offset="11FFE0">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="121794">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="121E2C">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="122D20">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="12361C">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="F5C78">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="11DF1C">
      1980083C
      902D098D
      8C2D0A8D
      04002B95
      00000000
      43580B00
      04002BA5
      06004BA5
      00000000
      00000000
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="11DF64">   
      1980083C               
      902D098D
      8C2D0A8D
      10002395
      04002485
      00086334
      40200400
      100023A5
      040024A5
      060044A5
    </Location>
    <Location file="BATTLE_BIN" offset="120010">
      4C73050C
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="F5D30">
      1980083C
      F3380995
      F7381091
      04390C91
      D6380D91
      04200A34
      24582A01
      05006A11
      00000000
      0300A011
      00000000
      5A730508
      00000000
      25800C02
      0800E003
      F73800A1
    </Location>
  </Patch>
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Glain on February 21, 2012, 09:52:15 pm
All right... now I've got a patch that seems pretty good.

Strengthen/absorb/half/weak/cancel should all work and reactions shouldn't take the wrong element. Oil should also work (Fire damage is * 2). I don't modify XA for any of this stuff either; it all just straight-up modifies HP damage, so for example, strengthen is trunc((damage) * (5/4)) instead of trunc(XA*5/4)*Y. Since the truncation comes at the end, the math should be more accurate. I'm even making an attempt to round the division at the end in the case of strengthen.

e.g. Normally XA=6, WP=8 damage with strengthen on the caster and half on the target
Original FFT: 6 * (5/4) = 7 (truncated); 7 * 8 = 56; 56 / 2 = 28
This patch/Real math: 6*8=48; half=24; strengthen=24*(5/4) = 30

Anyhow, here it is.


  <Patch name="All formulas apply elemental">
    <Description>All formulas apply elemental</Description>
    <Location file="BATTLE_BIN" offset="1249F0">
      FE1B0608
    </Location>
    <Location file="BATTLE_BIN" offset="11FFE0">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="121794">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="121E2C">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="122D20">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="12361C">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="F5C78">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="11DF1C">
      1980083C
      902D098D
      8C2D0A8D
      04002B95
      00000000
      43580B00
      04002BA5
      06004BA5
      00000000
      00000000
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="11DF64">   
      1980083C               
      902D098D
      8C2D0A8D
      10002395
      04002485
      00086334
      40200400
      100023A5
      040024A5
      060044A5
    </Location>
    <Location file="BATTLE_BIN" offset="120010">
      4C73050C
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="F5D30">
      1980083C
      F3380995
      F7381091
      04390C91
      D6380D91
      04200A34
      24582A01
      05006A11
      00000000
      0300A011
      00000000
      5A730508
      00000000
      25800C02
      043900A1
      0800E003
      F73800A1
    </Location>
    <Location file="BATTLE_BIN" offset="11DEB8">
      1980033C
      902D638C
      6873050C
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="F5DA0">
      1980083C
      902D0E8D
      8C2D098D
      40000F34
      80000A34
      0400CD95
      06002B95
      0400C0A5
      2500CFA1
      0600CDA5
      060020A5
      25002AA5
      0800E003
      04002BA5
    </Location>
    <Location file="BATTLE_BIN" offset="11DF50">
      8073050C
    </Location>
    <Location file="BATTLE_BIN" offset="F5E00">
      1980083C
      942D0E8D
      902D098D
      7100CE91
      8C2D0C8D
      2470C501
      0800C011
      04002A95
      05000B34
      18004B01
      12680000
      0200AD21
      83680D00
      04002DA5
      06008DA5
      0800E003
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="12002C">
      1980033C
      902D638C
      00000000
      04006284
      00000000
      40100200
      040062A4
      22006290
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="1200FC">
      0800E003
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="11EFA4">
      0800E003
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="120060">
      00000000
      25008890
      00000000
      08000835
      250088A0
    </Location>
  </Patch>


Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Atma on February 22, 2012, 02:43:25 am
i was thinking... having stats as a status is a pretty cool idea.  However, i kinda think it's kind of an odd effect.  It could stack, which is neat, but only until it runs out, or would it reapply and replace, or add up?
it's a little weird to me.  What would make sense is a status kind of like faith+innocent, but % based like magic attack up/magic defense up.  if it were possible to also make a negative effect, like magic attack -25%.  Of course the same for physical attack and defense.  I dunno if u'd have to replace existing statuses, but i could easily find a few i wouldn't mind replacing for cool buff/debuff skills. 
how possible is this?
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Pride on February 22, 2012, 11:55:41 am
it would be fairly easy
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Austin on February 22, 2012, 09:53:27 pm
Quote from: Glain on February 21, 2012, 09:52:15 pm
All right... now I've got a patch that seems pretty good.

Strengthen/absorb/half/weak/cancel should all work and reactions shouldn't take the wrong element. Oil should also work (Fire damage is * 2). I don't modify XA for any of this stuff either; it all just straight-up modifies HP damage, so for example, strengthen is trunc((damage) * (5/4)) instead of trunc(XA*5/4)*Y. Since the truncation comes at the end, the math should be more accurate. I'm even making an attempt to round the division at the end in the case of strengthen.

e.g. Normally XA=6, WP=8 damage with strengthen on the caster and half on the target
Original FFT: 6 * (5/4) = 7 (truncated); 7 * 8 = 56; 56 / 2 = 28
This patch/Real math: 6*8=48; half=24; strengthen=24*(5/4) = 30

Anyhow, here it is.


  <Patch name="All formulas apply elemental">
    <Description>All formulas apply elemental</Description>
    <Location file="BATTLE_BIN" offset="1249F0">
      FE1B0608
    </Location>
    <Location file="BATTLE_BIN" offset="11FFE0">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="121794">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="121E2C">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="122D20">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="12361C">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="F5C78">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="11DF1C">
      1980083C
      902D098D
      8C2D0A8D
      04002B95
      00000000
      43580B00
      04002BA5
      06004BA5
      00000000
      00000000
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="11DF64">   
      1980083C               
      902D098D
      8C2D0A8D
      10002395
      04002485
      00086334
      40200400
      100023A5
      040024A5
      060044A5
    </Location>
    <Location file="BATTLE_BIN" offset="120010">
      4C73050C
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="F5D30">
      1980083C
      F3380995
      F7381091
      04390C91
      D6380D91
      04200A34
      24582A01
      05006A11
      00000000
      0300A011
      00000000
      5A730508
      00000000
      25800C02
      043900A1
      0800E003
      F73800A1
    </Location>
    <Location file="BATTLE_BIN" offset="11DEB8">
      1980033C
      902D638C
      6873050C
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="F5DA0">
      1980083C
      902D0E8D
      8C2D098D
      40000F34
      80000A34
      0400CD95
      06002B95
      0400C0A5
      2500CFA1
      0600CDA5
      060020A5
      25002AA5
      0800E003
      04002BA5
    </Location>
    <Location file="BATTLE_BIN" offset="11DF50">
      8073050C
    </Location>
    <Location file="BATTLE_BIN" offset="F5E00">
      1980083C
      942D0E8D
      902D098D
      7100CE91
      8C2D0C8D
      2470C501
      0800C011
      04002A95
      05000B34
      18004B01
      12680000
      0200AD21
      83680D00
      04002DA5
      06008DA5
      0800E003
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="12002C">
      1980033C
      902D638C
      00000000
      04006284
      00000000
      40100200
      040062A4
      22006290
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="1200FC">
      0800E003
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="11EFA4">
      0800E003
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="120060">
      00000000
      25008890
      00000000
      08000835
      250088A0
    </Location>
  </Patch>





Awesome! I'm gonna be trying this out real soon. & you're saying this fixes oil in addition to the other stuff right(so I can get rid of the other asm for that)?
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Glain on February 23, 2012, 12:45:08 am
Well, the oil code should multiply fire damage by 2 and then remove the Oil status. I actually think it may be possible to get x4 damage this way (x2 weak to Fire, x2 Oil), as opposed to the other ASM where I think having Oil status simply makes you weak to fire (and they wouldn't stack).
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Rfh on February 24, 2012, 01:59:49 pm
Glain, when I used your ASM in a ISO turned in to EBOOT.PBP and I make any atack, the game freezes. Could you do something to make it work on EBOOT.PBP? I am really interested in your hack!
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Glain on February 24, 2012, 04:22:08 pm
Hm... I'll check to see if there are any load/branch delay problems that stand out or anything like that. Unfortunately I don't seem to get this error on pSX, so it will be hard for me to recreate the problem.
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Glain on February 26, 2012, 11:22:46 am
I can't find a trace of the problem, unfortunately. I don't see any load/branch delay problems, and both emulators (ePSXe and pSX) seem to run the patch fine on an otherwise clean ISO. Was the ISO you used to create the eboot using any other ASMs?
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Rfh on February 26, 2012, 12:07:39 pm
I tried it on a clean ISO  with your hack, and the game was freezing when I make any attack. Why it happens only on EBOOT.PBP? 

EDIT: Your first hack works on EBOOT.PBP. What are the basic differences between the first and third hack?
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Glain on February 27, 2012, 11:53:14 am
The first hack doesn't take the weapon element into account and doesn't zero out the element, so the reaction still has the same element as the ability; strengthen and absorb don't work and oil isn't fixed. The third hack should fix all that stuff.

It's helpful to know the first hack works and the third hack doesn't... that helps to try to zero in on the problem. If it's not too annoying to do, would you mind testing if the second hack works? That way I can examine the differences.
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Rfh on February 27, 2012, 12:16:06 pm
The game freezes with the second or he third hack.
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Glain on February 27, 2012, 06:51:34 pm
I think I figured out what the problem is. I'm loading in a value from memory in a way that isn't really valid on real hardware but works on emulators (Loading a halfword from a non-even memory address). I'll have to rewrite the code that figures out the element and test, etc.
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Glain on February 27, 2012, 07:40:27 pm
All right, I've got another version of the patch that should hopefully fix the problem.


<Patch name="All formulas apply elemental">
    <Description>All formulas apply elemental</Description>
    <Location file="BATTLE_BIN" offset="1249F0">
      FE1B0608
    </Location>
    <Location file="BATTLE_BIN" offset="11FFE0">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="121794">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="121E2C">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="122D20">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="12361C">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="F5C78">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="11DF1C">
      1980083C
      902D098D
      8C2D0A8D
      04002B95
      00000000
      43580B00
      04002BA5
      06004BA5
      00000000
      00000000
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="11DF64">
      1980083C
      902D098D
      8C2D0A8D
      10002395
      04002485
      00086334
      40200400
      100023A5
      040024A5
      060044A5
    </Location>
    <Location file="BATTLE_BIN" offset="120010">
      4C73050C
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="F5D30">
      1980083C
      F4380991
      F3380E91
      004A0900
      25482E01
      F7381091
      04390C91
      D6380D91
      04200A34
      24582A01
      05006A11
      00000000
      0300A011
      00000000
      5D730508
      00000000
      25800C02
      043900A1
      0800E003
      F73800A1
    </Location>
    <Location file="BATTLE_BIN" offset="11DEB8">
      1980033C
      902D638C
      6873050C
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="F5DA0">
      1980083C
      902D0E8D
      8C2D098D
      40000F34
      80000A34
      0400CD95
      06002B95
      0400C0A5
      2500CFA1
      0600CDA5
      060020A5
      25002AA5
      0800E003
      04002BA5
    </Location>
    <Location file="BATTLE_BIN" offset="11DF50">
      8073050C
    </Location>
    <Location file="BATTLE_BIN" offset="F5E00">
      1980083C
      942D0E8D
      902D098D
      7100CE91
      8C2D0C8D
      2470C501
      0800C011
      04002A95
      05000B34
      18004B01
      12680000
      0200AD21
      83680D00
      04002DA5
      06008DA5
      0800E003
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="12002C">
      1980033C
      902D638C
      00000000
      04006284
      00000000
      40100200
      040062A4
      22006290
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="1200FC">
      0800E003
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="11EFA4">
      0800E003
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="120060">
      00000000
      25008890
      00000000
      08000835
      250088A0
    </Location>
  </Patch>
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Rfh on February 28, 2012, 10:42:24 am
With your new hack, the game isn't freeze, but happen a extrange thing,  the damage isn't showing with some formulas,  including the attack command.
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Glain on February 28, 2012, 11:12:25 am
Is the damage just not showing up in the projected damage or does it actually not happen?
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Rfh on February 28, 2012, 01:19:45 pm
Quote from: Glain on February 28, 2012, 11:12:25 am
Is the damage just not showing up in the projected damage or does it actually not happen?

Damage occurs, but not shown in the table of information (only you can see the status that you can cause and the percentage to hit) and you can't see the damage while you doing the damage.
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Glain on February 28, 2012, 07:59:38 pm
This is a puzzler. I can't reproduce this, so I'll have to ask some questions about it. This is all in an effort to isolate the code that's causing the damage not to show up:

1. Does it happen with the first patch in the thread? (Damage not showing)

2. Does it happen with this partial version of the patch?

<Patch name="All formulas apply elemental (partial)">
    <Description>All formulas apply elemental (partial)</Description>
    <Location file="BATTLE_BIN" offset="1249F0">
      FE1B0608
    </Location>
    <Location file="BATTLE_BIN" offset="11FFE0">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="121794">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="121E2C">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="122D20">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="12361C">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="F5C78">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="11DF1C">
      1980083C
      902D098D
      8C2D0A8D
      04002B95
      00000000
      43580B00
      04002BA5
      06004BA5
      00000000
      00000000
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="11DF64">
      1980083C
      902D098D
      8C2D0A8D
      10002395
      04002485
      00086334
      40200400
      100023A5
      040024A5
      060044A5
    </Location>
    <Location file="BATTLE_BIN" offset="120010">
      4C73050C
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="F5D30">
      1980083C
      F4380991
      F3380E91
      004A0900
      25482E01
      F7381091
      04390C91
      D6380D91
      04200A34
      24582A01
      05006A11
      00000000
      0300A011
      00000000
      5D730508
      00000000
      25800C02
      043900A1
      0800E003
      F73800A1
    </Location>
  </Patch>
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Rfh on February 29, 2012, 05:02:19 pm
Quote from: Glain on February 28, 2012, 07:59:38 pm

1. Does it happen with the first patch in the thread? (Damage not showing)

No


2. Does it happen with this partial version of the patch?

No
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Glain on February 29, 2012, 09:19:10 pm
Hmm... not what I was expecting. I have to narrow it down a bit more.

What about this one?

  <Patch name="All formulas apply elemental (Partial)">
    <Description>All formulas apply elemental (Partial)</Description>
    <Location file="BATTLE_BIN" offset="1249F0">
      FE1B0608
    </Location>
    <Location file="BATTLE_BIN" offset="11FFE0">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="121794">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="121E2C">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="122D20">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="12361C">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="F5C78">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="11DF1C">
      1980083C
      902D098D
      8C2D0A8D
      04002B95
      00000000
      43580B00
      04002BA5
      06004BA5
      00000000
      00000000
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="11DF64">
      1980083C
      902D098D
      8C2D0A8D
      10002395
      04002485
      00086334
      40200400
      100023A5
      040024A5
      060044A5
    </Location>
    <Location file="BATTLE_BIN" offset="120010">
      4C73050C
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="F5D30">
      1980083C
      F4380991
      F3380E91
      004A0900
      25482E01
      F7381091
      04390C91
      D6380D91
      04200A34
      24582A01
      05006A11
      00000000
      0300A011
      00000000
      5D730508
      00000000
      25800C02
      043900A1
      0800E003
      F73800A1
    </Location>
    <Location file="BATTLE_BIN" offset="11DEB8">
      1980033C
      902D638C
      6873050C
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="F5DA0">
      1980083C
      902D0E8D
      8C2D098D
      40000F34
      80000A34
      0400CD95
      06002B95
      0400C0A5
      2500CFA1
      0600CDA5
      060020A5
      25002AA5
      0800E003
      04002BA5
    </Location>
    <Location file="BATTLE_BIN" offset="11DF50">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="F5E00">
      1980083C
      942D0E8D
      902D098D
      7100CE91
      04002A95
      2470C501
      0700C011
      8C2D0C8D
      80680A00
      2168AA01
      0200AD21
      83680D00
      04002DA5
      06008DA5
      0800E003
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="12002C">
      1980033C
      902D638C
      00000000
      04006284
      00000000
      40100200
      040062A4
      22006290
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="1200FC">
      0800E003
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="11EFA4">
      0800E003
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="120060">
      00000000
      25008890
      00000000
      08000835
      250088A0
    </Location>
  </Patch>
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Rfh on March 01, 2012, 04:45:32 pm
With this partial patch, the damage isn't showing.
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Glain on March 01, 2012, 10:54:15 pm
I've made an attempt at fixing this.


<Patch name="All formulas apply elemental">
    <Description>All formulas apply elemental</Description>
    <Location file="BATTLE_BIN" offset="1249F0">
      FE1B0608
    </Location>
    <Location file="BATTLE_BIN" offset="11FFE0">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="121794">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="121E2C">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="122D20">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="12361C">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="F5C78">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="11DF1C">
      1980083C
      902D098D
      8C2D0A8D
      04002B95
      00000000
      43580B00
      04002BA5
      06004BA5
      00000000
      00000000
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="11DF64">
      1980083C
      902D098D
      8C2D0A8D
      10002395
      04002485
      00086334
      40200400
      100023A5
      040024A5
      060044A5
    </Location>
    <Location file="BATTLE_BIN" offset="120010">
      4C73050C
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="F5D30">
      1980083C
      F4380991
      F3380E91
      004A0900
      25482E01
      F7381091
      04390C91
      D6380D91
      04200A34
      24582A01
      05006A11
      00000000
      0300A011
      00000000
      5D730508
      00000000
      25800C02
      902D098D
      043900A1
      04002A91
      25002B91
      F73800A1
      02004011
      80006C35
      25002CA1
      0800E003
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="11DEB8">
      1980033C
      902D638C
      6873050C
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="F5DA0">
      1980083C
      902D0E8D
      8C2D098D
      40000F34
      80000A34
      0400CD95
      06002B95
      0400C0A5
      2500CFA1
      0600CDA5
      060020A5
      25002AA5
      0800E003
      04002BA5
    </Location>
    <Location file="BATTLE_BIN" offset="11DF50">
      8073050C
    </Location>
    <Location file="BATTLE_BIN" offset="F5E00">
      1980083C
      942D0E8D
      902D098D
      7100CE91
      04002A95
      2470C501
      0700C011
      8C2D0C8D
      80680A00
      2168AA01
      0200AD21
      83680D00
      04002DA5
      06008DA5
      0800E003
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="12002C">
      1980033C
      902D638C
      00000000
      04006284
      00000000
      40100200
      040062A4
      22006290
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="1200FC">
      0800E003
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="11EFA4">
      0800E003
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="120060">
      00000000
      25008890
      00000000
      08000835
      250088A0
    </Location>
  </Patch>


If the above doesn't fix it, try removing the two <Location> blocks near the bottom of the patch that just contain 0800E003 and 00000000 and let me know if that partial patch shows the damage.
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Rfh on March 02, 2012, 10:07:10 am
With this partial patch, the damage is showing. But in this patch there are still things to fix, like the elemental strength, and elemental absorb.
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Glain on March 02, 2012, 10:36:07 am
Hmm, all right. I take that to mean the attempted fix didn't work, then?

In the partial patch, is the problem with strengthen that it does too much damage (XA * (5/4) * WP) * (5/4)?
In the partial patch, is the problem with absorb that it does 0 healing?
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Rfh on March 02, 2012, 02:09:39 pm
Quote from: Glain on March 02, 2012, 10:36:07 am
Hmm, all right. I take that to mean the attempted fix didn't work, then?

In the partial patch, is the problem with strengthen that it does too much damage (XA * (5/4) * WP) * (5/4)? Yes
In the partial patch, is the problem with absorb that it does 0 healing? Yes


And I think that some formulas can't strengthen... Basically the same things that happens in EBOOT  happens in ePSXe.
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Glain on March 02, 2012, 07:00:43 pm
This is an attempt at the full patch. Does this work?


  <Patch name="All formulas apply elemental">
    <Description>All formulas apply elemental</Description>
    <Location file="BATTLE_BIN" offset="1249F0">
      FE1B0608
    </Location>
    <Location file="BATTLE_BIN" offset="11FFE0">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="121794">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="121E2C">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="122D20">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="12361C">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="F5C78">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="11DF1C">
      1980083C
      902D098D
      8C2D0A8D
      04002B95
      00000000
      43580B00
      04002BA5
      06004BA5
      00000000
      00000000
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="11DF64">
      1980083C
      902D098D
      8C2D0A8D
      10002395
      04002485
      00086334
      40200400
      100023A5
      040024A5
      060044A5
    </Location>
    <Location file="BATTLE_BIN" offset="120010">
      4C73050C
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="F5D30">
      1980083C
      F4380991
      F3380E91
      004A0900
      25482E01
      F7381091
      04390C91
      D6380D91
      04200A34
      24582A01
      05006A11
      00000000
      0300A011
      00000000
      5D730508
      00000000
      25800C02
      043900A1
      0800E003
      F73800A1
    </Location>
    <Location file="BATTLE_BIN" offset="11DEB8">
      1980033C
      902D638C
      6873050C
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="F5DA0">
      1980083C
      902D0E8D
      8C2D098D
      40000F34
      80000A34
      0400CD95
      06002B95
      0400C0A5
      2500CFA1
      0600CDA5
      060020A5
      25002AA5
      0800E003
      04002BA5
    </Location>
    <Location file="BATTLE_BIN" offset="11DF50">
      8073050C
    </Location>
    <Location file="BATTLE_BIN" offset="F5E00">
      1980083C
      942D0E8D
      902D098D
      7100CE91
      04002A95
      2470C501
      0700C011
      8C2D0C8D
      80680A00
      2168AA01
      0200AD21
      83680D00
      04002DA5
      06008DA5
      0800E003
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="12002C">
      1980033C
      902D638C
      00000000
      04006284
      00000000
      40100200
      040062A4
      22006290
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="120060">
      00000000
      25008890
      00000000
      08000835
      250088A0
    </Location>
    <Location file="BATTLE_BIN" offset="120124">
      501C0608
    </Location>
    <Location file="BATTLE_BIN" offset="11EFA4">
      0800E003
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="11EFFC">
      0800E003
      00000000
    </Location>
  </Patch>


One other thing I didn't mention: Everything is based on the element of the ability, not the weapon, unless you're using the Attack command (00) or the "Weapon Strike" flag and the flag under "Hit Allies" in the bottom section of FFTP are checked for the current ability, in which case the ability's element is combined with the weapon's. (For example, by default, swordskills don't use the weapon element.)
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Rfh on March 03, 2012, 04:16:02 pm
In your last patch happens the same problems.
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Glain on March 03, 2012, 05:26:12 pm
Er, what? You're saying you actually get different results (in amounts of damage!) between trying this on an emulator and on the eboot? The latest patch doesn't double apply strengthen, for example, and doesn't do it in my testing on both emulators. If that's happening, it's never happened before, as far as I know.

Also, the latest patch doesn't overwrite everything the old patches did, so best to try each version on a clean ISO (backup).
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Glain on March 04, 2012, 12:43:17 pm
Found a problem where absorb would happen before strengthen, so if you absorbed, you'd only absorb the non-strengthened damage. This patch should fix that. I'm interested to hear feedback from anyone trying this out.


  <Patch name="All formulas apply elemental">
    <Description>All formulas apply elemental</Description>
    <Location file="BATTLE_BIN" offset="1249F0">
      FE1B0608
    </Location>
    <Location file="BATTLE_BIN" offset="11FFE0">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="121794">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="121E2C">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="122D20">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="12361C">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="F5C78">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="11DF1C">
      1980083C
      902D098D
      8C2D0A8D
      04002B95
      00000000
      43580B00
      04002BA5
      06004BA5
      00000000
      00000000
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="11DF64">
      1980083C
      902D098D
      8C2D0A8D
      10002395
      04002485
      00086334
      40200400
      100023A5
      040024A5
      060044A5
    </Location>
    <Location file="BATTLE_BIN" offset="120010">
      4C73050C
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="F5D30">
      1980083C
      F4380991
      F3380E91
      004A0900
      25482E01
      F7381091
      04390C91
      D6380D91
      04200A34
      24582A01
      05006A11
      00000000
      0300A011
      00000000
      5D730508
      00000000
      25800C02
      043900A1
      F73800A1
      80730508
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="11DEB8">
      1980033C
      902D638C
      6873050C
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="F5DA0">
      1980083C
      902D0E8D
      8C2D098D
      40000F34
      80000A34
      0400CD95
      06002B95
      0400C0A5
      2500CFA1
      0600CDA5
      060020A5
      25002AA5
      0800E003
      04002BA5
    </Location>
    <Location file="BATTLE_BIN" offset="F5E00">
      1980083C
      942D0E8D
      902D098D
      7100CE91
      04002A95
      2470D001
      0700C011
      8C2D0C8D
      80680A00
      2168AA01
      0200AD21
      83680D00
      04002DA5
      06008DA5
      0800E003
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="12002C">
      1980033C
      902D638C
      00000000
      04006284
      00000000
      40100200
      040062A4
      22006290
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="120060">
      00000000
      25008890
      00000000
      08000835
      250088A0
    </Location>
    <Location file="BATTLE_BIN" offset="120124">
      501C0608
    </Location>
    <Location file="BATTLE_BIN" offset="11EFA4">
      0800E003
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="11EFFC">
      0800E003
      00000000
    </Location>
  </Patch>
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Eternal on March 04, 2012, 02:43:15 pm
To be clear, if I set Drain to be Dark Elemental, it would properly not affect Lucavi now if they null Dark?
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Glain on March 04, 2012, 02:55:55 pm
Yep, it should just be 00%
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Eternal on March 04, 2012, 03:22:31 pm
Yay, I can finally bring Drain back!
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Glain on March 12, 2012, 07:39:13 pm
So it turns out the patch was only giving the correct element to the action for the first target it hit. Then it was zeroing out the ability element (too early). I've got a new patch to correct that! I'm not sure this one overwrites everything the other one did, so best use on an ISO that doesn't have the old patch applied.


  <Patch name="All formulas apply elemental">
    <Description>All formulas apply elemental</Description>
    <Location file="BATTLE_BIN" offset="1249F0">
      FE1B0608
    </Location>
    <Location file="BATTLE_BIN" offset="11FFE0">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="121794">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="121E2C">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="122D20">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="12361C">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="F5C78">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="11DF1C">
      1980083C
      902D098D
      8C2D0A8D
      04002B95
      00000000
      43580B00
      04002BA5
      06004BA5
      00000000
      00000000
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="11DF64">
      1980083C
      902D098D
      8C2D0A8D
      10002395
      04002485
      00086334
      40200400
      100023A5
      040024A5
      060044A5
    </Location>
    <Location file="BATTLE_BIN" offset="120010">
      4C73050C
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="F5D30">
      1980083C
      F4380991
      F3380E91
      004A0900
      25482E01
      F7381091
      04390C91
      D6380D91
      04200A34
      24582A01
      05006A11
      00000000
      0300A011
      00000000
      5D730508
      00000000
      25800C02
      80730508
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="11DEB8">
      1980033C
      902D638C
      6873050C
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="F5DA0">
      1980083C
      902D0E8D
      8C2D098D
      40000F34
      80000A34
      0400CD95
      06002B95
      0400C0A5
      2500CFA1
      0600CDA5
      060020A5
      25002AA5
      0800E003
      04002BA5
    </Location>
    <Location file="BATTLE_BIN" offset="F5E00">
      1980083C
      942D0E8D
      902D098D
      7100CE91
      04002A95
      2470D001
      0700C011
      8C2D0C8D
      80680A00
      2168AA01
      0200AD21
      83680D00
      04002DA5
      06008DA5
      0800E003
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="12002C">
      1980033C
      902D638C
      00000000
      04006284
      00000000
      40100200
      040062A4
      22006290
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="120060">
      00000000
      25008890
      00000000
      08000835
      250088A0
    </Location>
    <Location file="BATTLE_BIN" offset="120124">
      501C0608
    </Location>
    <Location file="BATTLE_BIN" offset="11EFA4">
      0800E003
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="11EFFC">
      0800E003
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="CEE4">
      98730508
    </Location>
    <Location file="BATTLE_BIN" offset="F5E60">
      043900A1
      0800E003
      F73800A1
    </Location>
  </Patch>
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Austin on April 23, 2012, 10:28:25 pm
Alright, I'm back again from my most recent hiatus and trying this out again. It's still giving me the same problems as before, if you make the knight stat break skills elemental and hit something that cancels that element and has a reaction ability that targets itself it will always miss.

So I'm testing this by making squires cancel dark then hitting them with dark element break skills. The skill will miss like it's supposed to, but if the squire has any reaction ability like a/ma save, dragon spirit, etc. and it activates afterwards it'll always miss.

Also I tried using a dark element life drain on them and it had a wonky effect. If the attack succeeded (even though it always shows 0%) then the person that casted it got healed for the hp they would have gotten from the drain even though it would still miss on the squire. Basically it would work like normal except it didn't take any hp from the squire since it "missed".

Thanks again for trying to get this working, maybe it'll get there eventually.
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Glain on April 24, 2012, 11:03:30 pm
Good catch with the dark element life drain. Can't believe I didn't notice that earlier... (my test battle is Gate of Lionel... dark element life drain... now where have I seen that before? :<) I think I have a fix for that!

...As for nullified attacks having the reactions miss. I couldn't reproduce that, not exactly. The stat breaks are interesting though. I can't get MA Save to fire after a nullified stat break... ...even in vanilla. But in that case, it doesn't miss... it just doesn't fire at all whatsoever. I'm not really sure what's going on there, but I don't think this patch introduces that problem.

It's working for me with Sunken State though. I can't reproduce the problem. We're probably testing on two different platforms. Are you using an emulator? If so, do you have a savestate where it happens?

Anyway, here's the latest (should fix the drain problem)


  <Patch name="All formulas apply elemental">
    <Description>All formulas apply elemental</Description>
    <Location file="BATTLE_BIN" offset="1249F0">
      FE1B0608
    </Location>
    <Location file="BATTLE_BIN" offset="11FFE0">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="121794">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="121E2C">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="122D20">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="12361C">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="F5C78">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="11DF1C">
      1980083C
      902D098D
      8C2D0A8D
      04002B95
      00000000
      43580B00
      04002BA5
      06004BA5
      00000000
      00000000
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="11DF64">
      1980083C
      902D098D
      8C2D0A8D
      10002395
      04002485
      00086334
      40200400
      100023A5
      040024A5
      060044A5
    </Location>
    <Location file="BATTLE_BIN" offset="120010">
      4C73050C
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="F5D30">
      1980083C
      F4380991
      F3380E91
      004A0900
      25482E01
      F7381091
      04390C91
      D6380D91
      04200A34
      24582A01
      05006A11
      00000000
      0300A011
      00000000
      5D730508
      00000000
      25800C02
      80730508
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="11DEB8">
      1980033C
      902D638C
      6873050C
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="F5DA0">
      1980083C
      902D0E8D
      8C2D098D
      40000F34
      80000A34
      0400CD95
      06002B95
      0400C0A5
      2500CFA1
      0600CDA5
      060020A5
      25002AA5
      0800E003
      04002BA5
    </Location>
    <Location file="BATTLE_BIN" offset="F5E00">
      1980083C
      942D0E8D
      902D098D
      7100CE91
      04002A95
      2470D001
      0700C011
      8C2D0C8D
      80680A00
      2168AA01
      0200AD21
      83680D00
      04002DA5
      06008DA5
      0800E003
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="12002C">
      1980033C
      902D638C
      00000000
      04006284
      00000000
      40100200
      040062A4
      22006290
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="120060">
      00000000
      25008890
      00000000
      08000835
      250088A0
    </Location>
    <Location file="BATTLE_BIN" offset="120124">
      501C0608
    </Location>
    <Location file="BATTLE_BIN" offset="11EFA4">
      0800E003
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="11EFFC">
      0800E003
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="CEE4">
      98730508
    </Location>
    <Location file="BATTLE_BIN" offset="F5E60">
      1980083C
      043900A1
      0800E003
      F73800A1
    </Location>
    <Location file="BATTLE_BIN" offset="F65C0">
      F4FFBD27
      0400BFAF
      9013060C
      00000000
      1980083C
      902D098D
      8C2D0A8D
      0800A9AF
      902D0AAD
      9013060C
      00000000
      0800A98F
      1980083C
      902D09AD
      0400BF8F
      0C00BD27
      0800E003
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="1200C8">
      7075050C
    </Location>
    <Location file="BATTLE_BIN" offset="11DEF8">
      7075050C
    </Location>
  </Patch>
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Austin on April 25, 2012, 10:09:56 pm
Alright, I just tried this one out and for whatever reason it looks like everything's working right. After using this patch I could only get certain abilities to go off like you too, brave up, caution, and dragon spirit I think all activated and worked like they were supposed to. I couldn't get regenerator to go off though despite it being one of the ones that did when I tried it before.

Either way if it's working there's no point worrying about it lol, it may have been something on my end that was messing it up. I am playing on the psxfin emulator if you still wanted to know though. Thanks for the help dude.  :P
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: RavenOfRazgriz on July 04, 2012, 06:55:49 pm
Anyone know how this hack interacts with other formula hacks?   Specifically ones that already have elemental routines?
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: FFMaster on July 04, 2012, 07:14:41 pm
Will probably break them.

Multiple formula rewrites are bad unless you know exactly what is happening.
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Glain on July 05, 2012, 11:54:01 am
Well, the majority of what this hack does is just call the elemental routine after the formula code has already been called. It doesn't actually edit the formulas themselves except to null out (nop) any other calls to the elemental routine (0x186ff8) and its inner routine (0x184e98).

If a formula hack calls those routines explicitly, it would be a problem because the element would be applied twice. If formulas have been rewritten so that those calls aren't in the same place that they normally would be, that would be bad.

I don't think I've seen another hack that edits the end of the formula calling routine in the same way this one does, so I don't imagine there would be code overlap issues anywhere else.

It depends on what the other hacks do, I suppose, to really know whether they'd work in tandem, but it's probably worth a shot...
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: RavenOfRazgriz on July 05, 2012, 05:02:59 pm
So as long as those hacks don't edit the end of the formula calling routine and have their usually elemental callings nopped out, it should be fine?

I'm not really editing any existing formula, just adding new ones such as your MA*WP+Y and ride's White Wind and Damage=Y.  A couple are being actively edited but with that in mind I think things should be workable.

Thanks, Glain.
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: RavenOfRazgriz on July 23, 2012, 02:12:17 am
Important question #2 regarding this hack: If I use this hack, then make a skill like Cure 2 Holy element, then have a character that Absorbs Holy, what will happen, Glain?  Will the healing be reversed into damage sortof like an Undead Reverse or will nothing happen?
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Glain on July 23, 2012, 02:42:05 pm
It looks like the absorb code for this hack is basically:

Healing = Damage
Damage = 0

If draining HP, then additionally:

Returned damage = returned healing
Returned healing = 0

The problem is that for heals, damage = 0, so with absorb, healing = 0.

Eyeballing the address, I think that's in kanji space, and I usually leave a bit of space between routines, so I think I can expand it to skip setting the healing = damage if the damage is 0.  You can try overwriting the F5DA0 segment in the patch with this and give it a go:


      1980083C
      902D0E8D
      8C2D098D
      40000F34
      80000A34
      0400CD95
      06002B95
      2500CFA1
      0200A011
      0400C0A5
      0600CDA5
      060020A5
      25002AA5
      0800E003
      04002BA5


This modification was brought to you in accordance with Absolutely Zero Testing™.
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Glain on August 21, 2012, 11:36:59 pm
This version should work without having to remove (nop out) any other calls.  The idea was to place an immediate return statement at the start of the elemental and inner elemental routines, to make them do nothing, and shift the real routines one line down, making up the space somewhere in the process (removing a nop, reusing a register).


Since the routines were only moved one line down, an immediate return at the old function location still means that the first statement of the real function is executed, since it's in the branch delay slot of the return statement, but in both routines, that statement is harmless to a calling function (changes a temp register).


Patch and source are one and the same!  Formatting looks messed up here but should be right if you copy/paste into a file.


  <Patch name="All formulas apply elemental">
    <Description>All formulas apply elemental</Description>
    <Location file="BATTLE_BIN" offset="1249F0" mode="ASM">
      j       0x186ffc              # Call Apply Elemental routine (at new location) at the end of formula code
    </Location>
    <Location file="BATTLE_BIN" offset="11FFF8" mode="ASM">
      jr      ra                    # Return immediately from original routine
      lui     t0,0x8019             # Shift routine down one space
      lw      v0,0x2d98(t0)
      addiu   sp,sp,-0x18
      sw      ra,0x14(sp)
      sw      s0,0x10(sp)
      lbu     v0,0x5a(v0)
      lbu     s0,0x38f7(t0)         # Regain space through repeated use of t0 = 0x8019
    </Location>
    <Location file="BATTLE_BIN" offset="1200E0" mode="ASM">
      jal     0x184e9c              # Call inner elemental routine at new location
    </Location>
    <Location file="BATTLE_BIN" offset="11DE98" mode="ASM">
      jr      ra                    # Return immediately from original routine
      lui     t0,0x8019             # Shift routine down one space
      lw      v0,0x2d98(t0)
      addiu   sp,sp,-0x18
      sw      ra,0x10(sp)
      lbu     v0,0x6d(v0)
      move    a1,a0
      and     v0,v0,a1
      beq     v0,zero,0x184ed8
      lw      v1,0x2d90(t0)         # Regain space by eating a nop and reusing t0
      jal     0x15cda0              # Jump to new absorb section
      nop
    </Location>
    <Location file="BATTLE_BIN" offset="11DF1C" mode="ASM">
      lui     t0,0x8019             # Elemental Half section
      lw      t1,0x2d90(t0)
      lw      t2,0x2d8c(t0)
      lhu     t3,4(t1)
      nop
      sra     t3,t3,1               # Halve damage
      sh      t3,4(t1)              # Store as damage
      sh      t3,6(t2)              # Store as returned healing (drain)
      nop
      nop
      nop
    </Location>
    <Location file="BATTLE_BIN" offset="11DF64" mode="ASM">
      lui     t0,0x8019             # Elemental Weak section
      lw      t1,0x2d90(t0)
      lw      t2,0x2d8c(t0)
      lhu     v1,0x10(t1)
      lh      a0,0x04(t1)
      ori     v1,v1,0x0800
      sll     a0,a0,1               # Double damage
      sh      v1,0x10(t1)
      sh      a0,0x04(t1)           # Store as damage
      sh      a0,0x06(t2)           # Store as returned healing (drain)
    </Location>
    <Location file="BATTLE_BIN" offset="120010" mode="ASM">
      jal     0x15cd30              # Call new routine
      nop
    </Location>
    <Location file="BATTLE_BIN" offset="F5D30" mode="ASM">
      lui     t0,0x8019             # Element determination section
      lbu     t1,0x38f4(t0)
      lbu     t6,0x38f3(t0)
      sll     t1,t1,8
      or      t1,t1,t6
      lbu     s0,0x38f7(t0)
      lbu     t4,0x3904(t0)         # Weapon element
      lbu     t5,0x38d6(t0)         # Ability element
      ori     t2,zero,0x2004       
      and     t3,t1,t2              # Check if "Weapon Strike" and flag under "Hit Allies" checked
      beq     t3,t2,CMB             # If so, jump to combine element section
      nop
     
      beq     t5,zero,CMB           # If this ability is Attack (ID 0), then jump to combine element section
      nop
     
      j       PCB                   # Otherwise, jump past the combine section
      nop
     
CMB:  or      s0,s0,t4              # Combine section; combine the weapon and ability element

PCB:  j       0x15ce00              # Past combine section; go to next section
      nop
    </Location>
    <Location file="BATTLE_BIN" offset="F5DA0" mode="ASM">
      lui     t0,0x8019             # Elemental Absorb section
      lw      t6,0x2d90(t0)
      lw      t1,0x2d8c(t0)
      li      t7,0x40
      li      t2,0x80
      lhu     t5,0x04(t6)
      lhu     t3,0x06(t1)
      sb      t7,0x25(t6)           # Action type = HP Healing
      beq     t5,zero,PDO
      sh      zero,0x04(t6)         # HP Damage = 0
      sh      t5,0x06(t6)           # HP Healing = old HP Damage
PDO:  sh      zero,0x06(t1)         # Returned HP Healing = 0 (Reverse drain)
      sh      t2,0x25(t1)           # Returned action type = HP Damage (Reverse drain)
      jr      ra
      sh      t3,0x04(t1)           # Returned HP Damage = Old Returned HP Healing (Reverse drain)
    </Location>
    <Location file="BATTLE_BIN" offset="F5E00" mode="ASM">
      lui     t0,0x8019             # Elemental Strengthen section
      lw      t6,0x2d94(t0)
      lw      t1,0x2d90(t0)
      lbu     t6,0x0071(t6)
      lhu     t2,0x0004(t1)
      and     t6,t6,s0
      beq     t6,zero,END           # Skip if element not strengthened
      lw      t4,0x2d8c(t0)
     
      sll     t5,t2,2
      addu    t5,t5,t2
      addi    t5,t5,2
      sra     t5,t5,2               # Damage = Damage * 5 / 4 (Rounded)
      sh      t5,0x04(t1)           # Save as HP Damage
      sh      t5,0x06(t4)           # Save as returned HP Healing (Drain)
END:  jr      ra
      nop
    </Location>
    <Location file="BATTLE_BIN" offset="12002C" mode="ASM">
      lw      v1,0x80192d90         # Oil section (Target hit by fire attack)
      nop
      lhu     v0,0x04(v1)
      nop
      sll     v0,v0,1               # Double HP damage
      sh      v0,0x04(v1)           # Save as HP damage
      lbu     v0,0x22(v1)
      nop
    </Location>
    <Location file="BATTLE_BIN" offset="120060" mode="ASM">
      nop                           # Oil - don't overwrite action type
      lbu     t0,0x25(a0)           # Load Action type
      nop
      ori     t0,t0,0x08            # Add status change
      sb      t0,0x25(a0)           # Save as action type
    </Location>
    <Location file="BATTLE_BIN" offset="120124" mode="ASM">
      j       0x187140              # Jump over normal absorption block
    </Location>
    <Location file="BATTLE_BIN" offset="11EFA4" mode="ASM">
      jr      ra                    # Blank out routine (Weapon element strengthen)
      nop
    </Location>
    <Location file="BATTLE_BIN" offset="11EFFC" mode="ASM">
      jr      ra                    # Blank out routine (Ability element strengthen)
      nop
    </Location>
    <Location file="BATTLE_BIN" offset="CEE4" mode="ASM">
      j       0x15ce60              # Jump to new section
    </Location>
    <Location file="BATTLE_BIN" offset="F5E60" mode="ASM">
      lui     t0,0x8019
      sb      zero,0x3904(t0)       # Zero out weapon element
      jr      ra
      sb      zero,0x38f7(t0)       # Zero out ability element
    </Location>
    <Location file="BATTLE_BIN" offset="1200C8" mode="ASM">
      jal     0x15d5c0              # Call routine to null action and drain action
    </Location>
    <Location file="BATTLE_BIN" offset="11DEF8" mode="ASM">
      jal     0x15d5c0              # Call routine to null action and drain action
    </Location>
    <Location file="BATTLE_BIN" offset="F65C0" mode="ASM">
      addiu   sp,sp,-12
      sw      ra,4(sp)

      jal     0x184e40              # Nullify current action
      nop

      lui     t0,0x8019
      lw      t1,0x2d90(t0)
      lw      t2,0x2d8c(t0)
      sw      t1,8(sp)              # Save action to stack
      sw      t2,0x2d90(t0)         # Save drain action as current action

      jal     0x184e40              # Nullify current action (drain action)
      nop

      lw      t1,8(sp)              # Load action from stack
      lui     t0,0x8019
      sw      t1,0x2d90(t0)         # Save current action back

      lw      ra,4(sp)
      addiu   sp,sp,12
      jr      ra
      nop
    </Location>
  </Patch>
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: RavenOfRazgriz on August 21, 2012, 11:48:42 pm
Does this still fix Oil, fix rounding errors by modifying the final value and not the XA value, work with Healing and Absorb, etc?
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: Glain on August 22, 2012, 01:08:50 am
Yeah, I put the modification described in the last post in there, so healing should be preserved regardless of absorb.

And yep, all the other things should be in there too.
Title: Re: ASM Request: Stat Down Skills Accept Element
Post by: RavenOfRazgriz on August 22, 2012, 02:54:37 am
Weeeee.  Sounds good.

Now do it again for the Status routine.  :U

But really, it's good to have a much more user-friendly version of this ASM.  How hard would customizing which elements are affected by Oil be?  I don't personally need it but I know it's a nice bit of customization a lot of people would appreciate.