<< Back to Warzone Classic Forum   Search

Posts 1 - 8 of 8   
How Luck effects outcome of attacks?: 12/31/2017 08:36:34

Level 62
This is my first forum post so sorry if I'm not using the right format etc.

This post is sort of a question I guess...I was trying to write a program that calculates the result of attacks and give the same output as warlight (I still haven't got my head around calling it warzone). I have managed to match it perfectly for 0% luck both straight round and weighted random, and for 100% luck both straight round and weighted random. I am struggling to get the results right for all the luck values in between and was hoping the community could help.

There isn't a lot of information on how the luck works (that I've found) but from what I've read it seems that you take the 100% and 0% luck values for an attack and then get the value in between which corresponds to the luck of the game.
To try to calculate this I got absolute value of the difference between the two values, then multiplied this by the percentage luck. If the random number was the higher of the two I'd add the difference the 0% luck and if not I'd take it away from the 0% luck value.
I assume I'm missing something or there is some other element to it that wasn't in the wiki article?

Thanks to anyone trying to help, sorry for the poor phrasing, I'd be happy to clarify anything if needed :)
How Luck effects outcome of attacks?: 12/31/2017 08:44:29

Level 63

Warzone Creator
Take the result of your 100% luck calculation and the result of your 0% luck calculation, and interpolate them based on the luck percentage.

For example, if it's 50% luck you just average those two numbers.

EDIT: It's all explained here:


Edited 12/31/2017 08:45:29
How Luck effects outcome of attacks?: 12/31/2017 09:14:22

Level 62
How is that different to what I'm doing, as I'm getting different results?
I have read all of those pages already and still don't know what I'm missing?
How Luck effects outcome of attacks?: 12/31/2017 09:23:03

Level 63

Warzone Creator
You say you've already solved it for 0% luck, right? Let's call that outcome X.

You say you've already solved it for 100% luck, right? Let's call that outcome Y.

To find an outcome for any other luck percentage, just do: (Y - X) * LuckPercentage + X
How Luck effects outcome of attacks?: 12/31/2017 10:18:33

Level 61
Alternatively, the M'Hunters Strategy Guide has an appendix on luck: http://tinyurl.com/MH-strategy-guide
Last pages of the guide.
How Luck effects outcome of attacks?: 12/31/2017 10:56:07

Level 62
Maybe there is something wrong with the way I'm testing it because I have done exactly what you're saying and I'm getting results different to warlight graphs.
Or maybe I'm just reading the graph wrong, the percentage shown in this picture (https://s9.postimg.org/w01o4c9q7/Untitled.png) refers to the chance that the defenders armies are at 0 and the attackers armies >1 doesn't it?

p.s. Sorry for asking so many questions
How Luck effects outcome of attacks?: 12/31/2017 13:33:21

Level 60
The Probability graph is generated by running the attack thousands of times for each number of attacking armies. Therefore, the numbers could change slightly from one run to the next. However, they are typically only off by one percent at most.

Is your calculation more then 1% off? Also, note that the probability graph don't give the correct answer per say. Just the 'likely' correct answer.


Astute players will notice that the probability graph dips a bit where the number of attacking armies equals the number of defending armies. This is most easily seen when the number of defenders is 1 or 2. This is not a glitch and does indeed reflect the true probability. This is due to an edge case in the combat system. If equal numbers fight and both sides kill the maximum number of armies possible, and since every territory must have at least one army, there would be no armies left to control the captured territory. In this event, Warzone simply resurrects one defending army and allows it to retain control of the territory. For this reason, it's rarely a good idea to attack a 1 with 1 or to attack a 2 with 2.

This wiki page is slightly out of date. But all the technical information there is still accurate.

Edited 12/31/2017 13:38:17
How Luck effects outcome of attacks?: 1/23/2018 17:26:27

Level 63
I can see why you might be confused, so I'll try to explain how it works.

Let's examine this case: 100 armies attacking 60 defending armies with 19% SR luck.

In order to calculate the probability that these armies will take the territory, we do these steps:

1) First of all, we calculate binomial probabilities (also called 100% luck in WZ).

  [1] 1.606938e-40 2.410407e-38 1.789727e-36 8.769664e-35 3.189965e-33 9.187099e-32 2.181936e-30 4.395043e-29 7.663856e-28 1.175125e-26 1.604045e-25
 [12] 1.968601e-24 2.190068e-23 2.223762e-22 2.072864e-21 1.782663e-20 1.420559e-19 1.052885e-18 7.282455e-18 4.714432e-17 2.864017e-16 1.636581e-15
 [23] 8.815222e-15 4.484265e-14 2.158053e-13 9.840720e-13 4.258004e-12 1.750513e-11 6.845755e-11 2.549454e-10 9.050560e-10 3.065512e-09 9.915016e-09
 [34] 3.064641e-08 9.058719e-08 2.562323e-07 6.939626e-07 1.800552e-06 4.477688e-06 1.067756e-05 2.442492e-05 5.361569e-05 1.129759e-04 2.285792e-04
 [45] 4.441709e-04 8.291190e-04 1.487007e-03 2.562714e-03 4.244495e-03 6.756543e-03 1.033751e-02 1.520222e-02 2.148776e-02 2.919091e-02 3.811036e-02
 [56] 4.781118e-02 5.762955e-02 6.672895e-02 7.420719e-02 7.923819e-02 8.121914e-02 7.988768e-02 7.537790e-02 6.819905e-02 5.914136e-02 4.913282e-02
 [67] 3.908293e-02 2.974969e-02 2.165603e-02 1.506506e-02 1.000750e-02 6.342785e-03 3.832099e-03 2.204769e-03 1.206664e-03 6.274654e-04 3.096047e-04
 [78] 1.447502e-04 6.402414e-05 2.674426e-05 1.053055e-05 3.900205e-06 1.355559e-06 4.409650e-07 1.338644e-07 3.779700e-08 9.888749e-09 2.386939e-09
 [89] 5.289241e-10 1.069734e-10 1.961179e-11 3.232713e-12 4.743655e-13 6.120845e-14 6.837114e-15 6.477266e-16 5.060364e-17 3.130122e-18 1.437301e-19
[100] 4.355457e-21 6.533186e-23

2) Calculate how many armies are going to be killed by interpolating 0% and 100% results based on the luck modifier (19%), and round up these numbers:

  [1] 49 49 49 49 49 50 50 50 50 50 50 51 51 51 51 51 52 52 52 52 52 53 53 53 53 53 54 54 54 54 54 54 55 55 55 55 55 56 56 56 56 56 57 57 57 57 57 58
 [49] 58 58 58 58 58 59 59 59 59 59 60 60 60 60 60 61 61 61 61 61 62 62 62 62 62 62 63 63 63 63 63 64 64 64 64 64 65 65 65 65 65 66 66 66 66 66 66 67
 [97] 67 67 67 67 68

3) Now sum up all these binomial probabilities which gives at least 60 kills and you'll get a solution:



I skipped some details, because they were already mentioned by Fizzer, but I'll give you my code written in "R"

A <- 100
D <- 60
L <- 0.19
binomial <- c()
kills <- c()
output <- 0

for (i in 0:A) {

binomial <- c(binomial,factorial(A)/factorial(i)/factorial(A-i)*0.6^i*0.4^(A-i))
kills <- c(kills, round((i-0.6*A)*L+0.6*A))


output <- sum(binomial[match(D, kills):A])
Posts 1 - 8 of 8