Need Help with Spell Damage Calculations

AveyondFan

Villager
Member
Joined
Sep 19, 2018
Messages
23
Reaction score
1
First Language
English
Primarily Uses
RMXP
First and foremost, I apologize ahead of time for any and all snark you may see in this thread. I tend to get snarky when frustrated and/or confused, and in this situation, I am somewhat both.

I'm looking for basic formulas to help with figuring out the damage of spells.
I'm terrible at explaining things, so I'll give an example from one of my projects:

A spell, used by an enemy, has these stats:

Power: 100
ATK-F: 0
EVA-F: 0
STR-F: 0
DEX-F: 0
AGI-F: 0
INT-F: 100
Hit Rate: 100
PDEF-F: 0
MDEF-F: 100
Variance: 15

The enemy using the spell has these stats:

STR: 100
DEX: 90
AGI: 80
INT: 70
EVA: 0
PDEF: 100
MDEF: 80
Attack: 100

The actor being attacked has these stats, ignoring total HP and SP/MP(Mana):

STR: 217
DEX: 217
AGI: 232
INT: 200
EVA: 0
PDEF: 260
MDEF: 80
Attack: 60

How would you determine the damage output of the spell being cast by the enemy on the actor? I've looked at the help section, and what "formula" I can grasp from it only furthers my confusion as I either get numbers too high or too low to be within the range of the damage I've seen in the battle tests, and in some situations it appears I would need to divide by zero, which is impossible. I've looked for a calculator to make this easier, but one, found at creation asylum, has a broken link to its download, and another I found is so confusing that I might as well try in vain to figure out how in the world the damage is calculated through trial and error.

I'm hitting my head against a wall trying to figure it out, especially after attempting to wrap my brain around this:
Read: To me, it looks like English and sounds like English... but I can't seem to understand it at the moment so it might as well be something that's not English.
Battle Formulas
RPGXP's default battle system uses the following formulas.

The active battler is represented by A, where the battler who is the target for A's actions is represented by B.

First Hit
Normal attacks:
First hit rate = Hit rate of A's state
Skills:
Attack power F is 1 or greater (physical attack)
First hit rate = Skill's hit rate × hit rate of A's state ÷ 100
Attack power F is 0 (non-physical attack)
First hit rate = Skill's hit rate
Items:
First hit rate = Item's hit rate
  • If A's condition is normal, the state hit rate is 100.
Critical Hit
Normal attacks:
Critical hit rate = 4 × A's dexterity ÷ B's agility
Skills:
Critical hit rate = 0
Items:
Critical hit rate = 0
Calculating Damage
Normal attacks:
Power = A's attack power - (B's physical defense ÷ 2)
Rate = 20 + A's strength
Variance = 15
  • Minimum force: 0
Skills:
Skill's force is positive:
Force = Skill's force

+ (A's attack power × skill's attack power F ÷ 100)

- (B's physical defense × skill's physical defense F ÷ 200)

- (B's magic defense × skill's magic defense F ÷ 200)
  • Minimum force: 0
Skill's force is negative:
Force = Skill's force
Rate = 20

+ (A's strength × skill's strength F ÷ 100)

+ (A's dexterity × skill's dexterity F ÷ 100)

+ (A's agility × skill's agility F ÷ 100)

+ (A's intelligence × skill's intelligence F ÷ 100)
Variance = Skill's variance
Items:
HP recovery amount is negative:
Force = - Amount of HP recovered

- (B's physical defense × item's physical defense F ÷ 20)

- (B's magic defense × item's magic defense F ÷ 20)
  • Minimum force: 0
HP recovery amount is positive:
Force = - Amount of HP recovered
Rate = 20
Variance = Item's variance
Damage = force × multiplier ÷ 20 × elemental modifier × critical modifier × defense modifier (± variance %)

  • Elemental modifier: The weakest of B's effective elements corresponding to the action's element(s).
    A: 200%, B: 150%, C: 100%, D: 50%, E: 0%, F: -100%
    Reduced by half if B's armor or state has a defending (opposing) element.
    When there are more than one of the same defending elements, the damage may be halved multiple times.
  • Critical modifier: Equals 2 when the damage is positive and a critical hit is made.
  • Defense modifier: Equals 1/2 when the damage is positive and B is defending.
Second Hit
Damage is positive:
B's condition is normal:
Evasion = 8 × B's agility ÷ A's dexterity + B's evasion modifier
Normal attacks:
Second hit rate = 100 - evasion
Skills:
Second hit rate = 100 - (evasion × skill's evasion F ÷ 100)
Items:
Second hit rate = 100
B has "Can't Evade" state:
Second hit rate = 100
Damage is negative (recovery):
Second hit rate = 100
Successful Escape
Successful escape rate = 50 × actors' average agility ÷ enemies' average agility
Any help is appreciated.
Knowing me, the answer is likely quite simple and I'm just ignoring the obvious and being an oblivious dork who can't understand her own native language... but what the heck, this might help someone in the future.
 

DerVVulfman

Resident Werewolf
Veteran
Joined
Jun 26, 2012
Messages
315
Reaction score
155
First Language
English
Primarily Uses
RMXP
First, let's see this:
hit = skill.hit
if skill.atk_f > 0
hit *= user.hit / 100
end

The skill's HIT score is 100 . Fine.
Now you have no ATK_F score. If you did, the HIT score woulda been amplified by 1% more of the skill user's own hit rate (changed by status effects).

All this really determines if you HIT the target/self or not.

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

Now let's look at this:
power = skill.power + user.atk * skill.atk_f / 100

The BASIC power of the skill is the Skill's OWN power (100) plus the attacking enemy's own attack score (100) multiplied 1% of the skill's Attack_F rating. IE power = 100 + 100 * 0 (... since an Atk_F of 0/100 is still 0).
So you have 100 + 100 x 0... or just...

power = 100

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

So now we do some fun stuff if the power score is greater than 100:

if power > 0
power -= self.pdef * skill.pdef_f / 200
power -= self.mdef * skill.mdef_f / 200
power = [power, 0].max
end

Yep, we take the victim/self's own PDef and MDef scores and use them to reduce the power of the skill.
self's score X skill's defense / 200
Wow... not even 1% of the skill's defense? 1/2 of a percent? That's not much

So with the defender's score of PDEF: 260 and MDEF: 80, and the skill's own score of PDEF-F: 0 and MDEF-F: 100.......
power -= 260 * 0/200 (IE power - 0) ... no defense against physical
power -= 80 * 100/200 (ie 80 x 0.5... or 40) ... some defense against magic

power thus gets reduced by 40 points.... and now goes down to 60

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

NOW we increase the power by a calculated RATE score

rate = 20
rate += (user.str * skill.str_f / 100)
rate += (user.dex * skill.dex_f / 100)
rate += (user.agi * skill.agi_f / 100)
rate += (user.int * skill.int_f / 100)

# Calculate basic damage
self.damage = power * rate / 20

So here we amplify the rate by the enemy user's strength by 1% of the skill's strength bonus, dexterity by 1% of the dexterity bonus, etc

rate = 20
rate += (100 * 0 / 100) ... nope
rate += (90 * 0 / 100) ...nuh uh
rate += (80 * 0 / 100) ... nothing to see here.
rate += (70 * 100 / 100) ..... ABOUT TIME!

So the base rate is 20 with nothing Strength, Dexterity or Agilitywise added, but does add 70pt of the enemy's intelligence
Thus.... Rate becomes 90 (20+70) for this

self.damage = power * rate / 20 (or....)
self.damage = 60 * 90 / 20

Damage becomes (grabs a calculator): 270

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

We then multiply the damage by the elements effects, and then divide it by 100. Elements increase the damage a staggering amount, so yep.... we gotta reduce it appropriately.

Yeah, I don't know what elements the skill is tagged, so let's leave it as untagged and the damage is still 270.

And then if there is any physical damage being introduced, we cut the damage in half if the victim is guarding/defending.

THEN... we throw in a little VARIANCE into the damage.

The next HIT detection is based on the victim's EVA (evade) score and its chance to avoid the damage calculated.
 

AveyondFan

Villager
Member
Joined
Sep 19, 2018
Messages
23
Reaction score
1
First Language
English
Primarily Uses
RMXP
This helps a lot.
So, with element tags, would more element tags, say two, cause more damage than one, or would they be the same?
What about resistances? how are they calculated?
(sorry for taking so long to respond)
 

DerVVulfman

Resident Werewolf
Veteran
Joined
Jun 26, 2012
Messages
315
Reaction score
155
First Language
English
Primarily Uses
RMXP
For elements, they aren't cumulative without the aid of some script. It would typically choose the one that delivers the highest rating (I think). Actually, someone asked me to look into elements and states just recently. Know any lone bounty hunters????

Resistances? If you're talking elements, any enemy with an elemental setting of 'E" is immune to damage from that element and 'F' absorbs the damage. Ratings of D up to A increase damage from 50% to 200%

Again. highest rated element wins out from what I recall.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Frostorm wrote on Featherbrain's profile.
Hey, so what species are your raptors? Any of these?
... so here's my main characters running around inside "Headspace", a place people use as a safe place away from anxious/panic related thinking.
Stream will be live shortly! I will be doing some music tonight! Feel free to drop by!
Made transition effects for going inside or outside using zoom, pixi filter, and a shutter effect
I have gathered enough feedback from a few selected people. But it is still available if you want to sign up https://forums.rpgmakerweb.com/index.php?threads/looking-for-testers-a-closed-tech-demo.130774/

Forum statistics

Threads
105,992
Messages
1,018,189
Members
137,771
Latest member
evoque
Top