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.

Pokemon CBA (battle calculation)

hydro

Member

this is for u pokemon fans making a pokemon fan game. This Custom Battle Algorithm uses a character's stats to calculate the battle damage as if it were a pokemon game.

This CBA uses the following stats for battle damage calculations:
Level, Strenth/Intelligence, Physical defense/Magic Defense.

IMPORTANT NOTE: these algorithm use the attacker's/skill user's LV.
Monsters do not have a Level Stat. If some one can submit a Monster Level script, then this script could be complete. It's all I could find so It's all im posting.

Credits to : Hydro :D

go to Game_Battler 3 and search for this line

Code:
self.damage *= elements_correct(skill.element_set)

and delete these and ONLY these lines above it:
Code:
power = skill.power + user.atk * skill.atk_f / 100
      if power > 0
        power -= self.pdef * skill.pdef_f / 200
        power -= self.mdef * skill.mdef_f / 200
        power = [power, 0].max
      end
     
      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)

      self.damage = power * rate / 20

and replace it with

Code:
      if skill.atk_f == 1
       rate = ((((2 * user.level / 5 + 2) * user.str * skill.power / self.pdef) / 50) + 2) * (100 - rand(15)) / 100 
      self.damage = rate 
    end
    if skill.atk_f == 2
       rate = ((((2 * user.level / 5 + 2) * user.int * skill.power / self.mdef) / 50) + 2) * (100 - rand(15)) / 100 
      self.damage = rate 
      end

so, All physical skills should have an "attack power" of 1.
all special/magic skilss should have an "attack power" of 2.

Hydro Pump is a Special/magic attack with an effect rating of 120. So in the skills database it should have an attack power of 2 and an effect rating of 120.

you will get an error if you dont have an "attack power" set on a skill.

The algorithm itself has its variance, so set variance to 0 on all skills.
You will also get an error when a monster/enemy uses a skill because they dont have a level, i can only suply you with this until some one makes/find a monster level script.
 
Code:
class Game_Enemy < Game_Battler
  def name
    return $data_enemies[@enemy_id].name.split('|')[0]
  end
  def level
    return $data_enemies[@enemy_id].name.split('|')[1].to_i
  end
end

Just add |# to your enemy names, such as:

Bulbasaur|4 and it will be a Lv4 bulbasaur.

And use <Game_Enemy>.level to reference it.
 
Appart from that, I have been making a poké game too, and when searching for battle formula's, I stumbled on partly similar and partly different formula's. Either way, Without the DV's => EV's, IV's. Natures this could never be correct, like you said.

Why not make the whole pokemon city :P Anyway, good try.
 

hydro

Member

I've ran several different tests on this algorithm. No use for DVs and EVs. This uses the stats that are ALREADY aquired by the character.
 
I know, but that is not how it worked in Pokémon :D

Edit: Hey! No offense! it is great you made this, people will use ti, I am just giving my opinion :P
 

hydro

Member

Whoa, im just posting the algorithm...... haha, i've been bombarded with Pokemon CBA requests PMs, and half of em werent even for a pokemon game. Just a lil case of suply and demand.
 

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