Aslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&topic=448.msg7956e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index98ff.htmlslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&topic=448.0e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index98ff.html.zx"g^ z7OKtext/htmlISO-8859-1gzip@7Tue, 10 Mar 2020 13:41:13 GMT0 0P!g^y&7 HP Damage Algo

Author Topic: HP Damage Algo  (Read 6318 times)

Deathlike2

  • Moderator
  • *
  • Posts: 3,538
  • I'm looking at you, bitch!
    • View Profile
HP Damage Algo
« on: March 20, 2008, 11:43:37 AM »
Refer to this thread for the start of my idea, but it wasn't fully fleshed out - http://slickproductions.org/forum/index.php?topic=390.0

This thread is an appendix to the magic algo, since the majority of that has an impact depending on resistances...

Onto the algo...

HP Power (HP attack based on caster) = Caster's Current HP
HP Power (HP attack based on target) = Target's Max HP

Base HP Spell Power = Whatever is normally listed in the spell power slot
Base HP Absorb Spell Power = Whatever is normally listed next to the spell power data (**default: 100/Base HP Spell Power)
****Base HP Spell Hit Rate = Whatever is normally listed in the hit rate slot

**Note: Not sure if that always have to be defined like that, but it is there anyways...
****Note: Make sure to subtract 128 if it uses the boss bit

HP Spell Power Elemental Modifier (HP attack based on target):
Target is Weak to Element, HP Spell Power = 2
Target is Resistant to Element, HP Spell Power = 10
**Target is Immune to Element, HP Spell Power = 10
**Target Absorbs Element, HP Spell Power = Base HP Spell Power * -1
Unapplicable, HP Spell Power = Base HP Spell Power

HP Spell Power Elemental Modifier (HP attack based on caster):
Target is Weak to Element, HP Spell Power = Base HP Spell Power * 2
Target is Resistant to Element, HP Spell Power = Base HP Spell Power / 2
**Target is Immune to Element, HP Spell Power = Caster's Current HP
**Target Absorbs Element, HP Spell Power = Base HP Spell Power * -1
Unapplicable, HP Spell Power = Base HP Spell Power

**Note: In the SNES version, Immunity has precedence over Absorb. In the GBA version, Absorb has precedence over Immunity.

HP Based Damage Bonus:
HP attack based on target, HP Damage Bonus = 0
HP attack based on caster, HP Damage Bonus = (Caster's Current HP/ HP Spell Power * rand (100, 150) / 100) % 256

Basic Formula - Includes Weakness, Resistance, and Immunity (SNES and GBA versions):

Code: [Select]
//skip loop if using the GBA version...

while (Spell Multiplier > 0)
{
 if(Target's Magic Defense Multiplier == 0)
 {
  Success = true
  break;
 }

 while(Target's Magic Defense Multiplier > 0)
 {
  Target's Magic Defense Multiplier--;
  if (rand(0, 99) > HP Spell Hit Rate) || (rand(0, 99) < Target's Magic Evade))
  {
    break;
  }
 }
 Spell Multiplier--;
}

if (Success) //only applies to SNES version
{
 Damage = Base HP Power / HP Spell Power + HP Damage Bonus
}

Absorb Formula (SNES version):
Use Base HP Absorb Spell Power and plug that into the general magic algo as the Base Spell Power: http://slickproductions.org/forum/index.php?topic=329.0

Absorb Formula (GBA version):

If the spell is single targeted...
HP Absorb Spell Power = Base HP Absorb Spell Power * 3/2
Target's Magic Defense = 0
Target's Magic Evade = 0
Plug in HP Absorb Spell Power into the general magic algo as the Base Spell Power: http://slickproductions.org/forum/index.php?topic=329.0

Note: This isn't really known quite yet...

If the spell is multitargeted...
Damage = Base HP Power / HP Spell Power + HP Damage Bonus
« Last Edit: March 27, 2008, 07:07:13 PM by Deathlike2 »
Working on the next Yet To Be Named FF4 "Hardtype" Hack Download Latest: v1.48

Video Demos: #1 #2 #3

Deathlike2

  • Moderator
  • *
  • Posts: 3,538
  • I'm looking at you, bitch!
    • View Profile
Re: HP Damage Algo
« Reply #1 on: March 20, 2008, 12:01:14 PM »
Caster based HP attacks have a slight bonus applied to the attack, based on the damage dealt, however that's kinda unknown.. but AFAIK it is capped at 255 like the Mist Dragon summon.
Working on the next Yet To Be Named FF4 "Hardtype" Hack Download Latest: v1.48

Video Demos: #1 #2 #3

Deathlike2

  • Moderator
  • *
  • Posts: 3,538
  • I'm looking at you, bitch!
    • View Profile
Re: HP Damage Algo
« Reply #2 on: March 20, 2008, 02:40:03 PM »
Fixed elemental changes to the HP Spell Power.
Working on the next Yet To Be Named FF4 "Hardtype" Hack Download Latest: v1.48

Video Demos: #1 #2 #3

Deathlike2

  • Moderator
  • *
  • Posts: 3,538
  • I'm looking at you, bitch!
    • View Profile
Re: HP Damage Algo
« Reply #3 on: March 27, 2008, 07:08:14 PM »
Updated algo to factor in damage randomness.
Working on the next Yet To Be Named FF4 "Hardtype" Hack Download Latest: v1.48

Video Demos: #1 #2 #3

Deathlike2

  • Moderator
  • *
  • Posts: 3,538
  • I'm looking at you, bitch!
    • View Profile
Re: HP Damage Algo
« Reply #4 on: September 27, 2008, 07:29:31 PM »
Mega  :bump:

Ok, the spell data for absorbing the monster's Blitz seems to make a ton more sense now..

It is simpler than I thought.

Blitz's alternate spell power is 50 (a lot of the HP based data suggests that it's always 100/primary spell power value, in this case, it is 100/2 = 50).

When absorbed, the following formula is used...

Damage = Alternate Spell Power * 3/2 * Spell Multiplier

Damage = Damage + (Damage * rand(100, 150) / 100) % 256

For the example of the King Ryu/Gold Dragon...

Damage = 50 * 3/2 * 8 = 600 + some number between 0 and 255

Someone feel free to test this (you want to tweak the spell values or the monster's spell power so I'm not going crazy)... this only applies to the GBA version.
« Last Edit: September 27, 2008, 08:13:25 PM by Deathlike2 »
Working on the next Yet To Be Named FF4 "Hardtype" Hack Download Latest: v1.48

Video Demos: #1 #2 #3

Deathlike2

  • Moderator
  • *
  • Posts: 3,538
  • I'm looking at you, bitch!
    • View Profile
Re: HP Damage Algo
« Reply #5 on: September 27, 2008, 08:10:16 PM »
Another worthy  :bump:

For the SNES version's Gold Dragon Blitz (absorbing it, that is).. it's actually really really easy (why it didn't dawn on me before is beyond me).

Damage = (maxHP modifer * 4 * rand(100,150)/100 - Target's Magic Defense) * Spell Multiplier

In the case of Cecil with a Dragon Shield (3 magic defense)

Damage (worst case) = (2 *4 - 3) * 8 =  40
Damage (best case) =  (2 *4 * 1.5 - 3) * 8 = 72

Kain with Dragon Armor (8 magic defense)

Damage (worst case) = (2 * 4 - 8) * 8 = 0 (1 is dealt due to obvious reasons)
Damage (best case) = (2 * 4 * 1.5) - 8 = 32

Someone please test this for the SNES version. It helps to tweak the spell power since the spell multiplier factor is adhered to...
Working on the next Yet To Be Named FF4 "Hardtype" Hack Download Latest: v1.48

Video Demos: #1 #2 #3

Deathlike2

  • Moderator
  • *
  • Posts: 3,538
  • I'm looking at you, bitch!
    • View Profile
Re: HP Damage Algo
« Reply #6 on: September 27, 2008, 08:38:01 PM »
The Ging-Ryu's Blaze seems to matchup what I thought.

YAAAAAAAAAAAAAAAAAAAAAAAAAYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY

 :cycle:

Here's the example...

Cecil with a Dragon Shield:

Damage (worst case) = (4 * 4 - 3) * 24 = 312
Damage (best case) = (4 * 4 * 1.5 - 3 ) * 8 = 504

Kain with a Dragon Armor:

Damage (worst case) = (4 * 4 - 8) * 24 = 192
Damage (best case) = (4 * 4 * 1.5 - 8) * 24 = 384

WOOOOOOOOOOOOOOOOOOOOOOOOO.

You can do the test yourself.

The algo does work against magic defense and magic evasion, so you have to test as a Toad with limited armor... these numbers will corroborate with what I've said... I'll have to get pics anyways...
Working on the next Yet To Be Named FF4 "Hardtype" Hack Download Latest: v1.48

Video Demos: #1 #2 #3

Deathlike2

  • Moderator
  • *
  • Posts: 3,538
  • I'm looking at you, bitch!
    • View Profile
Re: HP Damage Algo
« Reply #7 on: September 27, 2008, 09:03:12 PM »
Here are some pics...

Kain max:


Kain min:


Cecil min:


Cecil max:


Kain min:


Kain max:


Cecil max:


Cecil min:


Also, my GBA analysis is off.. since it seems to be affected by Magic Defense...  but the randomization is there.. I've yet to figure out what the base number that is tested against, but it's a good chance it is pretty high...
Working on the next Yet To Be Named FF4 "Hardtype" Hack Download Latest: v1.48

Video Demos: #1 #2 #3

Dragonsbrethren

  • Forum Overlord
  • *
  • Posts: 1,820
    • View Profile
    • Dragonsbrethren Industries
Re: HP Damage Algo
« Reply #8 on: September 27, 2008, 09:22:24 PM »
You Cecil min shot for Blaze is missing.

Deathlike2

  • Moderator
  • *
  • Posts: 3,538
  • I'm looking at you, bitch!
    • View Profile
Re: HP Damage Algo
« Reply #9 on: September 27, 2008, 09:28:26 PM »
Working on the next Yet To Be Named FF4 "Hardtype" Hack Download Latest: v1.48

Video Demos: #1 #2 #3

Dragonsbrethren

  • Forum Overlord
  • *
  • Posts: 1,820
    • View Profile
    • Dragonsbrethren Industries
Re: HP Damage Algo
« Reply #10 on: September 27, 2008, 09:36:20 PM »
It's showing now, even without a refresh.

Deathlike2

  • Moderator
  • *
  • Posts: 3,538
  • I'm looking at you, bitch!
    • View Profile
Re: HP Damage Algo
« Reply #11 on: September 27, 2008, 10:32:09 PM »
This waiting for the extremes in the randomization is sucking...

Anyways.. the formula looks more like this for Absorbing Blitz in the GBA port...

The Spell Power seems to be 82 (don't ask me why)..

Damage = Spell Power * Spell Multiplier + rand(0, 255) - Target's Magic Defense

Magic Evasion is not factored in because it is ignored.

I'm confident in the number I came up with.. after watching so many random numbers come up...  :angry: :shadow:

Finally...  :childish: :relom:
« Last Edit: September 27, 2008, 10:52:05 PM by Deathlike2 »
Working on the next Yet To Be Named FF4 "Hardtype" Hack Download Latest: v1.48

Video Demos: #1 #2 #3

Deathlike2

  • Moderator
  • *
  • Posts: 3,538
  • I'm looking at you, bitch!
    • View Profile
Re: HP Damage Algo
« Reply #12 on: September 28, 2008, 01:20:48 AM »
Ok... my absorb GBA properties are off... I thought about doing a bit more testing on other monster maxHP attacks, and apparently I was waaaaaayy off.

It seems to be built up into two parts.

1) The maxHP of the monster is factored into the damage.

2) The current HP of the monster is factored into the damage.

It seems that I'll have to dig further, but that's the current analysis that I've gotten so far.
Working on the next Yet To Be Named FF4 "Hardtype" Hack Download Latest: v1.48

Video Demos: #1 #2 #3

Deathlike2

  • Moderator
  • *
  • Posts: 3,538
  • I'm looking at you, bitch!
    • View Profile
Re: HP Damage Algo
« Reply #13 on: September 28, 2008, 01:42:47 AM »
Ok, I think I've got it now.

Here it goes:

Damage = (maxHP / (25 / maxHP modifier)) + ((maxHP / (25 / maxHP modifier)) * 3/2) % 256 - Target's Magic Defense) * (currentHP / maxHP)

Magic Evasion and Spell Multiplier is not factored into the equation.

Try it and see if that works out. It seems to work with all the numbers I can play with here.

I'm not entirely sure where the Target's Magic Defense goes.. it could be applied at the very end like...

Damage = (maxHP / (25 / maxHP modifier)) + ((maxHP / (25 / maxHP modifier)) * 3/2) % 256) * (currentHP / maxHP) - Target's Magic Defense

Either way, this seems to be the correct way of representing said numbers.
« Last Edit: September 28, 2008, 01:51:01 AM by Deathlike2 »
Working on the next Yet To Be Named FF4 "Hardtype" Hack Download Latest: v1.48

Video Demos: #1 #2 #3

Deathlike2

  • Moderator
  • *
  • Posts: 3,538
  • I'm looking at you, bitch!
    • View Profile
Re: HP Damage Algo
« Reply #14 on: September 28, 2008, 02:29:57 AM »
Actually.. this formula should look more like...

Damage = (maxHP / (25 / maxHP modifier)) * (currentHP / maxHP)

and then...

Damage = Damage + ((Damage * rand(100,150)/100) % 256) - Target's Magic Defense

Ok.. that looks much better.

 :edit:

And obviously..

If Damage < 0, Damage = 1

 :edit:

I'm randomizing it wrong...  :blits: :isuck:

Ok.. that should do it... :relom: :yabin:

Please remember to ask questions, mock, or scratch your head if this doesn't make any sense to you.

 :edit:

Here's a more calculator friendly formula...

Damage = (maxHP * maxHP modifier / 25) * (currentHP / maxHP)

and then...

Damage = Damage + ((Damage * rand(100,150)/100) % 256) - Target's Magic Defense
« Last Edit: September 28, 2008, 09:57:02 AM by Deathlike2 »
Working on the next Yet To Be Named FF4 "Hardtype" Hack Download Latest: v1.48

Video Demos: #1 #2 #3