This is a basic loot table for a python game.
- Common if the drop rolls on any number till and including 13
- Uncommon if the drop rolls 14 through to, and on 18
- Rare if the drop rolls on 19 or 20
The program ignores the rare drop table even when the conditions are met and instead takes an item from the uncommon drop table e.g drop = 20 1000 gold coins
Can someone explain the problem here?
import random
player_won = True
def common():
common_drop= ['Dragon Bones','Dragon Hide','Dragon Teath','Steel Scimitar','Iron Arrows','Bronze Kitesheild']
print(random.choice(common_drop))
def uncommon():
uncommon_drop= ['Rune Platebody','1000 Gold Coins','Dragonstone','Rune longsword','Mithril Javelin','Rune Med Helm']
print(random.choice(uncommon_drop))
def rare():
rare_drop= ['Dragon Head','Gold Trimmed Rune Full Helm','Crystal Halberd','Diamond (uncut)']
print(random.choice(rare_drop))
while player_won == True:
drop = random.randint(1,20)
print(drop)
if drop <= 13:
common()
elif drop > 13 <= 18:
uncommon()
elif drop == 19 or 20:
rare()
break