def main(): player = Hero("King", "The brave king of nowhere!") player.Talk = "Who is here?" enemy = Enemy("Wizard", "The evil wizard!") enemy.Talk = "Your worst enemy!!!!" castle = [] layout(castle) current_room = castle[0] castle[random.randint(1, len(castle) - 1)].Character = enemy print(player) print("I'm in:") print(current_room) print() while True: direction = input("Where to ? ").upper() if direction == "EXIT": break print() if direction in DIRECTIONS: current_room = current_room.move_to_direction(direction) print(current_room) if current_room.Character: print(player.Talk) print(enemy.Talk) if player.fight(current_room.Character): print("\nWell done you have defeated your enemy!\n") break print(player.Back) player.change_weapon() print()
from room import Room from item import Item from character import Character, Enemy, Hero from rpginfo import RPGInfo hero = Hero("Hero") enemy = Enemy("enemy", "Example enemy") item = Item("Sword", 25) print(hero.health) print(enemy.health) hero.fight(enemy, item.damage) hero.fight(enemy, item.damage) enemy.fight(hero, 5) print(hero.health) print(enemy.health)