Skip to content

Commit

Permalink
Merge pull request #48 from AnneMiriam/test12
Browse files Browse the repository at this point in the history
cleaned it up
  • Loading branch information
AnneMiriam authored Jan 5, 2024
2 parents 496cecc + 9e6bbde commit da3c75b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 42 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# EscapeTheGrimReapersTower

# Escape The Grim Reaper's Tower
-----
## Introduction

Welcome to The Grim Reaper's Tower. You have suddenly found yourself trapped inside it on the top floor. It is your goal to escape the tower. To do so you must make your way to the ground level where there is an entryway with a door, or you can jump out a window to the ground at your own risk. Before you can exit the front door, however, you must find the key that unlocks the entryway. There are other items that you can find along the way, that will help you, such as bread that can heal you.
Expand Down
26 changes: 2 additions & 24 deletions lib/models/enemy.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,29 +32,7 @@ def name(self, name):
raise ValueError("Name must be a string.")


# @property
# def hp(self):
# return self._hp

# @hp.setter
# def hp(self, hp):
# if isinstance(hp, int):

# self._hp = hp
# else:
# raise ValueError("HP must be an integer.")

# @property
# def damage(self):
# return self._damage

# @damage.setter
# def damage(self, damage):
# if isinstance(damage, int) and damage > 0:
# self._damage = damage
# else:
# raise ValueError("Damage must be a positive integer.")


@classmethod
def create_table(cls):
sql = """ CREATE TABLE IF NOT EXISTS enemies (
Expand Down Expand Up @@ -156,7 +134,7 @@ def __init__(self):

class Poltergeist(Enemy):
def __init__(self):
self.name = "Ghost"
self.name = "Evil Spirit"
self.hp = 10
self.damage = random.randint(5, 10)
self.alive_text = "You pissed off a Poltergeist!"
Expand Down
19 changes: 4 additions & 15 deletions lib/models/game.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import random
from models.items import *
from models.enemy import Enemy
from data.default_enemies import default_enemies
# from data.default_enemies import default_enemies
from models.items import *
from models.NonPlayChar import *
from models.rooms import *
Expand Down Expand Up @@ -118,15 +118,6 @@ def create_enemy(self):

# Battle Code

# def get_random_enemy_id(self):
# CURSOR.execute("SELECT id FROM enemies ORDER BY RANDOM() LIMIT 1;")
# result = CURSOR.fetchone()

# if result:
# return result[0]
# else:
# return None

def random_encounter(self):
# random_enemy_id = self.get_random_enemy_id()
enemy_types = [
Expand All @@ -137,7 +128,6 @@ def random_encounter(self):
# Enemy.find_by_id(-1),
]
random_enemy_type = random.choice(enemy_types)
# random_enemy_type = EnemyAndFriends(enemy_types)
random_enemy = random_enemy_type()
self.current_enemy = random_enemy

Expand All @@ -146,7 +136,6 @@ def battle(self):
print("Must be alive to battle")
return

# print(f"A {self.current_enemy} appeared!")

while self.player.hp > 0 and self.current_enemy.hp >= 0:
print(f"{self.player.name}'s HP: {self.player.hp}")
Expand Down Expand Up @@ -266,7 +255,7 @@ def go_attic_window(self):
if choice == "2":
print()
output_slow(
"Almost as soon as your feet leave the railing, you know you made a grave mistake. As you fall you reach out, trying to grasp for the railing of the balcony below you, but the rain prevents you from finding purchase. Your eyes go wide with horror as time slows. You hear a low, rumbling laugh like the sound of hundreds of clacking bones as the lights of the tower rooms grow farther away. No longer able to bear the sight of your own iminent death - your failure - you close your eyes and wait for the pain."
"Almost as soon as your feet leave the railing, you know you made a grave mistake. As you fall you reach out, trying to grasp for the railing of the balcony below you, but the rain prevents you from finding purchase. Your eyes go wide with horror as time slows. You hear a low, rumbling laugh like the sound of hundreds of clacking bones as the lights of the tower rooms grow farther away. No longer able to bear the sight of your own imminent death - your failure - you close your eyes and wait for the pain."
)
output_slower("GAME OVER")
exit()
Expand Down Expand Up @@ -437,7 +426,7 @@ def go_third_floor_window(self):
if choice == "2":
print()
output_slow(
"Almost as soon as your feet leave the railing, you know you made a grave mistake. As you fall you reach out, trying to grasp for the railing of the balcony below you, but the rain prevents you from finding purchase. Your eyes go wide with horror as time slows. You hear a low, rumbling laugh like the sound of hundreds of clacking bones as the lights of the tower rooms grow farther away. No longer able to bear the sight of your own iminent death - your failure - you close your eyes and wait for the pain."
"Almost as soon as your feet leave the railing, you know you made a grave mistake. As you fall you reach out, trying to grasp for the railing of the balcony below you, but the rain prevents you from finding purchase. Your eyes go wide with horror as time slows. You hear a low, rumbling laugh like the sound of hundreds of clacking bones as the lights of the tower rooms grow farther away. No longer able to bear the sight of your own imminent death - your failure - you close your eyes and wait for the pain."
)
output_slower("GAME OVER")
exit()
Expand Down Expand Up @@ -471,7 +460,7 @@ def go_first_floor_window(self):
output_slow(room.intro_text())
print()
print(
"1. Go back to the relative safety of the room \n2. Take your chances and leap"
"1. Go back to the room, it not so bad here. \n2. Take your chances and leap"
)
choice = input("Where will you go? >> ")
if choice == "1":
Expand Down
2 changes: 1 addition & 1 deletion lib/models/rooms.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import random

from models.enemy import Enemy, BlackCat, BlackWidow, Poltergeist, GrimReaper

# from data.default_enemies import default_enemies
Expand Down

0 comments on commit da3c75b

Please sign in to comment.