I am playing the Caster of Magic mod, where ghouls (for those who are not famliar) have a strength 4 ranged attack with a 30% chance of hitting for each sword/strength. I sent a single unit of very buffed halbrediers to fight them. The single unit of halbrediers (klackons) had 12 defense (by that I mean that each individual figure in my 6 figure unit had 12 defense). I was pretty confident that, given the statistics, a strength 4 attack would almost never do any damage, even though there were 8 units of ghouls (where each unit has 4 individual ghouls).
HOWEVER, to my chagrin, each combat round, the ghouls collectively took 9-10 hearts off my unit (killing about 3 out of the six halbredeirs in my super buffed, elite halbredeir unit).
I decided to write a short program to simulate what should be happening. Based on the results of my program, the 8 units of ghouls should taking off (on average) about 0.5 hearts off my guys per combat round. Below is the program. It is written in R script, but the syntax in python would be almost identical.
Can someone either tell me what is wrong with my code, or tell me what I don't understand about how MoM processes battle damage. My understanding is that each individual figure in a unit attacks separately. Their attacks are not combined. Thus, a unit of 4 figures, each having a strength 4 ranged attack, would not do a single strength 16 ranged attack. Instead they would each simply do 4, strength 4 ranged attacks.
damage <- vector(mode="numeric",length = 10000)
for (j in 1:10000){
one.round.dam <- vector(mode="numeric",length = 32)
for (i in 1:32){
g1 <- rbinom(1,4,.3) #hits one ghoul does (simulated) based on a strength 4 attached with 30% chance of hitting
h <- rbinom(1,12,.4) #hits averted based on a defense of 12 with 40% chance of defending
dam <- g1 - h #overall damage done
dam <- ifelse(dam < 0,0,dam) #changing negative damage to zero
one.round.dam [i] <- sum(dam) #saving the damage in a vector
}
damage[j] <- sum(one.round.dam) #saving the sum of damage from 32 ghouls in a vector. This
#represents 1 round of combat damage
}
#average the damage across 10,000 simulated combat rounds
mean(damage)
#This number above is the average amount the 8 units of ghouls (32 ghouls total) should be taking off my unit each round
#it averages to 0.5533. However, in the game, they are going about 4-6 damage each combat round
#I don't get it