#' #' Disadvantage #' #' Disadvantage a die roll, which means that when both die are rolled, the result #' is the lower number. #' #' @param x A die to roll. #' @param y A die to roll. If not specified, then x is disadvantaged against itself. #' @return A die representing the minimum of both die #' @examples #' disadvantage(d20,d20) #' #' @export disadvantage <- function(x, y=NULL){ if(is.null(y)){ y = x } return(combineDice(x, y, pmin)) } #' #' Advantage #' #' Advantage a die roll, which means that when both die are rolled, the result #' is the higher number. #' #' @param x A die to roll. #' @param y A die to roll. If not specified, then x is advantaged against itself. #' @return A die representing the maximum of both die #' @examples #' advantage(d20,d20) #' #' @export advantage <- function(x, y=NULL){ if(is.null(y)){ y = x } return(combineDice(x, y, pmax)) }