This is a simple simulation of a battle RPG-style game where the player controls a hero and battles against monsters. The game is turn-based, where the player chooses an action and then the monster takes its turn.
- Clone the repository
- Open the terminal and navigate to the project folder
- Run the command
python game.py
to start the game
- You will be prompted to select a monster to battle against.
- You control a hero character who has a health of 100 and an attack of 50.
- The monster has its own set of attributes, including health, damage, and energy.
- During each turn, you can select from four actions:
- Attack: Deals damage to the monster based on your hero's attack.
- Defend: You defend yourself and heal 2 health points.
- Do Nothing: The monster will attack you, and you will take damage.
- Escape: You try to escape from the battle. If your hero's attack is higher than the monster's damage, you can escape successfully; otherwise, you must continue the battle.
- The battle ends when either you or the monster's health points drop to zero.
The Hero
class represents the player character. It has the following attributes:
health
: the health points of the hero (default: 100)damage
: the damage points of the hero's attack (default: 50)
The Hero
class has the following methods:
attack()
: deals damage to the target (the monster)setTarget(target)
: sets the target of the hero's attackheal(amount)
: heals the hero by the specified amount
The Monster
class represents the enemy. It has the following attributes:
auto_attack
: the damage points of the monster's attack (default: 15)health
: the health points of the monster (default: 100)energy
: the energy points of the monster (default: 100)
The Monster
class has the following methods:
get_damage(amount)
: reduces the monster's health by the specified amountautoAttack(target)
: the monster's attack (automatic)move(speed)
: moves the monster at the specified speedattributes()
: prints out the monster's attributes
The Fish
class represents a fish. It has the following attributes:
speed
: the speed of the fishhas_scales
: whether the fish has scales or not
The Shark
class inherits from the Monster
and Fish
classes. It has the following attributes:
bite_strength
: the bite strength of the sharkhealth
: the health points of the sharkenergy
: the energy points of the sharkspeed
: the speed of the sharkhas_scales
: whether the shark has scales or not
The Shark
class has the following methods:
bite(target)
: deals damage to the target (the hero)move()
: moves the shark
The Scorpion
class inherits from the Monster
class. It has the following attributes:
poison_damage
: the poison damage of the scorpionhealth
: the health points of the scorpionenergy
: the energy points of the scorpion
The Scorpion
class has the following methods:
autoAttack(target)
: the scorpion's attack (poisonous)