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.0This 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):
//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.0Absorb 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.0Note: This isn't really known quite yet...
If the spell is multitargeted...
Damage = Base HP Power / HP Spell Power + HP Damage Bonus