#!/usr/bin/env bash

mod() {
   echo $(bc <<< "($1/2)-5")
}

order=$1

if [[ $order == "modifier" ]]; then
    mod "$2"
else
    echo "strength $(($RANDOM%15+3))"
    echo "dexterity $(($RANDOM%15+3))"
    constitution=$(($RANDOM%15+3))
    echo "constitution ${constitution}"
    echo "intelligence $(($RANDOM%15+3))"
    echo "wisdom $(($RANDOM%15+3))"
    echo "charisma $(($RANDOM%15+3))"
    echo "hitpoints $(($(mod "$constitution")+10))"
fi