Skip to content

JayroGG/PythonGame

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Battle RPG Simulation

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.

Getting Started

  1. Clone the repository
  2. Open the terminal and navigate to the project folder
  3. Run the command python game.py to start the game

How to Play

  1. You will be prompted to select a monster to battle against.
  2. You control a hero character who has a health of 100 and an attack of 50.
  3. The monster has its own set of attributes, including health, damage, and energy.
  4. During each turn, you can select from four actions:
    1. Attack: Deals damage to the monster based on your hero's attack.
    2. Defend: You defend yourself and heal 2 health points.
    3. Do Nothing: The monster will attack you, and you will take damage.
    4. 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.
  5. The battle ends when either you or the monster's health points drop to zero.

Classes

Hero

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 attack
  • heal(amount): heals the hero by the specified amount

Monster

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 amount
  • autoAttack(target): the monster's attack (automatic)
  • move(speed): moves the monster at the specified speed
  • attributes(): prints out the monster's attributes

Fish

The Fish class represents a fish. It has the following attributes:

  • speed: the speed of the fish
  • has_scales: whether the fish has scales or not

Shark

The Shark class inherits from the Monster and Fish classes. It has the following attributes:

  • bite_strength: the bite strength of the shark
  • health: the health points of the shark
  • energy: the energy points of the shark
  • speed: the speed of the shark
  • has_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

Scorpion

The Scorpion class inherits from the Monster class. It has the following attributes:

  • poison_damage: the poison damage of the scorpion
  • health: the health points of the scorpion
  • energy: the energy points of the scorpion

The Scorpion class has the following methods:

  • autoAttack(target): the scorpion's attack (poisonous)

About

RPG battle module

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages