øAslickproductions.org/forum/index.php?PHPSESSID=so1iojs5ocdn0o2vf0tti7fbu6&topic=2188.0e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index3d4f.htmlslickproductions.org/forum/index.php?PHPSESSID=so1iojs5ocdn0o2vf0tti7fbu6&board=17.0e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index3d4f.html.zx4õg^ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÈ@@] „OKtext/htmlISO-8859-1gzip ׄÿÿÿÿÿÿÿÿTue, 10 Mar 2020 20:31:07 GMT0ó°° ®0®P®€§²ð®3õg^ÿÿÿÿÿÿÿÿÐ,„ FFV Damage Calculator

Author Topic: FFV Damage Calculator  (Read 9836 times)

Squall

  • Dark Dragon
  • *
  • Posts: 486
    • View Profile
FFV Damage Calculator
« 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  FFVDmgCalc 0.4.1 (.exe only)
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
« Last Edit: June 13, 2016, 05:09:25 AM by Squall »

Jorgur

  • Moderator
  • *
  • Posts: 437
  • Gender: Male
    • View Profile
Re: FFV Damage Calculator
« Reply #1 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.


Squall

  • Dark Dragon
  • *
  • Posts: 486
    • View Profile
Re: FFV Damage Calculator
« Reply #2 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)

Squall

  • Dark Dragon
  • *
  • Posts: 486
    • View Profile
Re: FFV Damage Calculator
« Reply #3 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

samurai goroh

  • FF5 Hacker
  • *
  • Posts: 221
  • Gender: Male
    • View Profile
    • My page
Re: FFV Damage Calculator
« Reply #4 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.
I'm the best in the universe! Just remember! [F-zero X]

Squall

  • Dark Dragon
  • *
  • Posts: 486
    • View Profile
Re: FFV Damage Calculator
« Reply #5 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 ...

Jorgur

  • Moderator
  • *
  • Posts: 437
  • Gender: Male
    • View Profile
Re: FFV Damage Calculator
« Reply #6 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.



Squall

  • Dark Dragon
  • *
  • Posts: 486
    • View Profile
Re: FFV Damage Calculator
« Reply #7 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?

Jorgur

  • Moderator
  • *
  • Posts: 437
  • Gender: Male
    • View Profile
Re: FFV Damage Calculator
« Reply #8 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.


Squall

  • Dark Dragon
  • *
  • Posts: 486
    • View Profile
Re: FFV Damage Calculator
« Reply #9 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 :)
« Last Edit: April 06, 2016, 09:57:00 AM by Squall »

Jorgur

  • Moderator
  • *
  • Posts: 437
  • Gender: Male
    • View Profile
Re: FFV Damage Calculator
« Reply #10 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.

Squall

  • Dark Dragon
  • *
  • Posts: 486
    • View Profile
Re: FFV Damage Calculator
« Reply #11 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)

Squall

  • Dark Dragon
  • *
  • Posts: 486
    • View Profile
Re: FFV Damage Calculator
« Reply #12 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 :)
« Last Edit: April 08, 2016, 06:45:35 AM by Squall »

Squall

  • Dark Dragon
  • *
  • Posts: 486
    • View Profile
Re: FFV Damage Calculator
« Reply #13 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 :)

Jorgur

  • Moderator
  • *
  • Posts: 437
  • Gender: Male
    • View Profile
Re: FFV Damage Calculator
« Reply #14 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.