Southperry.net
Hits to Kill Script - Printable Version

+- Southperry.net (https://www.southperry.net)
+-- Forum: Maplestory (https://www.southperry.net/forumdisplay.php?fid=15)
+--- Forum: Training Center (https://www.southperry.net/forumdisplay.php?fid=32)
+--- Thread: Hits to Kill Script (/showthread.php?tid=6058)

Pages: 1 2


Hits to Kill Script - ZachAttack - 2008-12-28

Okay, got it.

Do I do skills before or after subtracting defense?

Like, for Corkscrew for instance, 420% onto my range, then do the max/min defense reduc?

Would it even matter?



Hits to Kill Script - Russt - 2008-12-28

Order of Operations says it all, but subtract defense first.

And tbh it wouldn't work very well for a Brawler because they don't spam skills.


Hits to Kill Script - ZachAttack - 2008-12-28

Okay, I did that.

How come nothing is coming up now?

It says

"Mean:" And then blankness.

I put 16000 for hp
1742 for Min
3401 for max

1 hit per attack



Hits to Kill Script - Russt - 2008-12-28

Hm. I'm getting a result, 6.74 hits on average. It might not work on your browser, I didn't check for that. I'm using Firefox 3.

Critical damage is unchecked, right?

Edit: Works on IE as well, but the mean damage displays in the wrong place. The result is still the same, though.


Hits to Kill Script - ZachAttack - 2008-12-28

I'm on Opera - that's probably why.
And yes, it's unchecked.



Hits to Kill Script - Technolink - 2008-12-31

So what's the formula you ended up using?

I'm quite curious


Hits to Kill Script - Russt - 2008-12-31

Copypasta:

Code:
/* probability to deal x or greater damage in n hits with damage range a to b */
function dicecdf(x,a,b,n) {
    var result = 0;
    var c;
    for(k=0;k<=n;k++) {
        c = a*(n-k)+b*k;
        if(x>=c) [b]result += choose(n,k)*Math.pow(-1,k)*Math.pow(x-c,n)[/b];
    }
    result = [b]1-result/Math.pow(b-a,n)/factorial(n)[/b];
    if(result < 0) result = 0;
    return result;
}

/* factorial function */
function factorial(x) {
    var result = 1;
    for(i=1;i<=x;i++) {
        result *= i;
    }
    return result;
}

/* choose function */
function choose(a,b) {
    var result = 1;
    for(i=1;i<=b;i++) {
        result *= (a-i+1)/i;
    }
    return result;
}