diff --git a/debug.py b/debug.py index a799198..358d820 100644 --- a/debug.py +++ b/debug.py @@ -37,8 +37,8 @@ def menu(newPlayer): newPlayer.find_potions() if choice == 'g': - #amount = int(raw_input("How much? ")) - newPlayer.find_gold() + amount = int(raw_input("How much? ")) + newPlayer.find_gold_debug(amount) if choice == 'l': newPlayer.list_inventory() diff --git a/player.py b/player.py index abf24e4..4390b43 100644 --- a/player.py +++ b/player.py @@ -35,6 +35,12 @@ def find_gold(self): sleep(2) return self + def find_gold_debug(self,amount): + self.gold += amount + print "\nYou found %d gold coins, which brings you to a total of %d coins!" % (amount, self.gold) + sleep(2) + return self + def find_potions(self): print "\nYou found a health potion!" self.potions += 1 @@ -45,8 +51,10 @@ def find_potions(self): def buy_potions(self): print "Each potion costs 20 gold pieces and restores 10 HP." amount = raw_input("\nHow many would you like to purchase? ") - if self.gold >= (amount*10): - self.gold = self.gold - (amount*10) + cost = int(amount) * 20 + sleep(3) + if self.gold >= int(cost): + self.gold = self.gold - int(cost) print "\n%d potions have been added to your inventory." % int(amount) sleep(2) return self