øAslickproductions.org/forum/index.php?PHPSESSID=a93jpvqe9jutne9agvqo8ht1r1&topic=2188.30e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index4fc1-2.htmlslickproductions.org/forum/index.php?board=17.0e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index4fc1-2.html.zx¼8h^ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÈ °VyOKtext/htmlISO-8859-1gzip0|ÖyÿÿÿÿÿÿÿÿWed, 11 Mar 2020 01:19:16 GMT0ó°° ®0®P®€§²ð®»8h^ÿÿÿÿÿÿÿÿf*y FFV Damage Calculator

Author Topic: FFV Damage Calculator  (Read 9840 times)

Squall

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

Squall

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

Jorgur

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

Squall

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

LightPhoenix

  • FF5 Hacker
  • *
  • Posts: 130
    • View Profile
Re: FFV Damage Calculator
« Reply #34 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).

Squall

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

assassin

  • Bane of Retards
  • *
  • Posts: 1,033
  • space bears are not gentle!
    • View Profile
    • My Barren Webpage
Re: FFV Damage Calculator
« Reply #36 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).

Squall

  • Dark Dragon
  • *
  • Posts: 486
    • View Profile
Re: FFV Damage Calculator
« Reply #37 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?
« Last Edit: May 12, 2016, 03:01:01 AM by Squall »

assassin

  • Bane of Retards
  • *
  • Posts: 1,033
  • space bears are not gentle!
    • View Profile
    • My Barren Webpage
Re: FFV Damage Calculator
« Reply #38 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.?

Squall

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

assassin

  • Bane of Retards
  • *
  • Posts: 1,033
  • space bears are not gentle!
    • View Profile
    • My Barren Webpage
Re: FFV Damage Calculator
« Reply #40 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.

Squall

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

assassin

  • Bane of Retards
  • *
  • Posts: 1,033
  • space bears are not gentle!
    • View Profile
    • My Barren Webpage
Re: FFV Damage Calculator
« Reply #42 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.
« Last Edit: May 12, 2016, 07:42:24 PM by assassin »

Squall

  • Dark Dragon
  • *
  • Posts: 486
    • View Profile
Re: FFV Damage Calculator
« Reply #43 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
« Last Edit: May 13, 2016, 05:55:41 AM by Squall »

assassin

  • Bane of Retards
  • *
  • Posts: 1,033
  • space bears are not gentle!
    • View Profile
    • My Barren Webpage
Re: FFV Damage Calculator
« Reply #44 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.