Skip to content

Commit

Permalink
Merge branch 'testing'
Browse files Browse the repository at this point in the history
fixed bad math in buy_potions()
  • Loading branch information
brando56894 committed Jul 1, 2016
2 parents 4ef6475 + b37aa2f commit 1f392bd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
12 changes: 10 additions & 2 deletions player.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 1f392bd

Please sign in to comment.