Discussion in 'Technical Projects' started by sulcata, Jun 10, 2014.
Desolate Land (harsh sun) is halving Fire type moves instead of giving them a 50% boost.
Fixed Desolate Land.
silly typo, I had 0x800 instead of 0x1800
You caught that at a good point as I have made my calculator stop using recursion to calculate probability, which makes it a lot faster and "more accurate" (I'll probably need to make a BigInt class just for this).
oddly enough honko and myself came up with just about identical formulas for recursively calculating probability aside from his "squashing" of multihit damage ranges
Okay, I implemented really really fat integers so probability calculation is "perfect" and fast.
Let me know if I broke something along the way.
I'll probably revamp the GUI or something next.
Some weird glitch happened today where only one side of the calculator was showing. I tried closing down and opening it up again, but that didn't work.
I'm planning an overhaul of the gui anyway but...
I think it was because I minified the HTML source that this happened. No idea why it happened for Safari only though. Thanks @Duster for checking if it was fixed.
Did I forget something ? This is obviously the wrong result.
The damage displayed is what a 0 iv 0 ev SpA Misdreavus would deal to a 31 iv 252 ev HP / 31 iv 252 ev SpD Steelix in 3rd gen, if that can help you.
Oh I tried to simplify some of my code and forgot to account for hidden power, so it's calculating it as physical it seems lol. I'll fix it in a bit (and edit post when fixed etc. etc.)
edit: ok pretty sure i fixed it Misdreavus Hidden Power [Fire 70] vs. Leftovers Steelix: 120 - 142 (34 - 40.2%) -- guaranteed 3HKO after Leftovers
there were also a few micro-optimizations i made that actually made a slightly notable difference (not constantly asking for the length of a node collection). I also noticed an issue with probability calculation. I don't think it actually produced incorrect results which was the funny part. It just took up a little extra memory.
Nope, it's still not fixed =P
Acrobatics doesn't work:
It did the exact same damage even with no item.
It is fixed, I just forgot to update the gh-pages branch.
also fixed doom's thing.
Just a suggestion, I think you should reconfigure the attacking Pokémon section to this:
Fast Physical Attacker
Fast Special Attacker
Bulky Physical Attacker
Bulky Special Attacker
I think the physical and special Life Orb sets and Choice sets are fairly redundant, as it's a matter of moments to change the item.
:o since we can play inverted in other gens can you add past gens support for it?
Also the ability to calc with custom moves would be great (think from anything like CAP, there's a lot of projects like this around) [i.e. have the option custom and be able to edit type, power, and anything that's in the mechanics of another move [e.g. knock off's power adjustment, presence of 2ndary effects+sheer force] altho some might be unnessecary/overcomplex enough to leave alone]
No, you can just change the types if you want to control that. I originally intended them to be an easy solution to things like Conversion, Soak, and Protean, but I guess they can be used for that too.
Already said no to CAP; it's not popular enough to justify more code bloat. I might add a (Custom Move) option to the list, but I worry that people will start calculating base power on their own, which they do improperly 99% of the time basing it on STAB and type effectiveness.
Double post wheee
I added support for Sitrus Berry, Oran Berry, Figy Berry, Wiki Berry, Mago Berry, Aguav Berry, Iapapa Berry, Berry (gsc), and Gold Berry (gsc). So now it takes into account that certain damages will trigger berry healing, while others will not.
Also apparently I broke the link to calculation thing when I tried to make it faster. So I "fixed" it by basically commenting stuff out. I'll be working on a proper fix in the meanwhile, but at least the links work again. I know what broke it and it's awkward to say the least.
u should add hackmons sets!!!!
What would be the point? Just change the original Pokémon's ability. And you can already give them 252 EVs in everything:
he was uh, trolling maybe a little
I added in a "set hp" button, so you can now set the opposing pokemon's HP based on the range of damage dealt by the last attack used. It's right next to the individual expected damage values. This feature does include Leftovers, Sandstorm, and all the other residual effects built in to the calculator.
i.e. click calculate on body slam, click set hp, click hyper beam to find the chance of Body Slam + Hyper Beam KOing chansey.
This has the added effect of allowing you to change stat boosts/drops after setting the HP, meaning that you can find out just how likely say, 2 Latios Draco Meteors are to KO an opponent, or how likely you are to KO after getting your Choice item knocked off, etc.
Note that I'm still planning to code the 100% stat changes at some point in the future.
You can manually input the range of HP for the defender only in the following ways:
A comma separated list, i.e. 1, 2, 3, 3, 3, 4, 4, 5
A weighted comma separated list, i.e. 1:1, 2:1, 3:3, 4:2, 5:1 is the same as 1, 2, 3, 3, 3, 4, 4, 5
A min-max inclusive range, i.e. 1-5 is the same as 1, 2, 3, 4, 5 (cannot combine with other methods)
A simple number.
edit: do note that all HP ranges will not be saved in calculation links. Saving that much info into a url would make it massively blow up in size. Instead, the defender's HP is stored as an average of all the values. Similarly, moves with base power depending on HP like Wring Out and Crush Grip will also utilize the average HP. Healing berries will activate based on the variable HP amount from a turn to turn basis and produce accurate probabilities to KO.
Just an idea - maybe you could list the Pokémon's base stats as well?
potentially customizable base stats would be good probably in case some cap players want to use it
Not really enough room at the moment. I'll consider it if I ever get around to overhauling the GUI (likely not happening).
If I add it in, then it'll be under "more options" or whatever I called it (the button near gen selection), as I don't want people to start doing silly things like doubling base stats instead of just using Huge Power and then complaining about inconsistencies. Pretty much the same case for custom moves, although I don't necessarily need to do it during the rehashing of the GUI.
@magic9mushroom, I made it display the exact fraction(s) for the likelihood to KO. It'll display underneath the damage roll. If there's more than one chance to KO then it'll list all the fractions in order. The HP clearing should be fixed.
If by "transparency" you meant that the source code was obfuscated, you can see the whole body of code here: https://github.com/Sulcata/Sulcata-Damage-Calculator
I just run it through the Google Closure minfier/compiler with default settings for the gh-pages branch. If you run it through yourself you'd get the exact same code.
If you're referring to the chance to KO, it's just calculated with arrays of values with attached weights. The weights can get kinda big when you start getting into 7HKOs, so I implemented some arbitrary precision arithmetic; although it only handles non-negative numbers since that's all I need for probability.
From your previous response I'd guess you have thoughts on the four color map theory? :p
Well, my problem is more with "I don't trust a result without seeing the working" than with "non-constructive proofs are terrible". Although non-constructive proofs are terrible.
Unless I'm misunderstanding what you're saying?
no, that's about right. Not trusting a result in which you don't see every piece fitting together, which I don't completely disagree with. Well, I suppose I haven't learned enough proof based mathematics to really comment.
idk if you're able to read my code or not; I try to format well and comment, although my own code ends up looking cryptic to me at times. I could step through the probability code after calculations if you'd like. Everything calculation and probability related is located under "calculator.js", "ui.js" only plugs the remaining HP back in.
The functions you'd be concerned with would be located around "function WeightedArray". The non-negative integer arithmetic (i add strings!!!) should be right above as well. The "this.chanceToKO" function is exactly what it sounds like, as is "this.rby_calculate". Ctrl+F should work pretty handily if you search the phrases I quoted. Well, that's if you're interested.
rip my previous posts :( anyways..
Just used the calc for the first time that I'ver needed it instead of smogon,s to calculate Moltres vs Staryu Fire Blast+Hyper Beam. Its functionality is very nice, thank you ^.^ When i need to do more calcs of that sort in the future, I shall. :)
You can't select any status besides Badly Poisoned on a defending Pokemon. It just reverts to Healthy. You can work around it with Swap Pokemon, but it's clearly not working the way it should be (Burned and Poisoned are obviously pertinent on a defender, and Paralysed can be in the case of something like Gyro Ball). They're simulated properly when you use the workaround, you just can't access them normally.
Badly Poisoned in RBY doesn't seem to be working properly.
(the following is using the above workaround)
Burn in RBY seems to be running at 1/8 like later gens, rather than 1/16. Poison appears to be correctly running at 1/16, though.
EDIT: Also, the description when chances of an NHKO are very low seems to be bugged.
They should be "possible 3HKO" and "possible 8HKO", or "guaranteed 4HKO" and "99.1% chance to 9HKO".
The issue with status selection is fixed. I meant to reset the Toxic counter value to 0 on selecting a new status, but for some reason I reset the status value 0, which is (No Status).
I was not aware that burn was also 1/16th. I've fixed that too. Do note that while Burn has been fixed, calculations like:
will not work for now due to the calculator lagging out in very specific scenarios such as GSC multihit moves and Psywave, forcing me to limit NHKO to 9 maximum.
Toxic should also be working in terms of calculations.
Fixed the NHKO issues. It was due to a small problem I created when refactoring that code. A string is definitely not less than a number, bar type coercion.
Sorry this took a while, I was closing up some issues with Battle Factory.
So I tried to calc Bish vs. Mega Medicham. and I got
252+ Atk Life Orb Bisharp Knock Off vs. 0 HP/4 Def Mega Medicham: 1 - 1 (0.4 - 0.4%) -- this might take a while...
seems like a good damage roll to me
edit: I can't reproduce that in the online version or my own local copy.
Are you able to input the same information and get the same error? Because I put in exactly what you had on screen and got the correct damage. If it's still happening then send me a link to it.
Ah alright. Gotcha.
Problem still persisting even am using a different connection plus different PC.
EDIT: I shud have edited earlier, I get no problems now! :)
i changed literally everything. this is a good way to use git
gen 7 support is probably pretty poor right now. I'll add things as I read up on them and as people tell me shit.
if anyone is interested in adding translations, i've copied over most of the things i need from PO, but there are still calc specific things that could be translated. PM me and I can walk you through it.
The changes doesn't seem to apply when I switch to, for example Spanish.
It also seems to be a bit unresponsive when I try to pick a Pokémon that apparently has no predetermined set,for example I tried putting Zorua on the Pokemon search bar, didn't work, I just typed the name, clicked on any blank space and the Pokémon name is gone, I only had the option on clicking a predetermined Pokémon set.
"More Options" is blank, although I suppose this is part of the stuff that you mentioned is still yet to be added so I won't mind that much. Also I find it funny how in the EVs and Level boxes you can add 0's infinitely, although it ends up correcting itself after you click out of the box so that doesn't matter much.
Pokemon don't have any translations for Spanish from what I could find in PO's translation files, just moves and abilities iirc. I haven't actually translated anything, those are just placeholders for if anyone decides they want to finish the translation files.
You have to actually click on a set. If you don't want a premade set then click "Blank Set".
edit: btw you can find the probability for multihit moves like bullet seed without assuming that it'll be exactly n-hits. I also implemented like none of gen 7, forgot to actually finish z-moves before i uploaded lol.
Concerning names there's nothing to translate barring type:null's name which is actually there. So I guess it's all about installing-adding the translations that are in the files and that's pretty much it. Moves, abilities, berries and other items are fully translated. I guess the only thing that requires translation are phrases like "guaranteed" or "after spikes/stealth rock damage" and things like that. I can work on that if you wish.
Also the search bar should be displaying results for every Pokémon that could use a blank set, cause for example: While typing "houndo.." the bar instantly shows me houndoom, that's about right. But when I do stuff like "Alaka..." or "Aboma..." it simply tells me to change the search query.
Translating the actual damage report might be slightly complicated across languages since grammatical structures can vary greatly. It's also sort of integrally located in an API that I've excluded from the user interface, so I'll need to either look into extracting it or into creating some sort of translation injection. Could be something interesting for me to figure out.
Working on those would be great. I've added a section in the OP on how to translate these things.
These would be the two files you'd need to edit. In the first file you'd need to edit everything in quotes (after the import section). In the second file just replace your language with the translated version.
--- Post updated ---
Also I think I've found the issue with searching Pokemon. Pretty sure it has something to do with casing. I'll look into it after dinner.
--- Post updated ---
Actually I think the issue is with the select component I'm using. It'll hopefully get fixed relatively soon. If not I'll start looking into alternatives (I kind of like how this select component works though :( )
edit: added gravity and thousand waves
Excuse the terrible delay, I suffered from massive procrastination. I have submitted the Pull Requests for the translations (note the comment I left on the first PR) hopefully everything went out fine, let me know if it any error showed up.
Seems to have disappeared in the new version. :(
Those could get a bit long and ugly. They're still calculated, but idk where to put them. Any ideas?
well, I added the option all by its lonely self in the "More Options" tab.
Apparently I fucked around with gsc crit mechanics and broke them. Should be fixed now, and shouldn't happen again since I added in regression tests for that.
Separate names with a comma.