def update(self): self.text() self.appendToArray() if self.maxHarvest > 0: inp = input.inputLines( ['Whack the grass', 'Go back down the hill']) if (inp == 1): self.maxHarvest -= globals.player.inventory.scavengeGrass( 2, 4, self.maxHarvest, 5, [ "Harvest grass", "Collect cut grass", "Scavenge for grass" ], [ "Relax", "Sit down", "Do nothing", "Fall asleep", "Daydream", "Contemplate life", "Stop", "Watch a large, red beetle" ]) elif (inp == 2): globals.player.location = RockyBase elif type(inp) == str: return else: inp = input.inputLines(['Come back the way you came']) if (inp == 1): globals.player.location = RockyBase elif type(inp) == str: return
def locationChange(options): # options = [["trek up the mountain", "summit", "yolo, I'm going up the mountain top", False], ["Talk to questgiver", questGiver, "", True]] inp = input.inputLines(options, lambda option: str(option[0])) - 1 if (options[inp][2] != ""): input.printInput(options[inp][2]) if (options[inp][3] == True): options[inp][1].update() else: globals.player.pLocation = globals.player.location globals.player.location = options[inp][1]
def checkIn(self): self.checkAuto if self.visible == True : if (self.conditionEnd(globals.player)) == True and self.completed == False: self.rewarded() globals.player.inventory.quests.remove(self.name) self.completed = True self.complete = 'end' if (self.complete == 'accept'): inp = input.inputLines(["Accept", "Decline"]) if inp == 1: print('<Quest Accepted>') self.complete = 'progress' else: return elif (self.complete == 'progress'): print(self.progress)
def update(self): arr = [] isSame = True if self.showOpenText == False: print(self.openText) self.showOpenText = True print("") print("Quest:") for i in range(len(self.quests)): if self.quests[i].completed == False: for i in range(len(self.quests)): self.quests[i].setVisible() for i in range(len(self.quests)): if self.quests[i].visible == True and self.quests[ i].complete == 'progress': arr.append(f'{self.quests[i].name} (in progress)') if self.isSame == False: globals.player.inventory.quests.append( self.quests[i].name) self.isSame = True elif self.quests[i].visible == True: arr.append(self.quests[i].name) arr.append('Back') inp = input.inputLines(arr) i = 1 while i < len(arr): if (inp == i): self.quests[i - 1].checkIn() self.update() i += 1 if inp == (i + 1): locationBack() print('hello')
def scavengeLogs(self, minimum, maximum, maxHarvest, numDuds, optionScavenge, optionNothing): back = False endNum = 0 inpScavenge = 0 while endNum < maxHarvest and back == False: arr = [] scavenge = False arr1 = copy.copy(optionScavenge) arr2 = copy.copy(optionNothing) while len(arr) != numDuds: if random.randint(1, 3) == 3 and scavenge == False: rand1 = arr1[random.randint(0, len(arr1) - 1)] arr.append(rand1) arr1.remove(rand1) inpScavenge = len(arr) scavenge = True elif len(arr) == numDuds - 1 and scavenge == False: rand1 = arr1[random.randint(0, len(arr1) - 1)] arr.append(rand1) arr1.remove(rand1) inpScavenge = len(arr) else: rand2 = arr2[random.randint(0, len(arr2) - 1)] arr.append(rand2) arr2.remove(rand2) arr.append('Back') inp = input.inputLines(arr) if inp == inpScavenge: i = minimum while i < maximum: if (random.randint(1, 3) == 1): i += 1 else: break endNum += i if endNum > maxHarvest: endNum = maxHarvest print(f"In total, you scavenged {endNum} logs") elif endNum == maxHarvest: print(f"In total, you scavenged {endNum} logs") else: print(f'You scavenged {i} logs.') elif inp == len(arr): if endNum == 1: print(f'In total, you scavenged {endNum} log.') back = True elif endNum == 0: print("You did not scavenge anything") back = True else: print(f'In total, you scavenged {endNum} logs.') back = True break else: print("Due to your relaxation, you did not collect any logs.") self.logs += endNum return endNum
def update(self): self.text() self.appendToArray() while globals.player.location == SteepAscent: randomInt = random.randint(1, 13) if randomInt == 10: self.progress = 'fall' print(self.arr[randomInt]) elif randomInt == 12: self.progress = 'snake' print(self.arr[randomInt]) elif randomInt == 1 or randomInt == 13: self.progress = 'death' print(self.arr[randomInt]) elif randomInt == 9 or randomInt == 7 or randomInt == 2: self.progress = 'reverse' print(self.arr[randomInt]) else: self.progress = 'normal' print(self.arr[randomInt]) if self.progress == 'normal': inp = input.inputLines( ['Admit defeat and turn back', 'Keep on climbing']) if inp == 1: globals.player.location = RockyBase elif inp == 2: self.ticker += 1 elif self.progress == 'fall': inp = input.inputLines(['Steady yourself', 'Fall off']) if inp == 1: self.ticker += 1 elif inp == 2: print( "You fall off. In the moments it takes for you to hit the ground, you regret trusting the old man." ) globals.player.location = Death elif self.progress == 'reverse': inp = input.inputLines(['Keep on climbing', 'Turn back']) if inp == 2: globals.player.location == RockyBase elif inp == 1: self.ticker += 1 elif type(inp) == str: return elif self.progress == 'snake': inp = input.inputLines( ['Hit the snake with the stick', 'Inch around the snake']) if inp == 1: print( "That was a stupid decision. The snake lunges at you, and sinks its fangs into your calf. The poison takes effect almost immediately, and you fall to the ground." ) globals.player.location = Death elif inp == 2: self.ticker += 1 elif self.progress == 'death': inp = input.inputLines( ["Turn back", "Throw yourself off", "Climb some more"]) if inp == 1: globals.player.location = RockyBase elif inp == 2: print("At this point, you don't care that you are dead.") globals.player.location = Death elif inp == 3: self.ticker += 1 if self.ticker >= 30: globals.player.location = GrassyHill