CS代写之python game代做实现battling game：Project 4 – Monster Masher
Project 4 – Monster Masher
Pitt is being threatened! Monsters are swarming and only YOU can stop them! You will implement a monster battling game and using your own custom functions to break the program into manageable chunks.
The player will start with a certain amount of health points, attack points, and a modifier value which will be used to improve either the attack or defend ability. A configurable number of monsters will be generated with a random number of health points and a random attack value. The player will face the monsters one at a time and decide whether to attack or defend in a particular round. The game ends when all the monsters are slain or the player has no remaining health points.
Integer or blank (blank indicates that no seed should be set)
Number of monsters
Player starting stats:
Random integer between 25 & 35 inclusive
Random integer between 5 & 15 inclusive
Monster Masher should begin by reading the ‘masher.config’ file which can be assumed to be in the same directory as the program. masher.config is a text file containing two lines. The first will either hold an integer or be blank. If this value is not blank it should be passed to random.seed(). The second line will be an integer indicating the number of monsters to generate.
Player data and monsters are then initialized. Use the values in the above tables.
The game loop then beings. It should continue as long as there are monsters to fight and the player’s health is above 0. If either of these conditions is not met exit the game loop. If there are no monsters left notify the user that they won, otherwise inform them of their defeat.
The game loop should perform the following steps:
1. Select a monster
2. While the monster’s health and the player’s health are both above 0:
a. Determine the monster’s attack. This will be a random integer between 0 and the monster’s attack value, inclusive
b. Display a hint to the user as to the size of the attack value. The attack value will range from 0-15 so break it into 5 hints:
i. 0-2 – “It’s looking tired!”
ii. 3-5 – “It’s focused.”
iii. 6-9 – “Looking tough!”
iv. 10-13 – “May be a challenge…”
v. 14-15 – “It’s going berserk!”
c. Prompt if the player would like to attack or defend. The player’s attack and defense for the turn should be based on the following table:
Player Turn Attack
Player Turn Defense
Player’s attack value + random integer between 0 and player modifier
Player’s attack value
Random integer between 0 and player modifier
d. Resolve the attack phase by subtracting the player’s turn attack value from monster’s health. Find the difference between the monster’s attack value and the player’s turn defense value. If the difference is positive (the monster’s attack was greater than the player’s defense) subtract that from the player’s health, otherwise do nothing.
e. Display the results of the round including player’s attack and defense value, monster’s attack value, and remaining health of both.
3. If the player killed the monster add 10 points to the player’s health.
A sample framework has been provided along with some pseudocode. You do not have to use this, but it is provided as a guide.
A function is used for program initialization. The program is initialized properly – 5pts
Gameplay loop is broken into logical portions using functions – 5pts
Feedback is provided as described – 5pts
Damage is computer properly – 5pts
Total – 20pts