Skip to content

Commit

Permalink
PEP8-ifyed the project
Browse files Browse the repository at this point in the history
  • Loading branch information
crawsome committed Nov 26, 2017
1 parent c3e1b67 commit c72fa70
Show file tree
Hide file tree
Showing 6 changed files with 384 additions and 168 deletions.
504 changes: 355 additions & 149 deletions .idea/workspace.xml

Large diffs are not rendered by default.

25 changes: 13 additions & 12 deletions Game.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def __init__(self):
self.autoattack = 0

# Create all game databases (only needs to run once to make databases)

self.ourhero = 0
self.ourenemy = 0

Expand Down Expand Up @@ -374,9 +374,10 @@ def blacksmith(self):
str(self.ourhero.ourshield.dur) + '/' + str(self.ourhero.ourshield.maxdur),
str(self.ourhero.ourshield.isbroken())]
data4 = [str(3), str(self.ourhero.ourarmor.name) + ' ' + str(self.ourhero.ourarmor.type),
str(self.ourhero.ourarmor.dur) + '/' + str(self.ourhero.ourarmor.maxdur), str(self.ourhero.ourarmor.isbroken())]
alldata = [data1,data2,data3,data4]
fourrowprint(alldata,"Blacksmith")
str(self.ourhero.ourarmor.dur) + '/' + str(self.ourhero.ourarmor.maxdur),
str(self.ourhero.ourarmor.isbroken())]
alldata = [data1, data2, data3, data4]
fourrowprint(alldata, "Blacksmith")

decision = input('What do you want to repair? [a] for all')
if decision == '1' or decision == 'a':
Expand Down Expand Up @@ -417,15 +418,16 @@ def blacksmith(self):
marqueeprint('[YOUR GEAR]')
leftprint(
str(1) + ' \tName: ' + str(self.ourhero.ourweapon.name) + ' ' + str(
self.ourhero.ourweapon.type) + '\tAttack: ' + str(
self.ourhero.ourweapon.atk) + '\tCost: ' + str(self.ourhero.ourweapon.level * 50 * self.ourhero.defcurve))
leftprint(str(2) + ' \tName: ' + str(self.ourhero.ourshield.name) + ' ' + str(
self.ourhero.ourshield.type) + '\tDefense: ' + str(self.ourhero.ourshield.defn) + '\tCost: ' + str(
self.ourhero.ourshield.level * 50 * self.ourhero.defcurve))
self.ourhero.ourweapon.type) + '\tAttack: ' + str(self.ourhero.ourweapon.atk) + '\tCost: ' + str(
self.ourhero.ourweapon.level * 50 * self.ourhero.defcurve))
leftprint(
str(2) + ' \tName: ' + str(self.ourhero.ourshield.name) + ' ' + str(
self.ourhero.ourshield.type) + '\tDefense: ' + str(self.ourhero.ourshield.defn) + '\tCost: ' + str(
self.ourhero.ourshield.level * 50 * self.ourhero.defcurve))
leftprint(
str(3) + ' \tName: ' + str(self.ourhero.ourarmor.name) + ' ' + str(
self.ourhero.ourarmor.type) + '\tDefense: ' + str(
self.ourhero.ourarmor.defn) + '\tCost: ' + str(self.ourhero.ourarmor.level * 50 * self.ourhero.defcurve))
self.ourhero.ourarmor.type) + '\tDefense: ' + str(self.ourhero.ourarmor.defn) + '\tCost: ' + str(
self.ourhero.ourarmor.level * 50 * self.ourhero.defcurve))
print('\n')
# determine weapon coses
wepcost = weaponforsale.level * 50 * self.ourhero.defcurve
Expand Down Expand Up @@ -678,7 +680,6 @@ def weaponrepairtincture(self):
self.ourhero.ourweapon.dur = self.ourhero.ourweapon.maxdur
self.ourhero.activeitem = 0


# adds a little suspense to offset the monotony of text input
def suspense(self):
s = ' '
Expand Down
4 changes: 3 additions & 1 deletion Hero.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import random

import Armor
import Game
import Item
Expand Down Expand Up @@ -258,7 +259,8 @@ def levelup(self):
# fetches a new weapon for hero
def newweapon(self):
newdb = dbsetup.dbsetup()
newdb.conn.execute('SELECT * FROM weapons WHERE "level" = ? AND "class" = ? ;',(str(self.level), str(self.ourclass),))
newdb.conn.execute('SELECT * FROM weapons WHERE "level" = ? AND "class" = ? ;',
(str(self.level), str(self.ourclass),))
rows = newdb.conn.fetchall()
newdb.conn.close()
new_weapon_data = rows[0]
Expand Down
14 changes: 9 additions & 5 deletions Story.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
# makes a story progression with 20 or so variable checkpoints
# each checkpoint requires decisions and talking?
# A narrative would have to be made
import Game
import textwrap

import Game


class TheStory:
def __init__(self):
Chapter1 = Chapter(1, 'Haunted House', 'd', 'o', 'e')
pass


class Chapter:
def __init__(self,chapnum,chapname,answer1,answer2,answer3,story1,story2,story3):
def __init__(self, chapnum, chapname, answer1, answer2, answer3, story1, story2, story3):
self.chapternum = chapnum
self.chaptername = chapname
self.ans1 = answer1
Expand All @@ -21,15 +24,15 @@ def __init__(self,chapnum,chapname,answer1,answer2,answer3,story1,story2,story3)
self.story3 = story3
self.done = False
pass

def story1(self):
wrapstring = textwrap.wrap(self.story1, width=48)
for line in wrapstring:
Game.centerprint(line)

def story2(self):
pass

def story3(self):
pass

Expand All @@ -39,6 +42,7 @@ def story3(self):
def hauntedhouse():
pass


def swamp():
pass

Expand Down
1 change: 1 addition & 0 deletions __init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Game

if __name__ == '__main__':
ourgame = Game.Game()
ourgame.gameloop()
4 changes: 3 additions & 1 deletion dbsetup.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import csv
from sqlite3 import connect
import os
from sqlite3 import connect

import Game


class dbsetup():
def __init__(self):
self.dbpath = './db/game.db'
Expand Down

0 comments on commit c72fa70

Please sign in to comment.