Description
Function Name: criticalFailure
Inputs:
1. (double) A 1×2 vector of numbers from 1-20, inclusive
Outputs:
1. (char) An output string describing the result of your die roll
Function Description:
With this function you will emulate a die roll for an attack in a Dungeons and Dragons game. If your first roll (the first number in the vector) is anything other than a 1, you should output ‘Good Job!’. If your roll is a 1 however, you have critically goofed, and a second die will be rolled (the second number in the vector) to determine what damage you may have caused to yourself. The table below shows what your output should be for each roll of the second die:
-
Die Roll
Output
1-5
‘Right Leg Wounded’
6-10
‘Left
Leg
Wounded’
11-15
‘Right Arm Wounded’
16-20
‘Left
Arm
Wounded’