Programming mIRC Damage Calculator

Misty

oh
is a Site Content Manager Alumnusis a Battle Simulator Admin Alumnusis a Programmer Alumnusis a Smogon Discord Contributor Alumnusis a Researcher Alumnusis a Top Contributor Alumnusis an Administrator Alumnus
The attached file is a fairly comprehensive damage calculator, used to calculate damage at level 100, created by me. I'm putting this here because people keep asking for it. To use it, save the file to your computer, then go into mIRC, hit alt+r, select the Aliases tab, then go to File -> Load... From there, find and open the damagecalc.txt file. You should immediately see the following:

dam {
blah blah blah
etc etc etc
stuff
...

Close the window.

Once you've loaded it, the usage is as follows:

/dam <attack> <defense> <base power> [target HP] <multiplier equation>

The multiplier equation is the trickiest part, so here are some examples:

A 359 attack Garchomp, holding Dragon Plate, using Outrage on a Suicune with 350 defense and 404HP:

/dam 359 350 120 404 * 1.5 * 1.2

The 1.5 indicates STAB; the 1.2 indicates the Dragon Plate. The * means that these numbers are being multiplied into the final numbers. If you desire, you can use / to divide -

A 359 attack Garchomp, holding Dragon Plate, using Outrage on a Skarmory with 400 defense and unknown HP:

/dam 359 400 120 * 1.5 * 1.2 / 2

The 1.5 and 1.2 are as before. The / 2 indicates the attack is not very effective, so the damage is halved. Note that the HP parameter is optional.


As a note - Choice items, Soul Dew, any stat boosts or drops, and abilities such as Guts should be multiplied directly into the attack stat. However, you can usually put these in the multipliers - as far as I can tell, it makes no difference.
 

Attachments

In other words, meybe stop asking "how much does x do to y" and do the hard work yourself. (:

If you're amazing like me and hate aliases you can always change the "dam" from the first line to "alias" dam and put the whole thing in remote. But that's just because I'm awesome.
 

X-Act

np: Biffy Clyro - Shock Shock
is a Site Content Manager Alumnusis a Programmer Alumnusis a Smogon Discord Contributor Alumnusis a Top Researcher Alumnusis a Top CAP Contributor Alumnusis a Top Tiering Contributor Alumnusis a Top Contributor Alumnusis a Smogon Media Contributor Alumnusis an Administrator Alumnus
As a note - Choice items, Soul Dew, any stat boosts or drops, and abilities such as Guts should be multiplied directly into the attack stat. However, you can usually put these in the multipliers - as far as I can tell, it makes no difference.
They do make a difference, but it's a minimal one - usually by 1 or 2 damage at most. If people are THAT fussy about their damage calculation (like I am), they must calculate those stat boosts in the attack stat, and not the multipliers, as Misty says. This difference, incidentally, is mainly because of the "+2" part in the damage formula.

Say you have a Choice Banded Tyranitar with a normal 403 attack as an example. This 403 is multiplied by 1.5, giving 604. Say it's using Stone Edge against a Pokemon with 200 defense for neutral damage.

Maximum damage will be ((604 * 100 * 0.84) / 200) + 2) * 1.5 = 382
Minimum damage will be ((604 * 100 * 0.84) / 200) + 2) * 0.85 * 1.5 = 324

If we put the 1.5 in the multipliers part, we'd have:

Maximum damage: ((403 * 100 * 0.84) / 200) + 2) * 1.5 * 1.5 = 384
Minimum damage: ((403 * 100 * 0.84) / 200) + 2) * 0.85 * 1.5 * 1.5 = 325

As I said, this doesn't change the damage percentage much, but, for all the fussy people out there, it makes a difference of 1 or 2 damage.
 
How does this work exactly? I followed all of the steps, but every time I open it I get a bunch of $ and ? and the occasional word "Attack" or "Defense" here and there... Is there a place I need to open the file or what? Sorry for the dumb question but I've never used mIRC before if that has anything to do with it...
 

Misty

oh
is a Site Content Manager Alumnusis a Battle Simulator Admin Alumnusis a Programmer Alumnusis a Smogon Discord Contributor Alumnusis a Researcher Alumnusis a Top Contributor Alumnusis an Administrator Alumnus
Use /dam in a window, as shown... it has no GUI interface, you just enter text and it gives back.
 
Thanks a lot for this. I'll use it in a project to give the community a list of "magic numbers" for certain pokes to reach; set attacking stats that enable it to OHKO or 2HKO specific walls, more specifically.
 
Why can't I open the attachment?

MetalKid's calculator is good but it's a lot of hassle. This one has been recommended to me so I want to try it.
 
Is there anyway to make the script work on ChatZilla? I used it on mIRC and it worked like a charm (great work on this, very helpful), but I put it on ChatZilla and get the following on every start-up: "SyntaxError: missing ; before statement @ <file:///C:/My%20Documents/pokes/damagecalc.txt> 1"
 
No, it doesn't work on chatzilla because mirc has its own scripting language, which I am pretty sure isn't recognized by Chatzilla. My primary reason to switch from chatzilla to mirc :(
 
A modified version

I've made a modified version of the calculator (with some help from Team Rocket Elite).

This version does the following things:
  • Calculates OHKO, 2HKO (including Sandstorm and Leftovers) chances.
  • Tells you how high an attack stats is required for a guaranteed OHKO for things that have a chance of OHKOing.
  • Allow you to enter things such as "405*2" in place of stats to calculate boosted stats more easily (ie Porygon-Z after Nasty Plot using Ice Beam on a max HP/min SpDef Blissey after a Calm Mind would be /dam 405*2 306*1.5 95 714).
Examples:
  • Porygon-Z with a +2 SpAtk boost using Ice Beam on a +1 SpDef Blissey: /dam 405*2 306*1.5 95 714
  • Persian with a Life Orb using a Technicianed Icy Wind on Skarmory: /dam 251 176 55*1.5 334 *1.3
  • Rampardos with a +6 Atk boost holding Life Orb using a super-effective STAB Stone Edge on Dragonite: /dam 471*4 226 100 324 *1.3 *2 *1.5
Code:
dam {
  var %basedam = $calc(($int($calc($int($calc(42 * $int($calc($1)) * $int($calc($3)) / $int($calc($2)))) / 50)) + 2) $iif($4 isnum,$5-,$4-))
  if ($4 isnum) {
    var %mn = $int($calc(%basedam *.85)) | var %mx = $int(%basedam)
    var %min = $round($calc(%mn * 100 / $4),2) | var %max = $round($calc(%mx * 100 / $4),2)
    if (%mn < $4 && %mx >= $4) {
      var %i 0 | while ($int($calc(%basedam * ((%i + 85) / 100))) < $4) { inc %i }
      var %x $int($calc($1))
      while ($int($calc(($int($calc($int($calc(42 * %x * $int($calc($3)) / $int($calc($2)))) / 50)) + 2) $5- *.85)) <= $4) { inc %x }
      var %OHKO ( $+ $calc(100 - %i / .16) $+ % OHKO, $calc(%x - $int($calc($1))) more $+(point,$iif($calc(%x - $int($calc($1))) != 1,s)) required for OHKO)
    }
    if (%mn < $int($calc($4 / 2)) && %mx >= $int($calc($4 / 2))) {
      var %j 0 | var %a 0 | while (%j <= 16) {
        var %i 0 | while ($calc($int($calc(%basedam * ((%i + 85) / 100))) + $int($calc(%basedam * ((%j + 85) / 100)))) < $4 && %i < 15) { inc %i }
        inc %a %i | inc %j
      }
      var %THKO $calc((256 - %a)/2.56) $+ % 2HKO
    }
    if (%mn <= $int($calc($4 $iif($calc($4 / 16) < 1,/2-1,*15/32))) && %mx >= $int($calc($4 $iif($calc($4 / 16) < 1,/2-1,*15/32)))) {
      var %j 0 | var %a 0 | while (%j <= 16) {
        var %i 0 | while ($calc($int($calc(%basedam * ((%i + 85)/100))) + $int($calc(%basedam * ((%j + 85)/100)))) < $int($calc($4 $iif($calc($4 / 16) < 1,-1,*15/16))) && %i < 15) { inc %i }
        inc %a %i | inc %j
      }
      var %THKO $iif(%THKO,$+(%THKO,$chr(44))) $calc((256 - %a)/2.56) $+ % $iif(!%THKO,2HKO) with Sandstorm
    }
    if (%mn <= $int($calc($4 $iif($calc($4 / 16) < 1,/2+1,*17/32))) && %mx >= $int($calc($4 $iif($calc($4 / 16) < 1,/2+1,*17/32)))) {
      var %j 0 | var %a 0 | while (%j <= 16) {
        var %i 0 | while ($calc($int($calc(%basedam * ((%i + 85)/100))) + $int($calc(%basedam * ((%j + 85)/100)))) < $int($calc($4 $iif($calc($4 / 16) < 1,+1,*17/16))) && %i < 15) { inc %i }
        inc %a %i | inc %j
      }
      var %THKO $iif(%THKO,$+(%THKO,$chr(44))) $calc((256 - %a)/2.56) $+ % $iif(!%THKO,2HKO) with Leftovers
    }
    echo 4 -a $1 attack vs $2 defense, $3 $+(power,$iif($5,$+($chr(40),$5-,$chr(41))),$chr(44)) $4 max HP: %min $+ % - %max $+ % $iif(%OHKO,%OHKO) $iif(%THKO,$+($chr(40),%THKO,$chr(41)))
  }
  else { echo 4 -a $1 attack vs $2 defense, $3 $+(power,$iif($4,$+($chr(40),$4-,$chr(41))),:) $int($calc(%basedam *.85)) - $int(%basedam) }
}
 
I just noticed a small problem with the non-HP based damage calculations. It has been fixed and the script has been updated.
 
I was just wondering, could I put this program into my calculator (TI-84)? It would be nice to have this handy when I start to brainstorm during class.
 

Users Who Are Viewing This Thread (Users: 1, Guests: 0)

Top