20 lines
480 B
R
20 lines
480 B
R
|
|
#' Reroll
|
|
#'
|
|
#' If the die lands on the provided \code{numbers}, then the die is re-rolled
|
|
#' once with the output being final.
|
|
#'
|
|
#' @param x The die to possibly reroll
|
|
#' @param numbers The numbers to reroll on
|
|
#'
|
|
#' @return A new die with updated probabilties
|
|
#' @export
|
|
#'
|
|
#' @examples
|
|
#' paladin.greataxe <- reroll(d12, 1:2)
|
|
reroll <- function(x, numbers){
|
|
which.die.fun <- function(a, b){
|
|
ifelse(a %in% numbers, b, a)
|
|
}
|
|
return(combineDice(x, x, which.die.fun))
|
|
}
|