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.

Setting a damage cap

NBEOTM

Member

I'm currently using hydros battle algorithms to make my game's damage system the same as final fantasy X's. However I have hit a wall, with characters being able to do over 9999, which I do not want.

So here is the request, to set it so regular attacks can do 9999 maximum. And so skills can only do 9999 maximum. However I want certain weapons to be able to do over this amount, same with certain skills. Through element tagging would be awesome.(I.E if the weapon has element 17 set, then it can do more than 9999 damage, or if the skill has element 17 set it can do more than 9999 damage.

Here are Hyros algorithms if it helps

regular attacks

Code:
atk = (((attacker.str * attacker.str * attacker.str) / 32) + 30)
      self.damage = ((atk * ((((self.pdef - 280) * (self.pdef - 280))/110) + 16))/730) * (730 - (self.pdef * 51 - (self.pdef * self.pdef) / 11) / 10) / 730
     # FFX CBA

Skills

Code:
rate = (skill.power * (((user.int * user.int) / 6) + skill.power) / 4)
      self.damage = (rate * ((((self.mdef - 280) * (self.mdef - 280))/110) + 16)/730) * (730 - (self.mdef * 51 - (self.mdef * self.mdef) / 11) / 10) / 730
     if skill.atk_f == 1
       rate = (((user.str * user.str * user.str) / 32) + 30)
      self.damage = ((rate * ((((self.pdef - 280) * (self.pdef - 280))/110) + 16))/730) * (730 - (self.pdef * 51 - (self.pdef * self.pdef) / 11) / 10) / 730
    end
    if skill.atk_f == 2
       rate = ( skill.power * ((user.int + skill.power) / 2)) * ( 0 -1)
      self.damage = rate 
      end

Thank you for the help
 
Code:
atk = (((attacker.str * attacker.str * attacker.str) / 32) + 30)
      self.damage = ((atk * ((((self.pdef - 280) * (self.pdef - 280))/110) + 16))/
      If self.damage <=9999
         self.damage=self.damage 
      else
               If $data_skills[i].element_set.include?(17)
                  self.damage=self.damage
               else 
                  self.damage=9999
               end 
      end
Placing that should work for attack, at least in setting the limit I'll to get the rest in a few minutes
Edit that SHOULD work, I haven't tested it yet.

Extremely messy but this should work for skills.
Code:
rate = (skill.power * (((user.int * user.int) / 6) + skill.power) / 4)
      self.damage = (rate * ((((self.mdef - 280) * (self.mdef - 280))/110) + 16)/730) * (730 - (self.mdef * 51 - (self.mdef * self.mdef) / 11) / 10) / 730
       If self.damage <=9999
         self.damage=self.damage 
      else
               If $data_skills[i].element_set.include?(17)
                  self.damage=self.damage
               else 
                  self.damage=9999
               end 
      end
 

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