{"id":3358,"date":"2022-09-19T01:25:29","date_gmt":"2022-09-18T20:25:29","guid":{"rendered":"https:\/\/www.edopedia.com\/blog\/?p=3358"},"modified":"2022-09-19T01:25:32","modified_gmt":"2022-09-18T20:25:32","slug":"how-to-make-pokemon-damage-calculator-in-javascript","status":"publish","type":"post","link":"https:\/\/www.edopedia.com\/blog\/how-to-make-pokemon-damage-calculator-in-javascript\/","title":{"rendered":"How to Make Pokemon Damage Calculator in JavaScript"},"content":{"rendered":"\n<p>In this tutorial, you will learn how to make a\u00a0<strong>Pokemon Damage Calculator in JavaScript<\/strong>. Basically,\u00a0this\u00a0tool is a <strong>damage calculator<\/strong> for all generations of <strong>Pok\u00e9mon<\/strong> battling.<\/p>\n\n\n\n<p>The main source code of\u00a0the <strong>Pokemon Damage Calculator<\/strong>\u00a0is given below. It was a bit difficult to add the complete source code to this article. So, I have provided a download button at the end of this tutorial from where you can download the full source code of\u00a0the <strong>Pokemon Damage Calculator<\/strong>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Pokemon Damage Calculator<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">server.js<\/h3>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;javascript&quot;,&quot;mime&quot;:&quot;text\/javascript&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;JavaScript&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;js&quot;}\">const express = require(&quot;express&quot;);\nconst calc = require(&quot;calc&quot;);\nconst app = express();\napp.listen(3000, () =&gt; {\n\tconsole.log(&quot;Server running on port 3000&quot;);\n});\n\n\/\/ parse application\/json\napp.use(express.json())\n\napp.get(&quot;\/calculate&quot;,(req, res, next) =&gt; {\n\tconst gen = calc.Generations.get((typeof req.body.gen === 'undefined') ? 8 : req.body.gen);\n\tlet error = &quot;&quot;;\n\tif(typeof req.body.attackingPokemon === 'undefined')\n\t\terror += &quot;attackingPokemon must exist and have a valid pokemon name\\n&quot;;\n\tif(typeof req.body.defendingPokemon === 'undefined')\n\t\terror += &quot;defendingPokemon must exist and have a valid pokemon name\\n&quot;;\n\tif(error)\n\t\tthrow new Error(error)\n\tconst result = calc.calculate(\n\t\tgen,\n\t\tnew calc.Pokemon(gen, req.body.attackingPokemon, req.body.attackingPokemonOptions),\n\t\tnew calc.Pokemon(gen, req.body.defendingPokemon, req.body.defendingPokemonOptions),\n\t\tnew calc.Move(gen, req.body.moveName),\n\t\tnew calc.Field((typeof req.body.field === 'undefined') ? undefined : req.body.field)\n\t);\n\tres.json(result);\n})\n\napp.use(express.static('dist'))<\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">\/calc\/src\/calc.ts<\/h3>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;javascript&quot;,&quot;mime&quot;:&quot;application\/typescript&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;TypeScript&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;typescript&quot;}\">import {Field} from '.\/field';\nimport {Generation} from '.\/data\/interface';\nimport {Move} from '.\/move';\nimport {Pokemon} from '.\/pokemon';\nimport {Result} from '.\/result';\n\nimport {calculateRBYGSC} from '.\/mechanics\/gen12';\nimport {calculateADV} from '.\/mechanics\/gen3';\nimport {calculateDPP} from '.\/mechanics\/gen4';\nimport {calculateBWXY} from '.\/mechanics\/gen56';\nimport {calculateSMSS} from '.\/mechanics\/gen78';\n\nconst MECHANICS = [\n  () =&gt; {},\n  calculateRBYGSC,\n  calculateRBYGSC,\n  calculateADV,\n  calculateDPP,\n  calculateBWXY,\n  calculateBWXY,\n  calculateSMSS,\n  calculateSMSS,\n];\n\nexport function calculate(\n  gen: Generation,\n  attacker: Pokemon,\n  defender: Pokemon,\n  move: Move,\n  field?: Field,\n) {\n  return MECHANICS[gen.num](\n    gen,\n    attacker.clone(),\n    defender.clone(),\n    move.clone(),\n    field ? field.clone() : new Field()\n  ) as Result;\n}<\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">\/calc\/src\/pokemon.ts<\/h3>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;javascript&quot;,&quot;mime&quot;:&quot;application\/typescript&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;TypeScript&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;typescript&quot;}\">import * as I from '.\/data\/interface';\nimport {Stats} from '.\/stats';\nimport {toID, extend, assignWithout} from '.\/util';\nimport {State} from '.\/state';\n\nconst STATS = ['hp', 'atk', 'def', 'spa', 'spd', 'spe'] as I.StatID[];\nconst SPC = new Set(['spc']);\n\n\nexport class Pokemon implements State.Pokemon {\n  gen: I.Generation;\n  name: I.SpeciesName;\n  species: I.Specie;\n\n  types: [I.TypeName] | [I.TypeName, I.TypeName];\n  weightkg: number;\n\n  level: number;\n  gender?: I.GenderName;\n  ability?: I.AbilityName;\n  abilityOn?: boolean;\n  isDynamaxed?: boolean;\n  item?: I.ItemName;\n\n  nature: I.NatureName;\n  ivs: I.StatsTable;\n  evs: I.StatsTable;\n  boosts: I.StatsTable;\n  rawStats: I.StatsTable;\n  stats: I.StatsTable;\n\n  originalCurHP: number;\n  status: I.StatusName | '';\n  toxicCounter: number;\n\n  moves: I.MoveName[];\n\n  constructor(\n    gen: I.Generation,\n    name: string,\n    options: Partial&lt;State.Pokemon&gt; &amp; {\n      curHP?: number;\n      ivs?: Partial&lt;I.StatsTable&gt; &amp; {spc?: number};\n      evs?: Partial&lt;I.StatsTable&gt; &amp; {spc?: number};\n      boosts?: Partial&lt;I.StatsTable&gt; &amp; {spc?: number};\n    } = {}\n  ) {\n    this.species = extend(true, {}, gen.species.get(toID(name)), options.overrides);\n\n    this.gen = gen;\n    this.name = options.name || name as I.SpeciesName;\n    this.types = this.species.types;\n    this.isDynamaxed = !!options.isDynamaxed;\n    this.weightkg = this.species.weightkg;\n    \/\/ Gigantamax 'forms' inherit weight from their base species when not dynamaxed\n    \/\/ TODO: clean this up with proper Gigantamax support\n    if (this.weightkg === 0 &amp;&amp; !this.isDynamaxed &amp;&amp; this.species.baseSpecies) {\n      this.weightkg = gen.species.get(toID(this.species.baseSpecies))!.weightkg;\n    }\n\n    this.level = options.level || 100;\n    this.gender = options.gender || this.species.gender || 'M';\n    this.ability = options.ability || this.species.abilities?.[0] || undefined;\n    this.abilityOn = !!options.abilityOn;\n\n    this.item = options.item;\n    this.nature = options.nature || ('Serious' as I.NatureName);\n    this.ivs = Pokemon.withDefault(gen, options.ivs, 31);\n    this.evs = Pokemon.withDefault(gen, options.evs, gen.num &gt;= 3 ? 0 : 252);\n    this.boosts = Pokemon.withDefault(gen, options.boosts, 0, false);\n\n    if (gen.num &lt; 3) {\n      this.ivs.hp = Stats.DVToIV(\n        Stats.getHPDV({\n          atk: this.ivs.atk,\n          def: this.ivs.def,\n          spe: this.ivs.spe,\n          spc: this.ivs.spa,\n        })\n      );\n    }\n\n    this.rawStats = {} as I.StatsTable;\n    this.stats = {} as I.StatsTable;\n    for (const stat of STATS) {\n      const val = this.calcStat(gen, stat);\n      this.rawStats[stat] = val;\n      this.stats[stat] = val;\n    }\n\n    const curHP = options.curHP || options.originalCurHP;\n    this.originalCurHP = curHP &amp;&amp; curHP &lt;= this.rawStats.hp ? curHP : this.rawStats.hp;\n    this.status = options.status || '';\n    this.toxicCounter = options.toxicCounter || 0;\n    this.moves = options.moves || [];\n  }\n\n  maxHP(original = false) {\n    \/\/ Shedinja still has 1 max HP during the effect even if its Dynamax Level is maxed (DaWoblefet)\n    return !original &amp;&amp; this.isDynamaxed &amp;&amp; this.species.baseStats.hp !== 1\n      ? this.rawStats.hp * 2\n      : this.rawStats.hp;\n  }\n\n  curHP(original = false) {\n    \/\/ Shedinja still has 1 max HP during the effect even if its Dynamax Level is maxed (DaWoblefet)\n    return !original &amp;&amp; this.isDynamaxed &amp;&amp; this.species.baseStats.hp !== 1\n      ? this.originalCurHP * 2\n      : this.originalCurHP;\n  }\n\n  hasAbility(...abilities: string[]) {\n    return !!(this.ability &amp;&amp; abilities.includes(this.ability));\n  }\n\n  hasItem(...items: string[]) {\n    return !!(this.item &amp;&amp; items.includes(this.item));\n  }\n\n  hasStatus(...statuses: I.StatusName[]) {\n    return !!(this.status &amp;&amp; statuses.includes(this.status));\n  }\n\n  hasType(...types: I.TypeName[]) {\n    for (const type of types) {\n      if (this.types.includes(type)) return true;\n    }\n    return false;\n  }\n\n  named(...names: string[]) {\n    return names.includes(this.name);\n  }\n\n  clone() {\n    return new Pokemon(this.gen, this.name, {\n      level: this.level,\n      ability: this.ability,\n      abilityOn: this.abilityOn,\n      isDynamaxed: this.isDynamaxed,\n      item: this.item,\n      gender: this.gender,\n      nature: this.nature,\n      ivs: extend(true, {}, this.ivs),\n      evs: extend(true, {}, this.evs),\n      boosts: extend(true, {}, this.boosts),\n      originalCurHP: this.originalCurHP,\n      status: this.status,\n      toxicCounter: this.toxicCounter,\n      moves: this.moves.slice(),\n      overrides: this.species,\n    });\n  }\n\n  private calcStat(gen: I.Generation, stat: I.StatID) {\n    return Stats.calcStat(\n      gen,\n      stat,\n      this.species.baseStats[stat],\n      this.ivs[stat]!,\n      this.evs[stat]!,\n      this.level,\n      this.nature\n    );\n  }\n\n  static getForme(\n    gen: I.Generation,\n    speciesName: string,\n    item?: I.ItemName,\n    moveName?: I.MoveName\n  ) {\n    const species = gen.species.get(toID(speciesName));\n    if (!species || !species.otherFormes) {\n      return speciesName;\n    }\n\n    let i = 0;\n    if (\n      (item &amp;&amp;\n        ((item.includes('ite') &amp;&amp; !item.includes('ite Y')) ||\n          (speciesName === 'Groudon' &amp;&amp; item === 'Red Orb') ||\n          (speciesName === 'Kyogre' &amp;&amp; item === 'Blue Orb'))) ||\n      (moveName &amp;&amp; speciesName === 'Meloetta' &amp;&amp; moveName === 'Relic Song') ||\n      (speciesName === 'Rayquaza' &amp;&amp; moveName === 'Dragon Ascent')\n    ) {\n      i = 1;\n    } else if (item?.includes('ite Y')) {\n      i = 2;\n    }\n\n    return i ? species.otherFormes[i - 1] : species.name;\n  }\n\n  private static withDefault(\n    gen: I.Generation,\n    current: Partial&lt;I.StatsTable&gt; &amp; {spc?: number} | undefined,\n    val: number,\n    match = true,\n  ) {\n    const cur: Partial&lt;I.StatsTable&gt; = {};\n    if (current) {\n      assignWithout(cur, current, SPC);\n      if (current.spc) {\n        cur.spa = current.spc;\n        cur.spd = current.spc;\n      }\n      if (match &amp;&amp; gen.num &lt;= 2 &amp;&amp; current.spa !== current.spd) {\n        throw new Error('Special Attack and Special Defense must match before Gen 3');\n      }\n    }\n    return {hp: val, atk: val, def: val, spa: val, spd: val, spe: val, ...cur};\n  }\n}<\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">\/calc\/src\/result.ts<\/h3>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;javascript&quot;,&quot;mime&quot;:&quot;application\/typescript&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;TypeScript&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;typescript&quot;}\">import {RawDesc, display, displayMove, getRecovery, getRecoil, getKOChance} from '.\/desc';\nimport {Generation} from '.\/data\/interface';\nimport {Field} from '.\/field';\nimport {Move} from '.\/move';\nimport {Pokemon} from '.\/pokemon';\n\nexport type Damage = number | number[] | [number, number] | [number[], number[]];\n\nexport class Result {\n  gen: Generation;\n  attacker: Pokemon;\n  defender: Pokemon;\n  move: Move;\n  field: Field;\n  damage: number | number[] | [number[], number[]];\n  rawDesc: RawDesc;\n\n  constructor(\n    gen: Generation,\n    attacker: Pokemon,\n    defender: Pokemon,\n    move: Move,\n    field: Field,\n    damage: Damage,\n    rawDesc: RawDesc,\n  ) {\n    this.gen = gen;\n    this.attacker = attacker;\n    this.defender = defender;\n    this.move = move;\n    this.field = field;\n    this.damage = damage;\n    this.rawDesc = rawDesc;\n  }\n\n  \/* get *\/ desc() {\n    return this.fullDesc();\n  }\n\n  range(): [number, number] {\n    const range = damageRange(this.damage);\n    if (typeof range[0] === 'number') return range as [number, number];\n    const d = range as [number[], number[]];\n    return [d[0][0] + d[0][1], d[1][0] + d[1][1]];\n  }\n\n  fullDesc(notation = '%', err = true) {\n    return display(\n      this.gen,\n      this.attacker,\n      this.defender,\n      this.move,\n      this.field,\n      this.damage,\n      this.rawDesc,\n      notation,\n      err\n    );\n  }\n\n  moveDesc(notation = '%') {\n    return displayMove(this.gen, this.attacker, this.defender, this.move, this.damage, notation);\n  }\n\n  recovery(notation = '%') {\n    return getRecovery(this.gen, this.attacker, this.defender, this.move, this.damage, notation);\n  }\n\n  recoil(notation = '%') {\n    return getRecoil(this.gen, this.attacker, this.defender, this.move, this.damage, notation);\n  }\n\n  kochance(err = true) {\n    return getKOChance(\n      this.gen,\n      this.attacker,\n      this.defender,\n      this.move,\n      this.field,\n      this.damage,\n      err\n    );\n  }\n}\n\nexport function damageRange(\n  damage: Damage\n): [number, number] | [[number, number], [number, number]] {\n  \/\/ Fixed Damage\n  if (typeof damage === 'number') return [damage, damage];\n  \/\/ Standard Damage\n  if (damage.length &gt; 2) {\n    const d = damage as number[];\n    if (d[0] &gt; d[d.length - 1]) return [Math.min(...d), Math.max(...d)];\n    return [d[0], d[d.length - 1]];\n  }\n  \/\/ Fixed Parental Bond Damage\n  if (typeof damage[0] === 'number' &amp;&amp; typeof damage[1] === 'number') {\n    return [[damage[0], damage[1]], [damage[0], damage[1]]];\n  }\n  \/\/ Parental Bond Damage\n  const d = damage as [number[], number[]];\n  if (d[0][0] &gt; d[0][d[0].length - 1]) d[0] = d[0].slice().sort();\n  if (d[1][0] &gt; d[1][d[1].length - 1]) d[1] = d[1].slice().sort();\n  return [[d[0][0], d[1][0]], [d[0][d[0].length - 1], d[1][d[1].length - 1]]];\n}<\/pre><\/div>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Screenshot<\/h2>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"879\" src=\"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2022\/09\/scrnli_9_19_2022_1-21-53-AM-1024x879.png\" alt=\"Pokemon Damage Calculator\" class=\"wp-image-3362\" title=\"Pokemon Damage Calculator\" srcset=\"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2022\/09\/scrnli_9_19_2022_1-21-53-AM-1024x879.png 1024w, https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2022\/09\/scrnli_9_19_2022_1-21-53-AM-300x258.png 300w, https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2022\/09\/scrnli_9_19_2022_1-21-53-AM-768x659.png 768w, https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2022\/09\/scrnli_9_19_2022_1-21-53-AM.png 1366w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption>Pokemon Damage Calculator<\/figcaption><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Download Pokemon Damage Calculator<\/h2>\n\n\n\n<p>You can download the complete source code of\u00a0the <strong>Pokemon Damage Calculator<\/strong>\u00a0using the link given below.<\/p>\n\n\n<p><a class=\"ep_link_major\" href=\"https:\/\/github.com\/smogon\/damage-calc\" target=\"_blank\" rel=\"noopener\">Download<\/a><\/p>","protected":false},"excerpt":{"rendered":"<p>In this tutorial, you will learn how to make a\u00a0Pokemon Damage Calculator in JavaScript. Basically,\u00a0this\u00a0tool is a damage calculator for all generations of Pok\u00e9mon battling. The main source code of\u00a0the Pokemon Damage Calculator\u00a0is given below. It was a bit difficult to add the complete source code to this article. So, I have provided a download &#8230; <a title=\"How to Make Pokemon Damage Calculator in JavaScript\" class=\"read-more\" href=\"https:\/\/www.edopedia.com\/blog\/how-to-make-pokemon-damage-calculator-in-javascript\/\" aria-label=\"Read more about How to Make Pokemon Damage Calculator in JavaScript\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":1762,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[112],"tags":[],"class_list":["post-3358","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Make Pokemon Damage Calculator in JavaScript<\/title>\n<meta name=\"description\" content=\"In this tutorial, you will learn how to make a\u00a0Pokemon Damage Calculator in JavaScript. Basically,\u00a0this\u00a0tool is a damage calculator for all generations of\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.edopedia.com\/blog\/how-to-make-pokemon-damage-calculator-in-javascript\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Make Pokemon Damage Calculator in JavaScript\" \/>\n<meta property=\"og:description\" content=\"In this tutorial, you will learn how to make a\u00a0Pokemon Damage Calculator in JavaScript. Basically,\u00a0this\u00a0tool is a damage calculator for all generations of\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.edopedia.com\/blog\/how-to-make-pokemon-damage-calculator-in-javascript\/\" \/>\n<meta property=\"og:site_name\" content=\"Edopedia\" \/>\n<meta property=\"article:author\" content=\"trulyfurqan\" \/>\n<meta property=\"article:published_time\" content=\"2022-09-18T20:25:29+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-09-18T20:25:32+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2022\/09\/scrnli_9_19_2022_1-21-53-AM-1024x879.png\" \/>\n<meta name=\"author\" content=\"Furqan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Furqan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Make Pokemon Damage Calculator in JavaScript","description":"In this tutorial, you will learn how to make a\u00a0Pokemon Damage Calculator in JavaScript. Basically,\u00a0this\u00a0tool is a damage calculator for all generations of","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.edopedia.com\/blog\/how-to-make-pokemon-damage-calculator-in-javascript\/","og_locale":"en_US","og_type":"article","og_title":"How to Make Pokemon Damage Calculator in JavaScript","og_description":"In this tutorial, you will learn how to make a\u00a0Pokemon Damage Calculator in JavaScript. Basically,\u00a0this\u00a0tool is a damage calculator for all generations of","og_url":"https:\/\/www.edopedia.com\/blog\/how-to-make-pokemon-damage-calculator-in-javascript\/","og_site_name":"Edopedia","article_author":"trulyfurqan","article_published_time":"2022-09-18T20:25:29+00:00","article_modified_time":"2022-09-18T20:25:32+00:00","og_image":[{"url":"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2022\/09\/scrnli_9_19_2022_1-21-53-AM-1024x879.png","type":"","width":"","height":""}],"author":"Furqan","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Furqan","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.edopedia.com\/blog\/how-to-make-pokemon-damage-calculator-in-javascript\/#article","isPartOf":{"@id":"https:\/\/www.edopedia.com\/blog\/how-to-make-pokemon-damage-calculator-in-javascript\/"},"author":{"name":"Furqan","@id":"https:\/\/www.edopedia.com\/blog\/#\/schema\/person\/3951cb19e3aa56df09e408c98aa02339"},"headline":"How to Make Pokemon Damage Calculator in JavaScript","datePublished":"2022-09-18T20:25:29+00:00","dateModified":"2022-09-18T20:25:32+00:00","mainEntityOfPage":{"@id":"https:\/\/www.edopedia.com\/blog\/how-to-make-pokemon-damage-calculator-in-javascript\/"},"wordCount":133,"commentCount":0,"publisher":{"@id":"https:\/\/www.edopedia.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.edopedia.com\/blog\/how-to-make-pokemon-damage-calculator-in-javascript\/#primaryimage"},"thumbnailUrl":"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2022\/02\/default_featured_image.jpg","articleSection":["Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.edopedia.com\/blog\/how-to-make-pokemon-damage-calculator-in-javascript\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.edopedia.com\/blog\/how-to-make-pokemon-damage-calculator-in-javascript\/","url":"https:\/\/www.edopedia.com\/blog\/how-to-make-pokemon-damage-calculator-in-javascript\/","name":"How to Make Pokemon Damage Calculator in JavaScript","isPartOf":{"@id":"https:\/\/www.edopedia.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.edopedia.com\/blog\/how-to-make-pokemon-damage-calculator-in-javascript\/#primaryimage"},"image":{"@id":"https:\/\/www.edopedia.com\/blog\/how-to-make-pokemon-damage-calculator-in-javascript\/#primaryimage"},"thumbnailUrl":"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2022\/02\/default_featured_image.jpg","datePublished":"2022-09-18T20:25:29+00:00","dateModified":"2022-09-18T20:25:32+00:00","description":"In this tutorial, you will learn how to make a\u00a0Pokemon Damage Calculator in JavaScript. Basically,\u00a0this\u00a0tool is a damage calculator for all generations of","breadcrumb":{"@id":"https:\/\/www.edopedia.com\/blog\/how-to-make-pokemon-damage-calculator-in-javascript\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.edopedia.com\/blog\/how-to-make-pokemon-damage-calculator-in-javascript\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.edopedia.com\/blog\/how-to-make-pokemon-damage-calculator-in-javascript\/#primaryimage","url":"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2022\/02\/default_featured_image.jpg","contentUrl":"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2022\/02\/default_featured_image.jpg","width":880,"height":495,"caption":"Default Featured Image"},{"@type":"BreadcrumbList","@id":"https:\/\/www.edopedia.com\/blog\/how-to-make-pokemon-damage-calculator-in-javascript\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.edopedia.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Make Pokemon Damage Calculator in JavaScript"}]},{"@type":"WebSite","@id":"https:\/\/www.edopedia.com\/blog\/#website","url":"https:\/\/www.edopedia.com\/blog\/","name":"Edopedia","description":"Coding\/Programming Blog","publisher":{"@id":"https:\/\/www.edopedia.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.edopedia.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.edopedia.com\/blog\/#organization","name":"Edopedia","url":"https:\/\/www.edopedia.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.edopedia.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2017\/10\/edopedia_icon_text_10.jpg","contentUrl":"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2017\/10\/edopedia_icon_text_10.jpg","width":400,"height":100,"caption":"Edopedia"},"image":{"@id":"https:\/\/www.edopedia.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.edopedia.com\/blog\/#\/schema\/person\/3951cb19e3aa56df09e408c98aa02339","name":"Furqan","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.edopedia.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/e5e68aef3ad8f0b83d56f4953c512c8e57bd2e6dc64daec33b5d0495d9058f51?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/e5e68aef3ad8f0b83d56f4953c512c8e57bd2e6dc64daec33b5d0495d9058f51?s=96&d=mm&r=g","caption":"Furqan"},"description":"Well. I've been working for the past three years as a web designer and developer. I have successfully created websites for small to medium sized companies as part of my freelance career. During that time I've also completed my bachelor's in Information Technology.","sameAs":["http:\/\/www.edopedia.com\/blog\/","trulyfurqan"],"url":"https:\/\/www.edopedia.com\/blog\/author\/furqan\/"}]}},"_links":{"self":[{"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/posts\/3358","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/comments?post=3358"}],"version-history":[{"count":4,"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/posts\/3358\/revisions"}],"predecessor-version":[{"id":3363,"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/posts\/3358\/revisions\/3363"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/media\/1762"}],"wp:attachment":[{"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/media?parent=3358"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/categories?post=3358"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/tags?post=3358"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}