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.

Altering the Damage Calculations [XP]

Okay, there are several forumale used to calculate damage, accuracy, critical hit rates and all that. I just wanted to know where I could go to edit those values. You see in my current project, there can't be really high damage numbers, and the value of attacks need to be based primarily off of the weapon themselves. What I want is to have something like,

Weapon: Bronze Sword (Attack 10)
Strength: 170

I wanted to do it so that Strength is a percentile value that affects the weapon's primary damage. Such as like,

10 (1+.17%) = 11.7 Rounded up to 12.

Does anyone know how to do something like this?
 
The battle calculations are documented in the help file. And implemented in Game_Battler 3, in the 'attack_effect' method.

particularly the lines (50-51):

      # Calculate basic damage
      atk = [attacker.atk - self.pdef / 2, 0].max
      self.damage = atk * (20 + attacker.str) / 20

which you could change to:

      self.damage = atk * (attacker.str / 10 + 100) / 100

It looks like all the adjustments are based on percentages, so you should not need to modify them.

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