This is a multi-file, text-based RPG engine developed from scratch. This project focuses on OOP principles and utilizes dynamic memory management to handle game states, character inheritance, and unique boss/player mechanics.
-
State Persistence & Factory Reset: This game features a universal reset system using Python's
__dict__attribute in order to reset global objects to their original states at the start of every game loop. -
Class Inheritance & Polymorphism:
- Hero Base Class: Manages gold, healing logic, and basic combat.
- Specialized Subclasses: The
Mageclass overrides the standard attack pattern to implement a magic resource management system. - Enemy AI: Includes specialized classes like the
Vampire(Health Steal) andWizard(Turn-based debuffing).
- Dynamic Entity Scaling (The Mimic):
The
Mimicclass is an exercise in Dynamic Initialization. It does not have fixed stats; instead, it clones themax_healthandatt_powerof the specificHeroinstance at the moment of creation.
main.py: The central execution hub and game loop logic.classes.py: The "Circuit Board" where all Hero and Enemy instances are wired together.hero.py: The Blueprint for player characters.enemy.py: The Blueprint for monster entities and AI behaviors.
- Clone this repository or download all 4
.pyfiles into a single directory. - Run the command:
python main.py - Choose your Hero and try to survive the dungeon!