øAslickproductions.org/forum/index.php?PHPSESSID=a93jpvqe9jutne9agvqo8ht1r1&topic=2188.45e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/indexead7.htmlslickproductions.org/forum/index.php?board=17.0e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/indexead7.html.zx¼8h^ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÈ °V>OKtext/htmlISO-8859-1gzip@øÕ>ÿÿÿÿÿÿÿÿWed, 11 Mar 2020 01:19:16 GMT0ó°° ®0®P®€§²ð®»8h^ÿÿÿÿÿÿÿÿZ/> FFV Damage Calculator

Author Topic: FFV Damage Calculator  (Read 9840 times)

Squall

  • Dark Dragon
  • *
  • Posts: 486
    • View Profile
Re: FFV Damage Calculator
« Reply #45 on: June 03, 2016, 09:04:21 AM »
Hey guys, I'm sure we are familiar with:
'Mastering a Job will unlock the stat boosts of that Job (if any) for the Freelancer and Mime Jobs.'

My question is how this is implemented in the asm code for SNES? (routine / memory)

I think that current boost for these jobs is held in offset $4A (Str, Agi, Sta, Mag) in each char info...

LightPhoenix

  • FF5 Hacker
  • *
  • Posts: 130
    • View Profile
Re: FFV Damage Calculator
« Reply #46 on: June 05, 2016, 05:25:28 PM »
That's what I have in my notes - it's the highest Str/Agi/Sta/Mag from all the jobs.  I believe the next two bytes are any mastered passive abilities from jobs.  The code you're looking for is at C2/EBBD.  Here are my notes on it (not necessarily correct/complete):

Code: [Select]
C2/EBBD: 8B           PHB
C2/EBBE: 08           PHP
C2/EBBF: E2 20        SEP #$20
C2/EBC1: A9 7E        LDA #$7E
C2/EBC3: 48           PHA
C2/EBC4: AB           PLB
C2/EBC5: 20 C5 D4     JSR $D4C5
C2/EBC8: 64 E7        STZ $E7 Clear temp vars for stat incs
C2/EBCA: 64 E8        STZ $E8
C2/EBCC: 64 E9        STZ $E9
C2/EBCE: 64 EA        STZ $EA
C2/EBD0: A9 D1        LDA #$D1 Save this bank address
C2/EBD2: 85 84        STA $84
C2/EBD4: A9 04        LDA #$04 Number of abilities/loops (one for each ability)
C2/EBD6: 85 85        STA $85

C2/EBD8: A6 80        LDX $80 Character offset
C2/EBDA: BD 16 05     LDA $0516,X Get ability in slot X
C2/EBDD: 48           PHA Push
C2/EBDE: 30 05        BMI $EBE5
C2/EBE0: A0 00 5E     LDY #$5E00 Active stat inc offset = D1/5E00
C2/EBE3: 80 03        BRA $EBE8
C2/EBE5: A0 08 63     LDY #$6308 Passive stat inc offset = D1/6308
C2/EBE8: 84 82        STY $82
C2/EBEA: 68           PLA
C2/EBEB: 29 7F        AND #$7F
C2/EBED: 20 54 EC     JSR $EC54 Load highest stat increases from equipped abils
C2/EC54: DA           PHX
C2/EC55: 5A           PHY
C2/EC56: 08           PHP
C2/EC57: C2 20        REP #$20
C2/EC59: 29 FF 00     AND #$00FF
C2/EC5C: 0A           ASL
C2/EC5D: 0A           ASL
C2/EC5E: A8           TAY Offset = Passive * 4
C2/EC5F: E2 20        SEP #$20
C2/EC61: A6 8E        LDX $8E
C2/EC63: B7 82        LDA [$82],Y Get stat inc
C2/EC65: D5 E7        CMP $E7,X If > than temp stat inc, replace
C2/EC67: 30 02        BMI $EC6B
C2/EC69: 95 E7        STA $E7,X
C2/EC6B: C8           INY
C2/EC6C: E8           INX
C2/EC6D: E0 04 00     CPX #$0004
C2/EC70: D0 F1        BNE $EC63
C2/EC72: 28           PLP
C2/EC73: 7A           PLY
C2/EC74: FA           PLX
C2/EC75: 60           RTS
C2/EBF0: E8           INX
C2/EBF1: C6 85        DEC $85
C2/EBF3: D0 E5        BNE $EBDA Loop over all four abilities

C2/EBF5: A0 B0 56     LDY #$56B0 Job base stats offset
C2/EBF8: 84 82        STY $82
C2/EBFA: A9 D1        LDA #$D1 and bank
C2/EBFC: 85 84        STA $84
C2/EBFE: A6 80        LDX $80
C2/EC00: BD 01 05     LDA $0501,X Get character's job
C2/EC03: 29 1F        AND #$1F
C2/EC05: C9 14        CMP #$14 if < #14 (ie not mimic/freelancer)
C2/EC07: 30 0F        BMI $EC18

C2/EC09: C2 20        REP #$20
C2/EC0B: 8A           TXA
C2/EC0C: 18           CLC
C2/EC0D: 69 4A 05     ADC #$054A Get offset + these vars for shit
C2/EC10: 85 82        STA $82
C2/EC12: E2 20        SEP #$20
C2/EC14: 64 84        STZ $84 bank from 00/054A,X
C2/EC16: A9 00        LDA #$00 (use 00 for job)

C2/EC18: 20 54 EC     JSR $EC54 Load highest stat increases from job

C2/EC1B: A0 1E 55     LDY #$551E Character stat bonuses added to job bonuses
C2/EC1E: 84 82        STY $82
C2/EC20: A9 D1        LDA #$D1
C2/EC22: 85 84        STA $84
C2/EC24: C2 20        REP #$20
C2/EC26: BD 00 05     LDA $0500,X
C2/EC29: 29 07 00     AND #$0007
C2/EC2C: 0A           ASL
C2/EC2D: 0A           ASL
C2/EC2E: A8           TAY
C2/EC2F: E2 20        SEP #$20
C2/EC31: A6 8E        LDX $8E
C2/EC33: B7 82        LDA [$82],Y
C2/EC35: 18           CLC
C2/EC36: 75 E7        ADC $E7,X
C2/EC38: 95 E7        STA $E7,X
C2/EC3A: C8           INY
C2/EC3B: E8           INX
C2/EC3C: E0 04 00     CPX #$0004
C2/EC3F: D0 F2        BNE $EC33


C2/EC41: A6 8E        LDX $8E Load base stats
C2/EC43: A4 80        LDY $80
C2/EC45: B5 E7        LDA $E7,X
C2/EC47: 99 24 05     STA $0524,Y
C2/EC4A: C8           INY
C2/EC4B: E8           INX
C2/EC4C: E0 04 00     CPX #$0004
C2/EC4F: D0 F4        BNE $EC45

C2/EC51: 28           PLP
C2/EC52: AB           PLB
C2/EC53: 60           RTS

Squall

  • Dark Dragon
  • *
  • Posts: 486
    • View Profile
Re: FFV Damage Calculator
« Reply #47 on: June 05, 2016, 05:50:56 PM »
Yeah I was looking at same subroutine, that's why I think that +4A of each player contain max start  of mastered jobs for each player.
However the few places that have explicit 054A seems to use 5 bytes (not 4 for the 4 stats) ... 

Edit: Anyway I'm more interested on how and when mastering stats code appear. They could store info for mastered jobs or they could just keep 'last highest stats' (in +4A maybe). Most likely its combination of both, because we can see mastered jobs in the menu (that mean they were stored somewhere), yet stats calculation doesnt check such table.

P.S. Since I cant pinpoint in the asm code, do you know when Jobs innates are transferred to mime/freelancer?

I know these questions maybe confusing and kind of random, but I'm trying to make 100% accurate char setup in my Dmg Calculator. Everything is smooth till mime/freelancer job come.
« Last Edit: June 06, 2016, 02:47:44 AM by Squall »

Squall

  • Dark Dragon
  • *
  • Posts: 486
    • View Profile
Re: FFV Damage Calculator
« Reply #48 on: June 06, 2016, 07:49:48 AM »
Edit2: I hopped that going back to Job/Abilities will give me a clear picture on how things works, but I'm kind of ... square one again:
 - What is the purpose of so called 'innates'?
 - What is the purpose of learning abilities?
 - Some abilities require to be 'equipped' in order to take effect. Is there a table or something to distinguish who require and who is taken in account automatically?
« Last Edit: June 06, 2016, 08:47:32 AM by Squall »

Jorgur

  • Moderator
  • *
  • Posts: 437
  • Gender: Male
    • View Profile
Re: FFV Damage Calculator
« Reply #49 on: June 06, 2016, 12:26:39 PM »
Edit2: I hopped that going back to Job/Abilities will give me a clear picture on how things works, but I'm kind of ... square one again:
 - What is the purpose of so called 'innates'?
 - What is the purpose of learning abilities?
 - Some abilities require to be 'equipped' in order to take effect. Is there a table or something to distinguish who require and who is taken in account automatically?
I'm confused. Can you rephrase your questions?

Squall

  • Dark Dragon
  • *
  • Posts: 486
    • View Profile
Re: FFV Damage Calculator
« Reply #50 on: June 07, 2016, 02:03:05 AM »
OK. Lets try this way:

Jobs have certain ability that we can learn:
 - Some abilities we call innate. Why innate, whats so special about them?
 - Some of the abilities require to 'equip' them - like 'Barehanded', while others work without equipping them - like Counter (if we are Monk). Is there a table or something that indicates which ability needs to be 'equipped' and which works without.

Jorgur

  • Moderator
  • *
  • Posts: 437
  • Gender: Male
    • View Profile
Re: FFV Damage Calculator
« Reply #51 on: June 07, 2016, 02:18:28 AM »

Squall

  • Dark Dragon
  • *
  • Posts: 486
    • View Profile
Re: FFV Damage Calculator
« Reply #52 on: June 07, 2016, 04:27:26 AM »
Hehe Jorgur, sometimes your answers make me laugh spontaneously :D
(Of course I know this table, I have already implemented it in the Viewer)

Ok, here is the deal: I will quote few sentences from Djibriel's walktrough (on FAQ):
(1) 'Jobs can have inherent (innate) abilities that are set no matter what'.
(2) 'Mastering a Job will unlock ... most inherent abilities of that Job (if any) for the Freelancer and Mime Jobs'.
and the examples for above:
- 'A Monk will always have Barehanded and Counter' (1)
- 'When Bartz masters the Monk Job ... In addition, he will gain Counter and Barehanded as inherent abilities' (2)

The problem:
1. When you choose a Monk, yes you get passive Counter without learning it, BUT you cant use Barehanded until you learn it. Then why Barehanded is called innate? (1)
2. When we master Monk, yes Counter & Barehanded bits transfer to Mime/Freelancer, BUT we cant use Barehanded without equipping it, yet we can equip it without mastering Monk Job (as far as we had learned the ability). Then the question is the same: why Barehanded is innate, when it could be used as any other non innate ability? (2)

In short:
Abilities that dont need to be 'equipped' fit well the Djibriel's description and in general understanding what innate is. The problem comes with the few that need to be 'equipped': 'Two-Handed' & 'Barehanded'. Obviously they dont fit innate definitions (1) and (2) (& general understanding), yet they have bits reserved.

Because of all that mess naturally comes the questions:
- what is game definition of innate? Putting these two there is a bug? Maybe initially they were meant as innate, but later on they saw it will make jobs using them too overpowered? Maybe the 2 bytes we call 'Innate' are just a place for various bits - some for innate, some for other purposes ...
- is there a table that shows which ability needs to be 'equipped' (in the case of Barehanded) and which not (in the case of Counter)

Jorgur

  • Moderator
  • *
  • Posts: 437
  • Gender: Male
    • View Profile
Re: FFV Damage Calculator
« Reply #53 on: June 07, 2016, 05:16:45 AM »
I'm guessing Berserk is hard coded. Double Grip is simply not one of Knight's innate abilities. Per definition, it is not an innate ability even though there is a bit for it. As far as I know, there are no more tables to define innate abilities.
Quote
BUT we cant use Barehanded without equipping it
What are you saying here? The Monk has the "Innate Ability: Barehanded" bit set. When you master Monk, Barehanded transfers to Freelancer/Mimic and improves their Fist damage without needing to equip Barehanded. How is it any different from Counter-Attack?

 :edit:
Quote from: FF5
Knights can hold things in both hands!
Hic!
This piece of dialogue suggests that Double Grip may have been intended as an innate ability for Knight during development of the game. They may have decided to remove it because it was too powerful.
« Last Edit: June 07, 2016, 05:23:17 AM by Jorgur »

Squall

  • Dark Dragon
  • *
  • Posts: 486
    • View Profile
Re: FFV Damage Calculator
« Reply #54 on: June 07, 2016, 06:14:37 AM »
Quote
What are you saying here? The Monk has the "Innate Ability: Barehanded" bit set. When you master Monk, Barehanded transfers to Freelancer/Mimic
Yes

Quote
and improves their Fist damage without needing to equip Barehanded. How is it any different from Counter-Attack?
No. If it was that way it will be exactly what innates do, but you need to 'equip' it in order to get the dmg bonus. Besides you can equip it without mastering Monk ... thats why its doesn't fit to innate definition/understanding.

Quote
This piece of dialogue suggests that Double Grip may have been intended as an innate ability for Knight during development of the game. They may have decided to remove it because it was too powerful.
Interesting ... that would be my first guess too :D

Jorgur

  • Moderator
  • *
  • Posts: 437
  • Gender: Male
    • View Profile
Re: FFV Damage Calculator
« Reply #55 on: June 07, 2016, 07:38:26 AM »
Quote
you need to 'equip' it in order to get the dmg bonus
I just tested it on the SNES version. Lenna does 792 damage unarmed (Freelancer, Monk mastered, no Brawl ability equipped). Which version are you playing?
« Last Edit: June 07, 2016, 09:31:18 AM by Jorgur »

Squall

  • Dark Dragon
  • *
  • Posts: 486
    • View Profile
Re: FFV Damage Calculator
« Reply #56 on: June 08, 2016, 02:22:23 AM »
Hmm, I use PC (aka Steam) version. Tested it there and Barehanded works as normal innate...
It seems Djibriel's doc has mistakes in it. TBH I never tested it because Monk is not my job of preference, so I just assume that what he wrote is true.
Thank you for checking Jorgur!

So that mean all innates work as they should. Two-handed is most likely excluded later on. Berserk conform (1) but not (2). Thats good because we dont want our Freelancer to start with Auto-Berserk, dont we :D

Squall

  • Dark Dragon
  • *
  • Posts: 486
    • View Profile
Re: FFV Damage Calculator
« Reply #57 on: June 08, 2016, 06:17:42 AM »
Pre-alfa 4 is out!

Jobs, Abilities, Master Jobs, Innates are incorporated and should work properly (except Berserk). 4 slots for command are added (instead of 1). They could be customized, but are automatically filled with Jobs default commands.
Thanks to that info, now all derived stats should be 100% accurate. Every change you make in the char setup automatically calls 'CALC' which recalculated all derived stats :D
Now all implemented actions should work accurate, except weapons that have FX.

Edit: You must download again the zip file and extract data files (.csv) in the same folder the application is!

P.S. Since the possible combinations of char setup is so huge, its not possible for a single person to check, I will be VERY thankful if you can check your char/char setup vs my Calculator at your current play-trough (or old/new saves). The best will be if you check your hole party in low, mid & best setup. If you see any difference between what the game status report and my Calculator pls report (screenshot may be the best)

Jorgur

  • Moderator
  • *
  • Posts: 437
  • Gender: Male
    • View Profile
Re: FFV Damage Calculator
« Reply #58 on: June 08, 2016, 07:19:15 AM »
FFVDmgCalc.ini doesn't seem to be included, or am I missing something?

 :edit:
Typo: Deffense

 :edit:
According to instructrtrepe's algorithm guide, the Kick ability is supposed to have 3 less attack power than an unarmed attack. The calculator currently does not take that into account.
My theory is that unarmed attacks use the attack power of the weapon "Empty", while Kick does not.

 :edit:
According to instructrtrepe's algorithm guide, Barehanded Up should only be in effect if the Brawl ability is applied. The calculator increases the damage even without Brawl.
« Last Edit: June 08, 2016, 07:40:27 AM by Jorgur »

Squall

  • Dark Dragon
  • *
  • Posts: 486
    • View Profile
Re: FFV Damage Calculator
« Reply #59 on: June 08, 2016, 10:04:18 AM »
The .ini is not required, thats why I haven't included it. It contain only data about your characters. You may create one by clicking 'Save'.
Thank you for the spotting typos, I really appreciate it!!!

Quote
According to instructrtrepe's algorithm guide, the Kick ability is supposed to have 3 less attack power than an unarmed attack
pls check how it works on SNES. My guess is that he might be right, because 'Attack' (Fight) uses 12 bytes for weapon def (the weapon for Fist attack is Empty/Unarmed), which include 3 for battle power - $7A03. Kick uses action which has 8 bytes first 4 and last 4. Battle power is not between them. They both use DF: 30. I followed all brances in Kick and I didnt see command that writes in $7A03. So the battle power has a value that was used before calling Kick, most likely 0.
In short: instructrtrepe's  is most likely right (for SNES).

However in my PC version you might know that Kick was fixed ... it doesn't take into account row (your or the enemy) so you get nice full dmg even from behind and even to enemy that are in Back. I checked the dmg - both Kick and Attack produce the same dmg. I was testing Galuf, level 7 Monk, naked (vs Goblin). Both Kick and Attack were producing 51 or 54 dmg (excluding crits) - same as calculated in the Calculator.

Quote
According to instructrtrepe's algorithm guide, Barehanded Up should only be in effect if the Brawl ability is applied. The calculator increases the damage even without Brawl.
If your char is a Monk, yes Brawl is in effect even without learning/equipping. Could you share a pic of your char setup (left 1/3 of the screen)? Sharing the ini is also an option. Probably the best will be to Save your char setup, and to copy the section of the .ini thats for that char here as comment :)