Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Combat Calculations

Hi, I'm creating a game (viewtopic.php?f=23&t=60887), and I would like damage to be calculated in a different way. I've copy-pasted the calculations from the thread, and would very much appreciate it if someone could write me a script to change the calculations to these, or even just tell me what I need to change it to. Also, I'd like some feedback on whether these method of damage calculation is a good idea or not.

Weapons have the following stats:

W. Attack (Avg @ 1st level: 1.5)
W. Power (Avg @ 1st level: 1.5 if physical weapon, 0 if magical)
W. Magic (Avg @ 1st level: 1.5 if magical weapon, 0 if physical)
Variance (Avg @ 1st level: 5)

Armor has the following stats:

Defense (Avg @ 1st level: 1.0)

Characters have the following stats:
HP (Avg @ 1st level: 100)
MP (Avg @ 1st level: 100)
Agility (Avg @ 1st level: 20)
Power (Avg @ 1st level: 20)
Magic (Avg @ 1st level: 20)


Enemies have the following stats:
HP (Avg @ 1st level: 50)
MP (Avg @ 1st level: 50)
Agility (Avg @ 1st level: 12)
Power (Avg @ 1st level: 12)
Magic (Avg @ 1st level: 12)
Defense (Avg @ 1st level: 1.0)

The enemies are basically the same as normal characters, but the bonuses for the armor and weapons are built right into the default stats.

Hits are calculated as such:

Attacker:
Agility * W. Attack = Attacker Value (AV)
Defender
Agility / 10 = Defender Value (DV)

Randomly generate a number from 1 to AV. If the random value is greater than the DV, It's a hit. If the total value is over 100, it's a critical hit. (I know that this will produce almost no crits at low levels, and great amounts of crits at high ones, but I intend for this. It shows the difference between randomly lashing out (low level), and striking specifically at weak points (high level))

Damage is calculated like this:
Physical attacks:
Attacker:
Power * Weapon Power= Attacker Value (AV)
Defender:
Defense Defender Value(DV)

AV/DV = Damage

Magical Attacks:
Attacker:
Magic * Weapon Magic = AV
Defender:
(Magic * Weapon Magic) /2= DV

AV/DV=Damage.

Thank you in advance!
 
The stats you have set up are already there. If you use the word "INT" instead of "Magic", i.e. to apply a "Magic" stat to a weapon, set the INT+ value. The players INT attribute would be his "Magic" stat. (also, Power = STR+)
The default system also uses 2 Defense values: PDEF (Physical) & MDEF(Magical). You could set these both the same, or only use one of them in your damage calcualtions.

Your damage calculation looks simplistic, but sound. Magic looks like it will produce a bit more damage.

Your hit calculation looks like it will produce very few misses.

The default battle formulas can be found in the help doc. And the code is all in Game_Battler 3.
Some Notes: "Second Hit Detection" is really the "evade" calculation.
In the docs, Power = Force, and Rate = Multiplier. (snafus in the Jap -> English translation.)

Be Well
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top