Displaying 1 result from an estimated 1 matches for "num_attacks".
2006 May 12
6
Newbie to R: would like to solve a problem
...ch is always determined by a single
shot).
The (simplified) function to represent the damage would be:
sdmg <- function(min, max, skill){
if(runif(1) > .4) (runif(1) * (max-min) + min) * skill
else (runif(1) * (max-min) + min) * (skill+1)
}
total_damage <- function(min, max, skill, num_attacks){
total <- 0
for(i in 1:num_attacks){
total <- total + sdmg(min, max, skill)
}
total
}
--------------------
The above is how damage is calculated. So the probability distribution
looks like 2 rectangles next to each other, one with height .6 and the
other with height .4. Sdmg is...