øAslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&action=printpage;topic=2188.0e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/indexfb21-2.htmlslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&topic=2188.0e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/indexfb21-2.html.zxð:h^ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÈÀKƒµOKtext/htmlISO-8859-1gzip@øÕƒµÿÿÿÿÿÿÿÿWed, 11 Mar 2020 01:28:40 GMT0ó°° ®0®P®€§²ð®ï:h^ÿÿÿÿÿÿÿÿ1eƒµ Print Page - FFV Damage Calculator

Board of Slick

Library of the Ancients => Final Fantasy V Research & Development => Topic started by: Squall on March 30, 2016, 07:44:29 AM

Title: FFV Damage Calculator
Post by: Squall on March 30, 2016, 07:44:29 AM
Hey guys,

maybe you've heard that name many time, but have seen nothing so far. That's why I decided to release a stable version.  I will be happy to hear from you your comments, suggestion or critics :)

Download:  Additional files (https://drive.google.com/file/d/0B9eDezdHI7RWNzdCUHBPSHdmMkU/view?usp=sharing)  FFVDmgCalc 0.4.1 (.exe only) (https://drive.google.com/file/d/0B9eDezdHI7RWUXk4LVB0NWRmV0E/view?usp=sharing)
You need to extract the additional files and the .exe in the same folder

Instructions:
You need to setup your characters, by specifying level, ability, equipment,... At any time you can 'Save' or 'Load' character information. For now only one save. Once you are done with a character, press 'CALC' to calculate its derived stats.
The damage calculation is done on the right side. First you need to select an enemy and then you may perform different attacks (Attack, GilToss, Animals - you can choose which one

Versions:
pre-alfa. Initial release.

pre-alfa2. Element info added. Status info added. Row placement. Some internal flags are visualized.

pre-alfa3. Many changes. Almost all magic/actions implemented.

pre-alfa4. Jobs, Abilities, Master Jobs, Innate are incorporated. Stats should be 100% accurate. Increased Dmg accuracy.

To-Do:
Items full info
Enemies full info
Enemy formations
Add missing actions!
Implement all internal routines.
Implement Attack FXs

Credits:
Board of Slick, FFV community
Title: Re: FFV Damage Calculator
Post by: Jorgur on March 30, 2016, 09:20:17 AM
An interesting program. I like how you can use this to see the Knives' parameters bug in action.

Title: Re: FFV Damage Calculator
Post by: Squall on March 30, 2016, 09:52:02 AM
Thank you Jorgur!

Its still work-in-progress, but it will come :D
My goal was not simply to show a number, rather to show the main components in the final damage (Atk, M, Def, Hit, Duration) and how equipment, level (soon - Status, Elements) change it.

You may use it to compare the output of 2 weapons by equipping them in left/right arms (as far as they dont boost stats) or on 2 different character (less handy but more accurate). Latter on I plan to add options for 'fraction M', maybe even 'not-bugged knife'.

Personally I want to see final dmg as all numbers between min and max, rather the stutter implementation of Square. By stutter I mean for knife you have 4 possible dmg values, not all numbers in a range)
Title: Re: FFV Damage Calculator
Post by: Squall on April 01, 2016, 09:23:55 AM
Hey guys can you help me understand this:
Code: [Select]
Apply Status Effect 1
C2/8CAC: A6 49        LDX $49
C2/8CAE: BD 35 20     LDA $2035,X
C2/8CB1: 25 59        AND $59       (Check Status1 Immune)
C2/8CB3: D0 76        BNE $8D2B
C2/8CB5: A5 48        LDA $48
C2/8CB7: C9 04        CMP #$04      (Target = Monster?)
C2/8CB9: B0 46        BCS $8D01
C2/8CBB: A5 59        LDA $59
C2/8CBD: 29 02        AND #$02      (Inflict Status1 = Zombie?)
C2/8CBF: F0 40        BEQ $8D01
C2/8CC1: BD 1A 20     LDA $201A,X
C2/8CC4: 1D 70 20     ORA $2070,X
C2/8CC7: 29 42        AND #$42      (Target Status1 = Stone or Zombie?)
C2/8CC9: D0 60        BNE $8D2B     Effect Misses
C2/8CCB: A6 32        LDX $32
C2/8CCD: DA           PHX
C2/8CCE: A5 48        LDA $48
C2/8CD0: 20 82 24     JSR $2482
C2/8CD3: A6 32        LDX $32
C2/8CD5: A9 80        LDA #$80
C2/8CD7: 9D 56 20     STA $2056,X
C2/8CDA: 9E 57 20     STZ $2057,X
C2/8CDD: A5 48        LDA $48
C2/8CDF: AA           TAX
C2/8CE0: B9 7F 3D     LDA $3D7F,Y
C2/8CE3: C9 7F        CMP #$7F
C2/8CE5: 90 02        BCC $8CE9
C2/8CE7: A9 7F        LDA #$7F
C2/8CE9: 9D 04 7C     STA $7C04,X
C2/8CEC: 7B           TDC
C2/8CED: 99 FB 3C     STA $3CFB,Y
C2/8CF0: 1A           INC
C2/8CF1: 99 7F 3D     STA $3D7F,Y
C2/8CF4: A6 49        LDX $49
C2/8CF6: 9E 06 20     STZ $2006,X   HP = 0
C2/8CF9: 9E 07 20     STZ $2007,X
C2/8CFC: FA           PLX
C2/8CFD: 86 32        STX $32
C2/8CFF: 80 16        BRA $8D17
C2/8D01: A5 48        LDA $48
C2/8D03: C9 04        CMP #$04
C2/8D05: 90 10        BCC $8D17     (Target = Monster?)
C2/8D07: A5 59        LDA $59
C2/8D09: 29 40        AND #$40      (Target Status1 = Stone?)
C2/8D0B: F0 0A        BEQ $8D17
C2/8D0D: BD 1A 20     LDA $201A,X
C2/8D10: 09 80        ORA #$80      (Add 80h to current status1)
C2/8D12: 9D 1A 20     STA $201A,X
C2/8D15: 80 11        BRA $8D28
C2/8D17: A6 49        LDX $49
C2/8D19: BD 1A 20     LDA $201A,X   
C2/8D1C: 29 02        AND #$02
C2/8D1E: D0 0B        BNE $8D2B
C2/8D20: BD 1A 20     LDA $201A,X
C2/8D23: 05 59        ORA $59       (Inflict Status Effect)
C2/8D25: 9D 1A 20     STA $201A,X
C2/8D28: 4C A5 92     JMP $92A5
C2/8D2B: E6 56        INC $56       (Status Effect Misses)
C2/8D2D: 60           RTS

I dont need detail explanation, just a script-like version. Too bad Tseng havent done it himself. So far I understood that:

It first check for immunity.
Then it check Target = Monster? (not sure why this matters, but code is different if so)
Then it check Target Status1 = Stone or Zombie?, if so miss
Then there is ATB part which I dont need atm
...
In the end Inflict Status Effect.

P.S. I expected simple OR but it seems there many checks. Please help me understand what I need to check before 'OR' :D
Title: Re: FFV Damage Calculator
Post by: samurai goroh on April 02, 2016, 09:27:55 AM
What I understand from the comments is that is a check on Status 1 (Curable) for instant kill status (Zombie & Petrify). If the attack hits then it sets the HP to 0 & sets the Dead flag to 1.

You can get immunity to zombie if you equip Angel Rings, so only allies can protect from Zombie status and enemies can't. However, I don't recall a method you can use to inflict zombie as there are no spells nor released monsters that would do that (well it seems that the Karnaks in the Iron Claw fight would inflict Zombie Breath but they are immune to being captured & you don't even have the skill yet at that time...). I though that maybe through confuse/control there was an enemy, so I took a look and there was none.
Title: Re: FFV Damage Calculator
Post by: Squall on April 04, 2016, 04:03:41 AM
Thank you samurai goroh, it seems I missed the instant kill part.

Here is another one:
Code: [Select]
Apply Status Effect 4
C2/8E05: A6 49        LDX $49
C2/8E07: A5 59        LDA $59
C2/8E09: 29 10        AND #$10
C2/8E0B: F0 0A        BEQ $8E17
C2/8E0D: BD 1D 20     LDA $201D,X
C2/8E10: 1D 73 20     ORA $2073,X
C2/8E13: 25 59        AND $59
C2/8E15: D0 0B        BNE $8E22
C2/8E17: BD 1D 20     LDA $201D,X
C2/8E1A: 05 59        ORA $59
C2/8E1C: 9D 1D 20     STA $201D,X  (Apply Status Effect 4)
C2/8E1F: 4C 72 93     JMP $9372
C2/8E22: E6 56        INC $56      (Attack Misses)
C2/8E24: 60           RTS
$201D and $2073 hold separate versions of Status 4, do you know why and what is the difference?
It seems AND #$10 (Countdown) makes the difference, but I have no clue what is so special about Countdown ...
Title: Re: FFV Damage Calculator
Post by: Jorgur on April 04, 2016, 08:37:52 AM
$201D is the current status. $2073 is the initial status. You can see this in samurai goroh's PAR codes document.

The code goes something like this:
- Load target X offset
- Load the status in question
- Check if it is Countdown
- If yes, check if target has initial or current status Countdown
- If yes, the attack misses
- Otherwise, inflict the status

Not entirely sure what JMP $9372 does, though.


Title: Re: FFV Damage Calculator
Post by: Squall on April 06, 2016, 07:05:45 AM
O boy, when looking in the asm code you can stumble on interesting 'effects':

1. Duration
Duration = 2 * SpellDuration + (AttackerLevel/4) - (TargetLevel/4)
now you may think that if both levels are equal Duration = 2* SpellDuration
why dont you try with: SpellDuration = 125, AttackerLevel = 40, TargetLevel =40
well you may expect that Duration = 250, BUT Square calcs it as 245.
same goes, when AttackerLevel > TargetLevel  ... instead of duration increase you get decrease :D

2. Protect, Shell
every FF know that they divide dmg by 2 ...
well that is true only in 50% of the time. In the other half of the time they reduce the dmg even more
for example: Atk = 40, Def = 0, M = 5, we will do 200 dmg
you may expect that with shell/protect we will get 100, but actually we will get 80 ...

3. Row modifier
yes, yes we know back row and we get half, if enemy is in back - we get another half
so what will happen if we do Attack with params from Protect/Shell exam?
normal dmg - 200; from the back row - 100, if target is in back too - 50
no, no, no ... in the game you will see 80/40 (so if both back we get divide by 5 instead of 4)

P.S. I'm curious can you guess why?
Title: Re: FFV Damage Calculator
Post by: Jorgur on April 06, 2016, 08:52:47 AM
Yep, the SNES does not use decimal numbers, so when dividing, the result is rounded down to the nearest whole number. Another thing worth mentioning is that M can not go lower than 1, so 1 / 2 = 1. This is why defending and being in the back row has no effect when fighting Goblins. You can use the Fractional M patch to counter this.

Title: Re: FFV Damage Calculator
Post by: Squall on April 06, 2016, 09:47:10 AM
Hehe, right on spot Jorgur, although that is the explanation for cases 2 & 3. 1 is caused by other issue :D

BTW I need a little bit of work to release next pre-alfa 2. There you can easily spot these 'effects'. Things are getting smoother with coding and even reading some of the asm-code to see more details. As a result I fully decoded DF $51 P2 bit-values and have updated them in the Wiki. What is really amusing is that you can do more then one effect with it (like increase level & atk)

P.S. For those of you guys that write hacks, here is an idea, P2 with values $02 or $08 have no items/actions that can trigger them (as far as I know). $02 gives pDef/mDef + P3. I would love to see an item that boost char defs :)
Title: Re: FFV Damage Calculator
Post by: Jorgur on April 07, 2016, 08:49:03 AM
As a result I fully decoded DF $51 P2 bit-values and have updated them in the Wiki.
Please do not edit my wiki documents. I use my own text files when I work on them so everything you add will eventually disappear when I update the pages.
You can create new pages (personal or collaboratory). Type the desired page name into the search field and click create page.
Title: Re: FFV Damage Calculator
Post by: Squall on April 07, 2016, 09:37:51 AM
Hmm, in the past when I tried to pass to you things that I found missing/wrong you suggested to directly edit ... Anyway I will not do it again, just tell me what to do with the info I got.

Personally I think its better to pass the info to your attention and you will be the one to correct wiki. My goal is not to make my page rather a single page with accurate FFV info. I think that the best is when 1 person maintain the info, and all of the rest read and report mistakes (if any)
Title: Re: FFV Damage Calculator
Post by: Squall on April 08, 2016, 06:40:28 AM
Here is another interesting question that was in my head for long time:

What will happen if a monster has Absorb & Weakness to a specific element and you do dmg with that element?
I was thinking about that when I started coding elements. I hopped there is no such case. Sadly there is ... Byblos, it can absorb and be weak to Holy.

Similar to it is:
if a monster has Absorb to Fire and Weakness to Ice, what will happen when we hit with multi-elemental dmg Fire & Ice :)
Title: Re: FFV Damage Calculator
Post by: Squall on April 08, 2016, 08:42:10 AM
A new pre-alfa 2 version is out. Many new 'actions' were added. Dmg calculation now take into account things like status, element affinity, but there are still some loose ends.

I will really like to hear your opinion and suggestion for future improvements :)
Title: Re: FFV Damage Calculator
Post by: Jorgur on April 08, 2016, 09:48:10 AM
Hmm, in the past when I tried to pass to you things that I found missing/wrong you suggested to directly edit
It's fine to edit, but there are certain pages I have labelled "Please do not edit". These are personal projects of mine and I would rather not use others' contributions in them.
My goal is not to make my page rather a single page with accurate FFV info.
Then by all means, make one. You could put it under "Collaborations".
A new pre-alfa 2 version is out. Many new 'actions' were added. Dmg calculation now take into account things like status, element affinity, but there are still some loose ends.

I will really like to hear your opinion and suggestion for future improvements :)
It would be nice if you could switch between GBA/SNES/PS names.
Title: Re: FFV Damage Calculator
Post by: x0_000 on April 08, 2016, 02:39:35 PM
Here is another interesting question that was in my head for long time:

What will happen if a monster has Absorb & Weakness to a specific element and you do dmg with that element?
I was thinking about that when I started coding elements. I hopped there is no such case. Sadly there is ... Byblos, it can absorb and be weak to Holy.

Similar to it is:
if a monster has Absorb to Fire and Weakness to Ice, what will happen when we hit with multi-elemental dmg Fire & Ice :)
If the algorithms guide is correct, if the target can absorb any element of the attack the the attack is automatically healing, and if the monster is weak to any element of the attack then the number is increased accordingingly (so in both cases the monster would be healed by a larger amount than if they didn't have a weakness.)
Title: Re: FFV Damage Calculator
Post by: Squall on April 11, 2016, 02:05:13 AM
It would be nice if you could switch between GBA/SNES/PS names.
That actually easily can be done. In parser application just open SNES rom and export the data in .csv, just save it as GBA_xxx in the dmg calc folder.

x0_000 if I understood you well, the check for Absorb is first and if it triggers no more checks?
Title: Re: FFV Damage Calculator
Post by: Jorgur on April 11, 2016, 09:34:47 AM
It would be nice if you could switch between GBA/SNES/PS names.
That actually easily can be done. In parser application just open SNES rom and export the data in .csv, just save it as GBA_xxx in the dmg calc folder.
Still, I wish there was an easier way.
Title: Re: FFV Damage Calculator
Post by: x0_000 on April 11, 2016, 02:34:43 PM
It would be nice if you could switch between GBA/SNES/PS names.
That actually easily can be done. In parser application just open SNES rom and export the data in .csv, just save it as GBA_xxx in the dmg calc folder.

x0_000 if I understood you well, the check for Absorb is first and if it triggers no more checks?
According to the algorithms guide it goes through all the checks, the game only skips checks on immunity (which forces the attack to miss.) The GBA assembly code seems to support that but I haven't looked at the functions in detail.
Title: Re: FFV Damage Calculator
Post by: Squall on April 18, 2016, 02:36:47 AM
Hey guys, here is another interesting situation, that I stumble upon playing with my DmgCalc:

What will happen if we hit DevilCrab (weak to ice) with Broadsword after we have used 'Blizzard' (aka Ice1) SpellBlade? Personally I will expect x2 dmg ...
BUT my calculator showed x4 dmg. According to the Algorithm (and I checked that in the asm code, too):
Code: [Select]
ATTACK TYPE (HEX: 31) (Swords)
...
9) Apply Magic Sword modifiers to Attack, Defense and M (6.5.15).
10) Apply Attack Element modifiers to Attack and Defense (6.5.16).
    Note that Magic Sword elements override weapon attack elements.

In step 9 we get x2 and in step 10 we get another x2 for total x4 (def = 0)
So that mean when we use Spell Blade with element that target is weak, we get extra x2 ...
Am I doing something wrong???
Title: Re: FFV Damage Calculator
Post by: Jorgur on April 18, 2016, 12:33:31 PM
Quote
9) Apply Magic Sword modifiers to Attack, Defense and M (6.5.15).
This is the Magic Sword element.
Quote
10) Apply Attack Element modifiers to Attack and Defense (6.5.16).
    Note that Magic Sword elements override weapon attack elements.
This is the weapon element.
Let's say you are using the Flame Tongue sword. Usually the weapon element is fire, but if a Magic Sword spell is cast, the weapon element should not come into play.
Code: [Select]
Magic Sword Modifiers to Physical
C2/8684: A6 32        LDX $32
C2/8686: BD 50 20     LDA $2050,X 
C2/8689: 1D 51 20     ORA $2051,X
C2/868C: 1D 52 20     ORA $2052,X
C2/868F: 85 4D        STA $4D      ($4D = Magic Sword Element)
C2/8691: 1D 53 20     ORA $2053,X
C2/8694: 1D 54 20     ORA $2054,X
C2/8697: 1D 55 20     ORA $2055,X
C2/869A: F0 02        BEQ $869E
C2/869C: E6 60        INC $60
C2/869E: BD 55 20     LDA $2055,X
C2/86A1: 10 12        BPL $86B5
C2/86A3: C2 20        REP #$20
C2/86A5: 18           CLC
C2/86A6: A5 50        LDA $50
C2/86A8: 69 64 00     ADC #$0064   (Damage = Damage + 100)
C2/86AB: 85 50        STA $50
C2/86AD: 46 54        LSR $54
C2/86AF: 46 54        LSR $54      (Defense = Defense / 4)
C2/86B1: 7B           TDC
C2/86B2: E2 20        SEP #$20
C2/86B4: 60           RTS
Notice this?
C2/869C: E6 60        INC $60
Code: [Select]
Elemental Status Modifiers to Physical
C2/8734: A5 60        LDA $60
C2/8736: D0 35        BNE $876D
C2/8738: A6 49        LDX $49
C2/873A: BD 30 20     LDA $2030,X    (Check for Elemental Absorb)
C2/873D: 25 4D        AND $4D
C2/873F: F0 07        BEQ $8748
C2/8741: E6 62        INC $62
C2/8743: 64 54        STZ $54        (Defense = 0)
C2/8745: 64 55        STZ $55       
C2/8747: 60           RTS
And this:
C2/8734: A5 60        LDA $60
C2/8736: D0 35        BNE $876D

If a magic sword spell is present the weapon element code is skipped entirely.
Title: Re: FFV Damage Calculator
Post by: Squall on April 18, 2016, 03:18:10 PM
I knew that it was too good to be true :D

Ahh I see now ... so $60 hold a flag - do we have a SpellBlade.
Yes I missed INC $60 ... not because I didnt see the code, but there are couple of flag variable, some without description, some change the meaning in different subroutines (like '$4D = Base Hit%', but in all subroutines that I've looked it hold the Element of the action/magic)

THANK you Jorgur!!! Mistery solved, no extra x2.
Well thats why I try to check with the asm code (as much as I can understand)... cant trust the description only :D
What is interesting that in my implementation I used only 3 variables, not 6 ($2050-$2055) and much simple logic (no need for 6 ORs) :D

Edit> Currently I play SpaceQuest V. Its an adventure ('point & click) game and if you miss a detail you pretty much will not be able to solve a puzzle. I felt almost as I missed a detail from the puzzle :D
Title: Re: FFV Damage Calculator
Post by: Squall on April 28, 2016, 09:39:44 AM
How to add a document in slick/doc ?
Title: Re: FFV Damage Calculator
Post by: Jorgur on April 28, 2016, 05:38:55 PM
Type the desired name of the page in the Search field. If the page does not already exist you can click on the "Create the page" link.

To link to it in the FF5 hacking page, click on Edit where you want your link. You can just copy/paste another link and change it to link to your page.
Title: Re: FFV Damage Calculator
Post by: Squall on May 03, 2016, 06:34:02 AM
That thing doesn't work properly ... when I pasted the text in the newly created page my browser start to lag and constant Wait or kill window.

I was thinking to do it as: http://slickproductions.org/docs/FF5/Bank%20C2%20disassembly.txt just different file name, but I cant find a way to upload there
Title: Re: FFV Damage Calculator
Post by: Jorgur on May 03, 2016, 08:42:35 PM
Everthing seems to be working for me, so it must be problem on your end. Have you tried using a different browser?
Title: Re: FFV Damage Calculator
Post by: Squall on May 04, 2016, 02:52:10 AM
I tried Chrome, Opera - same problem.
Then I tried FireFox it works ... but doesnt put new lines (line breaks) as is in the .txt file. Do you know how to fix it?
You may check I created 'Squall' section in Wiki-FF5
Title: Re: FFV Damage Calculator
Post by: Jorgur on May 04, 2016, 06:02:51 PM
The text formatting is a bit different in a wiki. You will have to use a text processor of some kind to get the formatting right.
https://www.mediawiki.org/wiki/Help:Formatting
Title: Re: FFV Damage Calculator
Post by: Squall on May 05, 2016, 03:48:02 AM
o boy it is the HTML sh.t  :(

Is there a way to upload the txt file here: http://slickproductions.org/docs/FF5/
Title: Re: FFV Damage Calculator
Post by: Jorgur on May 05, 2016, 06:37:31 AM
It's not HTML. Open another wiki page and click edit and you will see what I mean.
Is there a way to upload the txt file here: http://slickproductions.org/docs/FF5/
Yes, the submissions forum, but the site admin rarely adds new submissions to the site (if ever). He intends for us to use the wiki for these things nowadays.
Title: Re: FFV Damage Calculator
Post by: Squall on May 05, 2016, 08:17:32 AM
I was referring to this:
Code: [Select]
Paragraphs
MediaWiki ignores single line breaks. To start a new paragraph, leave an empty line. You can force a line break within a paragraph with the HTML tag <br />.
In Edit I simply copy->paste the text from my working .txt file (from Notepad, Wordpad) and it really ignores line breaks (not sure what they mean by single ...). Here is a link to that: http://slickproductions.org/slickwiki/index.php/Bank_C2

Anyway, here is another interesting piece of code - Old (age) timer:
Code: [Select]
C2/2264: A9 01        LDA #$01
C2/2266: 99 F7 3C     STA $3CF7,Y
C2/2269: B9 FF 3D     LDA $3DFF,Y
C2/226C: 99 7B 3D     STA $3D7B,Y
C2/226F: A6 32        LDX $32
C2/2271: 64 0E        STZ $0E
C2/2273: BD 24 20     LDA $2024,X
C2/2276: 3A           DEC
C2/2277: F0 03        BEQ $227C
C2/2279: 9D 24 20     STA $2024,X
C2/227C: BD 28 20     LDA $2028,X
C2/227F: 3A           DEC
C2/2280: F0 03        BEQ $2285
C2/2282: 9D 28 20     STA $2028,X
C2/2285: E8           INX
C2/2286: E6 0E        INC $0E
C2/2288: A5 0E        LDA $0E
C2/228A: C9 04        CMP #$04
C2/228C: D0 E5        BNE $2273
C2/228E: AE CE 3E     LDX $3ECE
C2/2291: BD B7 3E     LDA $3EB7,X
C2/2294: C9 04        CMP #$04
C2/2296: 90 14        BCC $22AC
C2/2298: A6 32        LDX $32
C2/229A: BD 02 20     LDA $2002,X
C2/229D: 3A           DEC
C2/229E: F0 03        BEQ $22A3
C2/22A0: 9D 02 20     STA $2002,X
C2/22A3: BD 44 20     LDA $2044,X
C2/22A6: 3A           DEC
C2/22A7: 10 03        BPL $22AC
C2/22A9: 9D 44 20     STA $2044,X
C2/22AC: 60           RTS
Somehow I fail to see how that is interpreted as:
"Aging vs Characters: All stats decrease to 1 (not Level)
Aging vs Monsters: Level and Speed decreases to 1"

I see two problems:
- $2024 .. $202B are ALWAYS decreased (I dont see any check there) That would suggest that it affects monsters too
- $2044 is considered Attack power, not Speed/Agi
Title: Re: FFV Damage Calculator
Post by: Squall on May 05, 2016, 09:30:26 AM
Pre Alfa 3 is out :D

There are MANY, many changes, mainly internal. Most of the routines now have actual working code. Things like Spell Blade, powered elements works. Many of the core routines were rewritten or corrected after looking in the asm-code.
On the surface - most of actions were implemented. I know atm it may look as complete mess, but I need as much as possible visual input/output of what is going inside.

Why still alfa? Well I would considered completed when I can do an action from Monster -> Char, not just Char -> Monster. If things goes well it may end up doing battles - like you set up your chars and do a FULL battle vs monster formation but that will be for version 2 :D

P.S.
1. I need your input about the interface ... I do things mainly from "what I need" perspective, not from "what will be comfy", but that must change after I have a stable core.
2. If you can check things vs your current play-trough ... please report every difference you see from calculated dmg (a screenshot of the program will be great) and the game
Title: Re: FFV Damage Calculator
Post by: Jorgur on May 05, 2016, 10:01:43 PM
I was referring to this:
Code: [Select]
Paragraphs
MediaWiki ignores single line breaks. To start a new paragraph, leave an empty line. You can force a line break within a paragraph with the HTML tag <br />.
In Edit I simply copy->paste the text from my working .txt file (from Notepad, Wordpad) and it really ignores line breaks (not sure what they mean by single ...). Here is a link to that: http://slickproductions.org/slickwiki/index.php/Bank_C2
Here is how I did it:
http://slickproductions.org/slickwiki/index.php/Jorgur:SD3_D0_Disassembly
Title: Re: FFV Damage Calculator
Post by: Squall on May 06, 2016, 06:56:58 AM
Here is how I did it:
http://slickproductions.org/slickwiki/index.php/Jorgur:SD3_D0_Disassembly
Yeah something like this is what I imagine it, but skipping my line breaks just kill it :(
Title: Re: FFV Damage Calculator
Post by: LightPhoenix on May 07, 2016, 05:07:30 PM
Somehow I fail to see how that is interpreted as:
"Aging vs Characters: All stats decrease to 1 (not Level)
Aging vs Monsters: Level and Speed decreases to 1"

I see two problems:
- $2024 .. $202B are ALWAYS decreased (I dont see any check there) That would suggest that it affects monsters too
- $2044 is considered Attack power, not Speed/Agi

You're correct on both accounts.

Timer ending code is run on a per-creature basis, and there's no checks prior to this to differentiate between monsters and players, it just passes in creature data indices and offsets.  As long as this timer is set to trigger, it will run on either monsters or players.

$2044 is best thought of as "Monster Attack".  It's only used by monsters, not by players.  Incidentally, this is why Power Drink is bugged - it increases this variable, but it's never used in player calculations (except for Goblin Punch).  For monsters, this value needs to be decremented since most monster physical attacks use this value.

$3EB7,X is the creature index of whatever creature's timer is ending.  As with many (but not all) creature indices, 0-3 indicate players and 4-B indicate monsters.

I don't see anything else in a cursory search of the code that suggests monsters can't be affected by Old, and they appear to use $2028-B during other calculations (see C2/0248).
Title: Re: FFV Damage Calculator
Post by: Squall on May 11, 2016, 02:49:17 AM
You're correct on both accounts.
...
$2044 is best thought of as "Monster Attack".  It's only used by monsters, not by players.  Incidentally, this is why Power Drink is bugged - it increases this variable, but it's never used in player calculations (except for Goblin Punch).  For monsters, this value needs to be decremented since most monster physical attacks use this value.
That makes Age/Old even more powerful then we thought it is !!!

Here you are another interesting code:
Code: [Select]
Calculate Final Damage
C2/8811: 20 F8 93     JSR $93F8    Calculate Final Damage, Store in $7B69
C2/8814: AE 69 7B     LDX $7B69
C2/8817: D0 04        BNE $881D
C2/8819: 8E 6D 7B     STX $7B6D    $7B6D = Final Damage
C2/881C: 60           RTS

C2/881D: A5 39        LDA $39
C2/881F: AA           TAX
C2/8820: BD FD 79     LDA $79FD,X  A = Attack Type
C2/8823: A6 49        LDX $49      X = Target offset
C2/8825: 3D 64 20     AND $2064,X  (Check Target Can't Evade vs. Attack type)
C2/8828: F0 06        BEQ $8830
C2/882A: C2 20        REP #$20
C2/882C: 06 52        ASL $52      M = M * 2
C2/882E: E2 20        SEP #$20
C2/8830: A6 32        LDX $32
C2/8832: BD 55 20     LDA $2055,X
C2/8835: 29 40        AND #$40    (Check Magic Sword Drain)
C2/8837: F0 03        BEQ $883C
C2/8839: 4C 26 89     JMP $8926
C2/883C: BD 55 20     LDA $2055,X
C2/883F: 29 20        AND #$20    (Check Magic Sword Psyche)
C2/8841: F0 03        BEQ $8846
C2/8843: 4C 4D 89     JMP $894D
C2/8846: A5 62        LDA $62     Check if Healing?
C2/8848: F0 07        BEQ $8851
C2/884A: AE 69 7B     LDX $7B69
C2/884D: 8E 71 7B     STX $7B71   $7B71 = Final Damage
C2/8850: 60           RTS

If I read the code correctly that mean that if 'Target Can't Evade vs. Attack type' we get 2x dmg  ...
Title: Re: FFV Damage Calculator
Post by: assassin on May 11, 2016, 04:05:17 AM
^ yes, and also in Function C2/8A05.  but the bonus is only for certain types of attacks, as most won't recalculate damage after the M doubling.  and in both functions, the 2x damage is skipped for some M values, more grievously so in C2/8A05; i'm convinced that both skippings are bugs.

this was discussed previously:
http://slickproductions.org/forum/index.php?topic=1980.msg22024#msg22024
http://slickproductions.org/forum/index.php?topic=1975.msg22021;topicseen#msg22021
http://slickproductions.org/forum/index.php?topic=1975.msg21644;topicseen#msg21644

i recently put all of that into a (nearly) fully-fledged description, and corrected a wrong boolean (i got confused):
http://assassin17.brinkster.net/forum-posts/ff5-m-doubling-cant-evade-flooring-bug-desc1-excerpt.txt

the referenced "this patch" doesn't exist yet, mainly because i still don't know what Variable $63 does, and want a complete description before releasing anything.  however, i have little doubt they're bugs (with each being an inverse problem of the other), and fixing the nastier one just involves editing a single byte (branch length).
Title: Re: FFV Damage Calculator
Post by: Squall on May 11, 2016, 09:07:57 AM
I'm kind of new to the community so I had missed these interesting discussions. When I found it I was 'o wooah' hopping for general dmg boost ... as you said: "this M bonus doesn't seem well-known to begin with (i can't find it in the Algorithms/Stats FAQ)".

But you are right - it is used in very rare cases and for healing (because dmg is not recalculated) :(


Edit: Could you help me pinpoint in asm code where weapon FX (after or instead) is checked and what code is executed?
Title: Re: FFV Damage Calculator
Post by: assassin on May 12, 2016, 08:11:39 AM
which weapon FX?  are you talking about "Magic Sword Drain" and "Magic Sword Psych"?  and is the question in reference to the "Target Can't Evade vs. Attack type" bonus, or just generally speaking?

if the latter, do you mean the different formulas (Damage Types), or add-on spells/etc.?
Title: Re: FFV Damage Calculator
Post by: Squall on May 12, 2016, 08:36:23 AM
No I was talking about: http://slickproductions.org/slickwiki/index.php/Jorgur:FF5_Item_data#5:_Special_properties
more precisely:
- 08 Action on hit
- 02 Ability instead of attack
Title: Re: FFV Damage Calculator
Post by: assassin on May 12, 2016, 09:40:17 AM
i can't find where that weapon property byte is loaded in the C2 disassembly.  the C2/9AA9 loop does include D1/0005, and C2/9C2E will put an OR'ing of five of those bytes into STA $2039,X for armor.  best put an emulator trace on the specific D1/0005,index of the weapon you're seeking, and use the disasm to follow where it winds up from there.
Title: Re: FFV Damage Calculator
Post by: Squall on May 12, 2016, 03:39:38 PM
Hehe I use PC (aka Steam) version and things there are quite different :D

$2038 was suppose to hold special for Weapon(s) but I dont see code code for FX, just parry. I tried to follow 'Fight' routine ... but either I miss something or it ends fast :(
Title: Re: FFV Damage Calculator
Post by: assassin on May 12, 2016, 05:30:04 PM
ah.. $2038 is based on the individual hands of $408A and $4096, so search for those.  i see several bit 1 matches, but no immediate ones for bit 3.  however, they occasionally copy a hand byte into Variable $10, like at C2/464A; follow that down enough, and you'll see a bit 3 check at C2/4707.  similar deal starting at C2/4783 for the other hand.
Title: Re: FFV Damage Calculator
Post by: Squall on May 13, 2016, 02:19:50 AM
Thank you, thank you very much assassin, that is exactly what I was searching!

I always assumed that $2038 hold OR of both hand weapon special ... but it holds OR of just some of bytes bits (parry, first strike) because it doesn't make sense to hold weapon specifics like FX, Wonder Rod, SpellBlade. I didn't notice it till you pointed that equipment's 12 bytes are copied in a segment starting of $4049.

if somebody else is interesting:
- FX instead stars: C2/4650
- FX after starts: C2/470D
* similar code is for the other hand starting at C2/4781
Title: Re: FFV Damage Calculator
Post by: assassin on May 13, 2016, 04:52:13 AM
you're welcome.  i hadn't known about $2038 (my Ctrl+Fs weren't quite on), so thank you for that.  and to be complete, a Wonder Rod check is done between FX instead and FX after, and also uses Variable $10.
Title: Re: FFV Damage Calculator
Post by: Squall 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...
Title: Re: FFV Damage Calculator
Post by: LightPhoenix 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
Title: Re: FFV Damage Calculator
Post by: Squall 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.
Title: Re: FFV Damage Calculator
Post by: Squall 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?
Title: Re: FFV Damage Calculator
Post by: Jorgur 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?
Title: Re: FFV Damage Calculator
Post by: Squall 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.
Title: Re: FFV Damage Calculator
Post by: Jorgur on June 07, 2016, 02:18:28 AM
Each job has its own innate abilities listed in this table:
http://slickproductions.org/slickwiki/index.php/Jorgur:FF5_Jobs_and_abilities#Innate_abilities:_2_bytes
Title: Re: FFV Damage Calculator
Post by: Squall 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)
Title: Re: FFV Damage Calculator
Post by: Jorgur 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.
Title: Re: FFV Damage Calculator
Post by: Squall 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
Title: Re: FFV Damage Calculator
Post by: Jorgur 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?
Title: Re: FFV Damage Calculator
Post by: Squall 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
Title: Re: FFV Damage Calculator
Post by: Squall 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)
Title: Re: FFV Damage Calculator
Post by: Jorgur 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.
Title: Re: FFV Damage Calculator
Post by: Squall 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 :)
Title: Re: FFV Damage Calculator
Post by: samurai goroh on June 10, 2016, 09:25:13 PM
I noticed that there is an error with the HP/MP when you set your level to 100 or more. Also that's just the base values, for actual values there's a formula which uses Vitality and Magic Power.

Edit: Never mind the current values. Didn't set a job :P

Title: Re: FFV Damage Calculator
Post by: Squall on June 11, 2016, 01:57:00 PM
Level 100? Somebody is cheating :D
Title: Re: FFV Damage Calculator
Post by: Jorgur on June 11, 2016, 03:04:56 PM
Quote
It contain only data about your characters. You may create one by clicking 'Save'.
I have a request. I would like the program to automatically create an .ini file with default FF5 characters if no .ini file exists.
Quote
pls check how it works on SNES
Butz at level 4 does 22-24 damage with unarmed attacks as a Monk. When using Kick as a Monk he does 16 damage.
Quote
Could you share a pic of your char setup
Screenshot attached.
[Bartz]
Level=1
Job=1
Ability=0
AbilityLvl=0
BaseStr=4
BaseAgi=1
BaseSta=3
BaseMag=1
RHand=1
LHand=1
Head=129
Body=0
Accessory=0
Status=0
Command1=5
Command2=6
Command3=0
Command4=2
RShield=0
LShield=0
MasteredJobs=0
Title: Re: FFV Damage Calculator
Post by: Squall on June 11, 2016, 04:16:00 PM
Quote
I have a request. I would like the program to automatically create an .ini file with default FF5 characters if no .ini file exists.
Sure, I will do it in next release.

Quote
Butz at level 4 does 22-24 damage with unarmed attacks as a Monk. When using Kick as a Monk he does 16 damage.
Too bad that mean that SNES version has even worse Kick. Probably same is for GBA. I'm really glad I dont use these versions :D

About the dmg in Calculator ... I see where the confusion comes. There are 2 different flags:
 - Barhanded Up - a flag that comes with gear (Kaiser Knuckle)
 - Innate Brawl (Barehanded)
I called this internal flag Barehanded Up, so it can be distinguished from Innate one.
You may easily spot the difference in Min/MaxAttack part:
 - gear - it adds 50 to Attack (as in your case 3 + 50)
 - innate - adds 2*Level to Attack
Title: Re: FFV Damage Calculator
Post by: Jorgur on June 12, 2016, 05:41:20 AM
About the dmg in Calculator ... I see where the confusion comes. There are 2 different flags:
 - Barhanded Up - a flag that comes with gear (Kaiser Knuckle)
 - Innate Brawl (Barehanded)
I called this internal flag Barehanded Up, so it can be distinguished from Innate one.
You may easily spot the difference in Min/MaxAttack part:
 - gear - it adds 50 to Attack (as in your case 3 + 50)
 - innate - adds 2*Level to Attack
My point is that the Attack is not supposed to be increased. Barehanded up should not affect the unarmed damage of a Knight.
Title: Re: FFV Damage Calculator
Post by: Squall on June 12, 2016, 09:31:53 AM
O you mean that Barehanded Up is working only when we have Brawl?
Title: Re: FFV Damage Calculator
Post by: Jorgur on June 12, 2016, 10:23:51 AM
Yes, that is what it should be doing.
Title: Re: FFV Damage Calculator
Post by: Squall on June 12, 2016, 10:31:42 AM
I see. I checked on PC version and it seems that Barehanded Up doesnt work till I get the Innate. Then i checked the SNES asm code - same is there, armor flag is not checked if the innate is not set.

Thank you for spotting it Jorgur!!!
Title: Re: FFV Damage Calculator
Post by: samurai goroh on June 12, 2016, 11:16:14 AM
Level 100? Somebody is cheating :D
You can pass the limit with the mixes of Dragon Power & Sampson Power (IIRC, Hero's Song still caps max level to 99).

BTW, I tried to predict damage done to LiquidFlame using 4 Berserkers (due to how my 4JF rolled out). I was level 20 with all Mythril equipment and it said damage should be in the mid 300's, while you actually could roll hits +500 damage. Was I configuring something wrong or does it doesn't acknowledge well Axe formulas?
Title: Re: FFV Damage Calculator
Post by: Squall on June 12, 2016, 04:28:38 PM
BTW, I tried to predict damage done to LiquidFlame using 4 Berserkers (due to how my 4JF rolled out). I was level 20 with all Mythril equipment and it said damage should be in the mid 300's, while you actually could roll hits +500 damage. Was I configuring something wrong or does it doesn't acknowledge well Axe formulas?
I guess you had Mythril Axe equipped? So the calculator shower 126..378 dmg? Your setup is OK, it hasnt calculated Berserk bonus? Your Ingame dmg was in  189...567. I will correct this tomorrow.

BTW doing physical dmg vs Liquid Flame will be painful in that setup ... the axe has only 80% chance to hit, while some of the forms of the Flame have 30% evade ... I bet you will see many misses

P.S what is 4JF?
Title: Re: FFV Damage Calculator
Post by: samurai goroh on June 13, 2016, 12:32:07 AM
I guess you had Mythril Axe equipped? So the calculator shown 126..378 dmg?
Yes to both

Your setup is OK, it hasnt calculated Berserk bonus? Your In-game dmg was in  189...567. I will correct this tomorrow.
Can't remember if I saw sub 200 damage with level 20, but I surely did at level 19.

BTW doing physical dmg vs Liquid Flame will be painful in that setup ... the axe has only 80% chance to hit, while some of the forms of the Flame have 30% evade ... I bet you will see many misses
Liquid Flame is your first roadblock in a quadzerker run (4 Berserkers). Had to do it that way because that's how the challenge is. You can try to beat him as low as lv 17, but I had bad roll damages that decided to hit lv 20 (after trying several times lv 18-19)

P.S what is 4JF?
4JF stands for: Four Job Fiesta, is a charity event that is held every year around this date (June to July IIRC). If you want people to test your program, this is the perfect chance to advertise the program.

http://fourjobfiesta.com/index.php

https://www.reddit.com/r/ff5fjf/
http://www.neogaf.com/forum/showthread.php?p=205221787
Title: Re: FFV Damage Calculator
Post by: Squall on June 13, 2016, 05:08:26 AM
Pre-alfa 4.1 is out!

Its a hot-fix for the two reported bugs:
 - Kaiser Knuckles without Brawl/Barehanded
 - Berserk damage now adds +50% to Attack

As Jorgur said Berserk bit of Innate is hardcoded. It  seems they manually set the bit in $2071 (Initial/Auto status) and the game dont check the Innate bit anymore (but check $2071 quite often).
Title: Re: FFV Damage Calculator
Post by: falconflicker on July 18, 2016, 02:56:11 PM
I noted that the program does not by default know/account for the characters' individual stat modifications.
I.E. Bartz's Knight stats are
STR:47 AGI:25 STA:44 MAG:10
when they should be
STR:51 AGI:26 STA:47 MAG:11

Attached is the save ini, which I noticed has all of the BaseStats set at 0.

Setting BaseStats fields manually fixes this behavior, but resets each time I change the setup and save.
Title: Re: FFV Damage Calculator
Post by: Squall on July 19, 2016, 07:14:30 AM
Hey falconflicker, thank you for spotting it!

Initially the program was designed to start without ini. Later on it became crucial in my tests, so atm I load the ini on startup. However on clean install, you will start with base stats 0. I will fix it in next version :)

Currently you can do 2 things:
- manually edit base stats and then run the program
- get my attached ini
Title: Re: FFV Damage Calculator
Post by: assassin on February 07, 2017, 09:47:47 AM
something i was meaning to post back around May or June, then had to spend a good hour jogging my memory:

the bottom 2 bits of a weapon's Targeting byte ($4085 or $4091) are used as an index into a table to load 0, 10, 20, or 30.  this is done for each hand, with the values being added together.  the result is modified based on possessed Haste or Slow, then stored in some ATB variable.  i don't know what the actual purpose is, but it's interesting.  if the weapon casts magic ($408B), a similar thing is done with its spell's Targeting bits.

the code responsible starts at about C2/1B0D.

any existing knowledge of this or further investigation into it would be appreciated.

-------------

also, something i forgot to ask about these weapon bytes around then..  (i think this was my question, unless i had another.  that's what i get for waiting 8 months.)

when does the game ever use $408E or $409A , Parameter 1 for the weapon Action?  i see no evidence of this in Bank C2.  it'll load Attack Formula, and Parameters 2 and 3.
Title: Re: FFV Damage Calculator
Post by: Squall on February 08, 2017, 03:50:13 AM
Quote
the bottom 2 bits of a weapon's Targeting byte ($4085 or $4091) are used as an index into a table to load 0, 10, 20, or 30.  this is done for each hand, with the values being added together.  the result is modified based on possessed Haste or Slow, then stored in some ATB variable.
If by bottom you mean bit 0 & 1, they are undefined in Jorgur's document (http://slickproductions.org/slickwiki/index.php/Jorgur:FF5_Item_data)

However your observation may shed a light on 2):
Code: [Select]
6.11) ATB CALCULATION
---------------------
1) Everyone's ATB is a measure between 0 and 255.
2) Initial values at the start of battle = ??
3) Eveyone's ATB increases at a constant rate (unlike FF6-9).
4) Once someone's ATB reaches 255, they can perform an action.
5) After performing an action, their ATB gets "reset" and is calculated as follows:

Quote
when does the game ever use $408E or $409A , Parameter 1 for the weapon Action?  i see no evidence of this in Bank C2.  it'll load Attack Formula, and Parameters 2 and 3.
Param1 usually contain the chance a wepon to proc Action, while 2 & 3 contain the params for the action
Title: Re: FFV Damage Calculator
Post by: Squall on February 09, 2017, 04:35:14 AM
Quote
Param1 usually contain the chance a weapon to proc Action, while 2 & 3 contain the params for the action
Sorry my mistake. It seems Param1 is used as usual in the DF for the weapon. Param 2&3 are used for the Action.
Param2 - is % chance for FX
Param3 - is the FX action to perform.

So to answer your question the code that handle the FX uses only param 2 and 3.
Param 1 is used before executing the FX code and is connected to the weapon. For example:
- Venom Axe uses param 1 for hit% chance
- Air Blade (katana) - uses param 1 for crit % chance
- Dragon Whip - uses param 1 for 'Strong VS' (Dragon type)
Title: Re: FFV Damage Calculator
Post by: assassin on February 09, 2017, 12:29:41 PM
thanks..

you confirming that prompted me to look at the variable chain backwards, and i found the $4085 variables being copied to $79FC variables in C2/09DD.  this after seeing that $7A05 (with offset $39 varying by hand used?) later gets put in Var $57 in C2/653A.

also, i wonder whether parts of C2/09DD were written by robots or monkeys.

the most blatant:
Code: [Select]
C2/0A06: D0 03        BNE $0A0B
C2/0A08: 4C 3C 0A     JMP $0A3C
C2/0A0B: 20 23 99     JSR $9923

[...]

C2/0A41: D0 03        BNE $0A46
C2/0A43: 4C 79 0A     JMP $0A79
C2/0A46: 20 23 99     JSR $9923

then we have:
Code: [Select]
C2/0A22: A6 0E        LDX $0E
C2/0A24: BD 8D 40     LDA $408D,X
C2/0A27: 48           PHA
C2/0A28: AD FA 79     LDA $79FA
C2/0A2B: AA           TAX
C2/0A2C: 68           PLA
C2/0A2D: 9D 2D 7B     STA $7B2D,X
C2/0A30: 9E 1C 7B     STZ $7B1C,X
C2/0A33: 9E CC 7A     STZ $7ACC,X

admittedly a pain in the ass situation (if you have one index register available), so they use the stack to work around it.  lower down, they try a different approach for the same thing:
Code: [Select]
C2/0A5D: A6 0E        LDX $0E
C2/0A5F: AD FA 79     LDA $79FA
C2/0A62: A8           TAY
C2/0A63: BD 99 40     LDA $4099,X
C2/0A66: 99 2D 7B     STA $7B2D,Y
C2/0A69: AD FA 79     LDA $79FA
C2/0A6C: AA           TAX
C2/0A6D: 9E 1C 7B     STZ $7B1C,X
C2/0A70: 9E CC 7A     STZ $7ACC,X

...but this way is even 2 bytes bigger.  the amazing thing is once they go with Y, an elegant solution of "TYX" is staring them right in the face, and they reload from Var $79FA anyway!  or they could "LDY $0E" instead, do all writes with an X index ("TAX" at C2/0A62), and drop the "TYX" as well.

that's 4 bytes smaller than second snippet, 2 bytes than the first.  and then putting the large chunks of "LDY $0E" thru "JSR $98E3" into its own function would save 17 bytes more.
Title: Re: FFV Damage Calculator
Post by: Squall on February 10, 2017, 08:25:31 AM
Quote
also, i wonder whether parts of C2/09DD were written by robots or monkeys.
Hehe I like that.

Probably around a year ago I made similar comment. My guess is that part of the code was written in a higher level language (non asm) and then compiled. Such asm code pretty much resemble compilation of "if xxx then ..." statements (or multi if - "case"). But definitely part of the code was written in pure asm.

Thats normal way of developing any huge by its scope application/system. You write the main logic with something that is easy to change/easy to read and then you optimize some tough spots (bottlenecks).

P.S. assassin, I'm very interested in your observations on bottom bits of Targeting byte. I checked all the weapons but it seems they use 00 there. Then I checked all the Actions (they use similar structure as weapons) nothing. So either  its left code from previous FFs or  ... there is a separate place that adds lower 2 bits ...
Title: Re: FFV Damage Calculator
Post by: assassin on February 10, 2017, 09:47:19 AM
yeah, they really need to go back and replace all their JSR $01C0 / $01BF / $01B7 / $01B6 calls, for instance.

argh, was hoping i'd found something of use.  so it's a dummied feature, or like you said, the bits get added in later.  maybe try putting a breakpoint on D0/ECEF , D0/ECF0 , and D0/ECF1 starting just before battle, and see whether they're accessed from that C2/1Bnn function, with a variety of weapons in hands.

can you check Usable Items for the bottom two Targeting bits?  they're another thing that function's code checks.
Title: Re: FFV Damage Calculator
Post by: Squall on February 13, 2017, 02:44:16 AM
Quote
can you check Usable Items for the bottom two Targeting bits?  they're another thing that function's code checks.
Sure I forgot about them.

Checked - same here, no item is using lower 2 bits ...
Title: Re: FFV Damage Calculator
Post by: assassin on April 03, 2018, 08:58:42 PM
(another edition of my annual Ask About Variable $63)

does anybody know of abilities, script commands, or any circumstances that can cause an attack's damage to be redirected to the attacker?

i ask because i think that's what this variable involves, based on the following understanding of the $7Bnn variables:

Code: [Select]
$7B69 = HP or MP damage and/or healing, working copy

-----

$7B6B = attacker HP damage
$7B6D = target HP damage

$7B6F = attacker HP healing
$7B71 = target HP healing

-----

$7B73 = attacker MP healing
$7B75 = target MP healing

$7B77 = attacker MP damage
$7B79 = target MP damage

(gar, those were already covered at: http://erick.guillen.com.mx/Codes/SNES%20Final%20Fantasy%20V.txt)

also, i believe target elemental absorption (Variable $62) will preempt this.

however, knowing jack squat about the game in general, nothing's jumping out at me as a candidate for setting Variable $63 when i scroll through the Algorithms FAQ.  but it might be obvious to somebody who knows something about FF5.
Title: Re: FFV Damage Calculator
Post by: Squall on April 04, 2018, 02:24:58 AM
I remember your interest in $63 from before. Unfortunately I know nothing about it, neither I recall being used in battle mechanics  :blush:

Quote
does anybody know of abilities, script commands, or any circumstances that can cause an attack's damage to be redirected to the attacker?
The only thing that comes to my mind is Reflect. There is no implemented mechanics that does deflect/redirect of damage, the way its done in some contemporary RPG (if thats what you have in mind).

Quote
i ask because i think that's what this variable involves, based on the following understanding of the $7Bnn variables:
Well that is a standard 'way' of calculating damage, since Healing is also considered a damage (with revert sign). That mechanics is used in pretty much all FF 1-6 (can't recall about 7).
Title: Re: FFV Damage Calculator
Post by: x0_000 on April 11, 2018, 12:20:43 AM
!Guard also redirects physical attacks (although self damage probably can't occur from various coding.)

Edit: I did a quick memory hack of FFVA and made it so confused player characters can cover their own attacks, so it's very technically possible.
Title: Re: FFV Damage Calculator
Post by: Squall on April 11, 2018, 01:43:46 AM
!Guard also redirects physical attacks (although self damage probably can't occur from various coding.)
No Guard reduce physical damage but doesn't redirect it :)
Title: Re: FFV Damage Calculator
Post by: x0_000 on April 11, 2018, 03:22:36 AM
Whoops, meant the Cover skill.
Title: Re: FFV Damage Calculator
Post by: assassin on April 20, 2018, 07:38:44 AM
thanks both for the replies.

x0_000: based on your post, i investigated Cover.  the function at C2/964D handles it, and seems to reroute the target there.  i see no $63 references in the function, and it seems unlikely that Cover would need to use the variable later.

Squall: based on your post, i tried to investigate Reflection, but there's jack squat documented in the Bank C2 disassembly.  so having no clue how it's implemented, i'm also less likely to rule it out as a $63 candidate.