def action(self): # If PC has rolled the highest derived from Initiative they will have a number the options # At the moment the options are limited : gap() print("What action do you take") tuple = Sentence_Handler().scanner(Talihu_dict.Yalids_inn.actions, "action") # Get sutiable Response # Fight : Start a fight if "fight" in tuple: self.fight = True # defuse: Attempt to descalate the situation - Will have to perform a skill check elif "defuse" in tuple: Checks().skill_check(('Persuasion', 'Hard', self.defuse, 'D20'))
def encounter(self): start = Checks().initiative_check( self.NPC_Name) # fight order determined if start == "PC": self.action() # PC chooses to fight or defuse the situation if self.fight == True: # fighting starts # Loop will run unitl a character's Hit Point is <= 0. while (PC["Stats"]["CHP"]["Current"] < PC["Stats"]["CHP"]["Max"] ) and (NPC[self.NPC_Name]["Hit Points"]["Current"] < NPC[self.NPC_Name]["Hit Points"]["Max"]): if start == "PC": # PC will start the attack self.PC_battle() # PC's turn to attack if NPC[self.NPC_Name]["Hit Points"]["Current"] >= NPC[ self.NPC_Name]["Hit Points"][ "Max"]: # Checks if while loop condition is met for NPC break self.NPC_battle() # NPC's turn to attack elif start == "NPC": # NPC will start the attack self.NPC_battle() if PC["Stats"]["CHP"]["Current"] >= PC["Stats"]["CHP"][ "Max"]: # Checks if will loop contion is met for PC break self.PC_battle() prompt() # Depending on who won the battle and how a differnt action will be called. if (PC["Stats"]["CHP"]["Current"] == PC["Stats"]["CHP"]["Max"]): print("You've fallen unconsious") outcome = Checks.death_saving_throw() elif (PC["Stats"]["CHP"]["Current"] > PC["Stats"]["CHP"]["Max"]): print("You've been killed") outcome = "PC Dead" elif (NPC[self.NPC_Name]["Hit Points"]["Current"] == NPC[ self.NPC_Name]["Hit Points"]["Max"]): print("You've knocked {} unconsious".format(self.NPC_Name)) outcome = "NPC Unconsious" elif (NPC[self.NPC_Name]["Hit Points"]["Current"] > NPC[self.NPC_Name]["Hit Points"]["Max"]): print("You've killed {}".format(self.NPC_Name)) outcome = "NPC Dead" return outcome elif self.fight == False: # Fight was not intiated as 'action' resulted in a postive response. outcome = "Fight Disfused" return outcome