Beispiel #1
0
 def __init__(self, name):  #self, "name"
     name = name.title()
     self.Info = {"Name": name}
     file = Files()
     self.path = file.doc_path
     file.__delete__()
     source = xlrd.open_workbook(self.path)
     Sheet = source.sheet_by_index(6)
     row = 0
     while Sheet.cell(row, 0).value != self.Info["Name"]:
         row += 1
         if str(Sheet.cell(row, 0).value) == self.Info["Name"]:
             #--------------------------------------------------------------
             #                          Set Values
             #--------------------------------------------------------------
             #Set 'Key Item' status
             self.Info["Key"] = Sheet.cell(row, 1).value
             #Set Consumable status
             self.Info["Consumable"] = Sheet.cell(row, 2).value
             #Set Value
             if Sheet.cell(row, 3).value:
                 self.Info["Value"] = Sheet.cell(row, 3).value
             #Set Affected Stats
             if Sheet.cell(row, 4).value:
                 if ', ' in Sheet.cell(row, 4).value:
                     stats = Sheet.cell(row, 4).value
                     self.Info["Restores"] = stats.split(', ')
                 else:
                     self.Info["Restores"] = Sheet.cell(row, 4).value
             #Set Ingredient Status
             self.Info["Ingredient"] = Sheet.cell(row, 5).value
Beispiel #2
0
    def __init__(self, Player, Scene, Game_State): #self, Class
        self.stumbles = 0
        self.attack_spells = [Player.Fire["Name"], Player.Ice["Name"], Player.Lightning["Name"], Player.Water["Name"], Player.Wind["Name"], Player.Drain["Name"]]
        self.duration_spells = [Player.Curse["Name"], Player.Sand["Name"], Player.Regen["Name"], Player.Protect["Name"], Player.Shell["Name"]]
        self.items = Player.Inventory
        self.yes = ["Yes", "Yup", "Yeah", "Ye", "Correct", "Y", "Sure", "Always", "Ok", "Fine"]
        self.no = ["No", "Nope", "Nah", "Negative", "Incorrect", "N", "Never", "Pass"]
        self.attack = ["Attack", "Hit", "Damage", "Kill", "Hurt", "Smack", "Slap", "Strike", "Whack", "Bludgeon", "Fight"]
        self.exit = ["Back", "Exit", "Return", "Cancel", "Leave"]
        self.up = ["Up", "Ascend"]
        self.down = ["Down", "Descend"]
        self.resume = ["Continue", "Resume"]
        self.recipes = ["Recipe", "Recipes", "Instructions"]
        self.inventory = ["Items", "Inventory", "Potions", "Ethers", "Elixirs"]
        self.examine = ["Examine", "Inspect", "Observe", "Look", "Check"]
        self.spellbook = ["Magic", "Spells", "Spell", "Spellbook"]
        self.help = ["Help", "Commands", "Terms", "Glossary", "Words"]
        self.status = ["Status", "Stats", "Self", "Scan"]
        self.save = ["Save"]
        self.Cheat = "Pumpkin Eater"
        self.bools = {"Yes": False, "No": False, "Attack": False, "Exit": False, "Up": False, "Down": False,  
                      "Resume": False, "Inventory": False, "Examine": False, "Spellbook": False, "Help": False, 
                      "Status": False, "Recipes": False}

        file = Files()
        self.path = file.doc_path
        file.__delete__()
        self.Scene = Scene
        self.Game_State = Game_State
Beispiel #3
0
 def main_menu(self, Player, Controller, Scene):
     Scene.clear_screen()
     self.menu = True
     Scene.screen.addstr(
         Scene.line, 1,
         "-----------------------------------------------------------------------------------------------------------------------"
     )
     Scene.line += 1
     Scene.screen.addstr(
         Scene.line, 1,
         "                                                  Spell Caster",
         Scene.cyan)
     Scene.screen.addstr(Scene.line, 110, "Ver: ")
     Scene.screen.addstr("2.01", Scene.cyan)
     Scene.line += 1
     Scene.screen.addstr(
         Scene.line, 1,
         "-----------------------------------------------------------------------------------------------------------------------"
     )
     Scene.line += 1
     #Type your selection
     Scene.screen.addstr(
         Scene.line, 1, Scene.print_header(Scene.make_line(92, "Menu", {})))
     Scene.line += 3
     selection = [
         "About", "New Game", "Continue", "Options", "Cheats", "Credits",
         "Quit"
     ]
     file = Files()
     for x in range(len(selection)):
         if selection[x] != "Continue" and selection[x] != "Options":
             Scene.screen.addstr(Scene.line, 1, "* ", Scene.yellow)
             Scene.screen.addstr(selection[x])
             Scene.line += 1
         else:
             if file.Continue() == True:
                 Scene.screen.addstr(Scene.line, 1, "* ", Scene.yellow)
                 Scene.screen.addstr(selection[x])
                 Scene.line += 1
             else:
                 continue
     self.loop = True
     while self.loop == True:
         Controller.line = Scene.line
         Controller.get_command(Player, file, self, Scene)
     file.__delete__()
Beispiel #4
0
 def translate_room_command(self, response, Player, Room, Game_State, Scene): #self, "response", Class, Class, Class, Class
     response = response.title()
     #---------------------------------------------------------------------
     #                            Room Command
     #---------------------------------------------------------------------
     if response in Room.Commands:
         #Room Commands must only have these vars passed
         Room.Commands[response](Scene, self, Game_State)
     #---------------------------------------------------------------------
     #                            Change Floors
     #---------------------------------------------------------------------
     elif self.bools["Up"] == True and type(Room) is not Dungeon:
         if Room.Solved == True:
             Game_State.change_floors(Player, Scene, self, 1)
         else:
             Scene.screen.addstr(Scene.line, 1, Scene.make_line(107, "Story", {}))
             Scene.line += 1
     elif self.bools["Up"] == True and type(Room) is Dungeon:
         Game_State.change_floors(Player, Scene, self, 1)
     elif self.bools["Down"] == True and type(Room) is Dungeon:
         if Room.Solved == True:
             Game_State.change_floors(Player, Scene, self, -1)
         else:
             Scene.screen.addstr(Scene.line, 1, Scene.make_line(107, "Story", {}))
             Scene.line += 1
     elif self.bools["Down"] == True and type(Room) is not Dungeon:
         Game_State.change_floors(Player, Scene, self, -1)
     #---------------------------------------------------------------------
     #                               Study
     #---------------------------------------------------------------------
     elif response == "Study":
         Player.study_magic(Scene, self, Game_State)
     #---------------------------------------------------------------------
     #                             Spellbook
     #---------------------------------------------------------------------
     elif self.bools["Spellbook"] == True:
         Player.study_magic(Scene, self, Game_State)
     #---------------------------------------------------------------------
     #                               Items
     #---------------------------------------------------------------------
     elif response in self.items:
         item = Item(response)
         item.use_consumable_item(Player, Scene, Game_State)
         item.__delete__()
     elif response in self.inventory:
         Player.get_inventory(Scene)
     elif self.bools["Recipes"] == True:
         Player.view_recipes(self, Scene)
     #---------------------------------------------------------------------
     #                               Cure
     #---------------------------------------------------------------------
     elif response == Player.Cure["Name"]: #Cure Spell
         if Player.known_spell(response) == True:
             placeholder = Actor(1, "")
             Player.cast_Spell(Player.Cure["Name"], placeholder, Game_State, Scene)
             placeholder.__delete__()
         else:
             #You don't know that spell yet!
             Scene.screen.addstr(Scene.line, 1, Scene.make_line(6, "Menu", {}))
             Scene.line += 1
     #---------------------------------------------------------------------
     #                               Status
     #---------------------------------------------------------------------
     elif self.bools["Status"] == True:
         Scene.screen.addstr(Player.Scan(Scene))
     #---------------------------------------------------------------------
     #                   Continue Walking Through Dungeon
     #---------------------------------------------------------------------
     elif self.bools["Attack"] == True or self.bools["Resume"] == True and type(Room) is Dungeon:
         #Take next step in dungeon
         if Room.Steps_Taken < Room.Steps:
             Room.action = False
         else:
             #Continue Fighting
             Room.start_battle(Player, Scene, self, Game_State)
     #---------------------------------------------------------------------
     #                               Save
     #---------------------------------------------------------------------
     elif response in self.save:
         save = Files()
         save.save(Player, Game_State, Scene)
         save.__delete__()
     #---------------------------------------------------------------------
     #                               Debug
     #---------------------------------------------------------------------
     elif response == "Pockets" and Game_State.Debug == True:
         self.fill_inventory(Player)
         Scene.screen.addstr(" * Debug: Inventory Filled")
     elif response == "Solve" and Game_State.Debug == True:
         self.solve(Room)
         Scene.screen.addstr(" * Debug: Room Solved")
     elif response == "No MP" and Game_State.Debug == True:
         self.depletemp(Player)
         Scene.screen.addstr(" * Debug: MP Depleted")
     elif response == "No HP" and Game_State.Debug == True:
         self.depletehp(Player)
         Scene.screen.addstr(" * Debug: HP Depleted")
     elif response == "Level" and Game_State.Debug == True:
         self.levelup(Player, Scene)
     elif response == "Ten" and Game_State.Debug == True:
         counter = 0
         while counter < 10:
             self.levelup(Player, Scene)
             counter += 1
     elif response == "Textbook" and Game_State.Debug == True:
         Player.Upgrades["Value"] += 10
         Scene.screen.addstr(" * Debug: Upgrades available")
     elif response == "Know It All" and Game_State.Debug == True:
         self.learn_all_spells(Player)
         Scene.screen.addstr(" * Debug: Spells Learned")
     elif response == "Interactables" and Game_State.Debug == True:
         for a in range(len(Room.Interactables)):
             Scene.screen.addstr(str(Room.Interactables[a].Name))
             for b in range(len(Room.Interactables[a].Keys)):
                 Scene.screen.addstr(Room.Interactables[a].Keys)
     elif response == self.Cheat:
         if Game_State.Debug == True:
             Game_State.Debug = False
             Scene.screen.addstr(" * Debug disabled")
         else:
             Game_State.Debug = True
             Scene.screen.addstr(" * Debug enabled")
     #---------------------------------------------------------------------
     #                                Misc
     #---------------------------------------------------------------------
     elif self.bools["Help"] == True:
         self.get_help(Game_State)
     elif response == "Quit":
         Game_State.quit(Player, self, Scene)