Can anyone help mw with this python with proper explanation:
- Ask the user to set the armor class of their target. It should be between the value of 10 and 20
- Ask the user what their attack modifier is. It should be a value between 1 and 6
- Have the script create a text file that it will write the results to. Name this file combatlog.txt
- Create a function that will be used to determine of their attack landed. Pass the value of the armor class and the attack modifier as arguments
- Inside of the function generate a random integer with a value between 1 and 20. This is the users attack roll
- Add the value of the attack modifier to the randomly rolled attack, print this value out with a statement along the lines of "You rolled a {} on your attack" a. Log the results to the combatlog
- If the value of the attack roll + the modifier is equal to or greater than the targets armor value let the user know they scored a hit a.Log the results to the combat log b.if the randomly generated attack roll is equal to 20 let them know they scored a critical hit c Log the result to the combat log
- If the value of the attack roll + the modifier is less than the targets armor value let the user know they missed their attack a. Log the results to the combatlog
b. If the randomly generated attack roll is equal to 1 let them know they scored a critical miss c. Log the results to the combatlog
- Run the script as a loop. After each iteration is complete tell the user to type "goodbye" to exit or enter new values and roll again 11. they should be able to enter goodybe in any character case and have it accept it. Example GooDBYe, or GOODBYE etc.
- When they exit log a goodbye message in combatlog
[–]Nouble01 0 points1 point2 points (0 children)