weapon_damage = 10 armor_protection = 0 maxhealth = 100 health = maxhealth dogde_boost = 1 walletc = 0 wallets = 0 walletg = 0 hit_bonus = 1 credit = 0 fight = 1 house = 0 sleep_house = 0 tavern = 0 shop = 0 boost_attack = 1 boost_dodge = 1 boost_hit = 1 credits = 'Game designer - Hugo\n Game coder - Hugo\n Betatester - Devon\n Creative developer - Arthur' first = 1 import random while fight == 1: if first == 1: enemy = 1 enemy_name = 'slime' enemy_damage = 10 enemy_health = 50 first = 0 else: enemy = random. randint(1, 30) if enemy <=15: enemy_name = 'troll' enemy_health = 100 enemy_damage = 40 elif enemy <= 23: enemy_name = 'witch' enemy_health = 150 enemy_damage = 40 elif enemy <= 27: enemy_name = 'golem' enemy_health = 400 enemy_damage = 50 elif enemy <= 29: enemy_name = 'minotaur' enemy_health = 500 enemy_damage = 60 elif enemy == 30: enemy_name = 'dragon' enemy_health = 750 enemy_damage = 70 print('You have encounterned a', enemy_name, '!') print('') print('The', enemy_name, 'attacks you!') print('') while health > 0 and enemy_health > 0: print('You have', health, 'health left') print('The enemy has', enemy_health, 'health left') print('Type 1 to dodge (You have a', 33*dogde_boost, 'percent chance to dodge)') print('Type 2 to do nothing (You will take 25 percent less damage)') dogde_action = int(input('Choose action: ')) if dogde_action == 1: if random. randint(1, 100) < 33*dogde_boost: print('') print('You dodged the attack!') else: print('') print('You failed to dodge') health = health-(enemy_damage-armor_protection) print('You took', (enemy_damage-armor_protection), 'damage!') elif dogde_action == 2: health = health-(3*(enemy_damage-armor_protection)/4) print('You took', (3*(enemy_damage-armor_protection)/4), 'damage!') print('') if health <= 0: print('You died!') print(credits) exit() print('You have', health, 'health left') print('The enemy has', enemy_health, 'health left') print('Type 1 to stab/shoot the enemy', '(Normal damage', 70*hit_bonus, 'percent chance to hit)') print('Type 2 to slash/shoot in the eye', '(Strong damage,', 50*hit_bonus, 'percent chance to hit)') attack_action = int(input('Choose action: ')) print('') if attack_action == 1: if random. randint(1, 100) < 70*hit_bonus: print('You hit the enemy. You dealt', weapon_damage*attack_action, 'damage') enemy_health = enemy_health - weapon_damage*attack_action else: print('You failed to hit the enemy!') elif attack_action == 2: if random. randint(1, 100) < 50*hit_bonus: print('You hit the enemy. You dealt', weapon_damage*attack_action, 'damage') enemy_health = enemy_health - weapon_damage*attack_action else: print('You failed to hit the enemy!') if health <= 0: print('') print('You died!') print(credits) exit() print('') boost_attack = 1 boost_dodge = 1 boost_hit = 1 print('You killed the enemy!') award_c = random. randint(1, (30*enemy)) award_s = random. randint(1, (2*enemy)) print('After the battle, you went to the town nearby.') print('You sold the head of your enemy and got rewarded with', award_c, 'copper,', award_s, 'silver') walletc = walletc + award_c wallets = wallets + award_s if walletc > 100: walletc = walletc - 100 wallets = wallets + 1 if wallets > 100: wallets = wallets - 100 walletg = walletg + 1 if house == 1: sleep_house = input('Would you like to sleep in your home (You will get fully recovered, free)(enter y if yes): ') if sleep_house == 'y': print('') print('You had a good sleep') health = maxhealth else: tavern = input('Would you like to sleep on the nearby tavern? (You will get fully recovered, costs 50 copper)(Enter y if yes)') if tavern == 'y': if walletc >= 50: print('') print('You had a good sleep') health = maxhealth elif wallets >= 1: wallets = wallets-1 walletc = walletc+50 print('') print('You had a good sleep') health = maxhealth else: print('') print("You don't have enough money!") shop = input('Would you like to wisit the store? (Type y if yes): ') if shop == 'y': print('') print('You entered the shop.') print('') print('Availible items:') print('') print('Weapons:') print('1. Battleaxe (Medium damage, medium hitchance, 3 silver)') print('2. Mace (High damage, low hitchance, 10 silver)') print('3. Bow (Medium damage, high hitchance, 30 silver)') print('4. Long sword (Very high damage, medium hitchance, 5 gold)') print('5. Crossbow (High damage, high hitchance, 10 gold)') print('6. Iron club (Max damage, medium hitchance, 20 gold)') print('7. Celestial sword (Max damage, max hitchance, 100 gold)') print('') print('Armor:') print('8. Leaf armor (Very-low protection, low dodgechance, 2 silver)') print('9. Wooden armor (Medium protection, very-low dogdechance, 5 silver)') print('10. Stone armor (High protection, very-low dodgechance, 30 silver)') print('11. Iron armor (High protection, medium dodgechance, 1 gold)') print('12. Diamond armor (Very-high pretection, medium dodgechance, 30 gold)') print('13. Dragon scale armor (Very-high protection, high dodgechance, 50 gold)') print('14. Celestial armor (Protectiion max, dodgechance max, 100 gold)') print('') print('Extra stuff:') print('15. House (Will give you the oppurtunity to recover for free every day, 50 silver)') print('16. Adrealine potion (You will deal 1.5 times the damage during the next fight, 20 silver)') print('17. Rabbit insticts potion (You will deal 1.5 times the dodgechance during the next fight, 30 silver)') print('18. Eagle eye potion (You will deal 1.5 times the hitchance during the next fight, 40 silver)') print('19. Stone skin potion (You will deal 1.5 times the armor protection during the next fight, 50 silver)') print('20. Celestial potion (You will deal get the effect of all potions above during the next fight, 1 gold)') buy = input('What item would you like to buy? ') if buy == 1: if wallets >= 3: wallets = wallets - 3 weapon_damage = 20 hit_bonus = 1 elif walletg > 1: wallets = wallets + 97 walletg = walletg - 1 weapon_damage = 20 hit_bonus = 1 else: print('You do not have enough money.') if buy == 2: if wallets >= 10: wallets = wallets - 10 weapon_damage = 40 hit_bonus = 0.8 elif walletg > 1: wallets = wallets + 90 walletg = walletg - 1 weapon_damage = 40 hit_bonus = 0.7 else: print('You do not have enough money.') if buy == 3: if wallets >= 30: wallets = wallets - 30 weapon_damage = 15 hit_bonus = 1.5 elif walletg > 1: wallets = wallets + 70 walletg = walletg - 1 weapon_damage = 15 hit_bonus = 1.5 else: print('You do not have enough money.') if buy == 4: if walletg >= 5: walletg = walletg - 5 weapon_damage = 50 hit_bonus = 1 else: print('You do not have enough money.') if buy == 5: if walletg >= 10: walletg = walletg - 10 weapon_damage = 40 hit_bonus = 1.5 else: print('You do not have enough money.') if buy == 6: if walletg >= 20: walletg = walletg - 20 weapon_damage = 80 hit_bonus = 1 else: print('You do not have enough money.') if buy == 7: if walletg >= 100: walletg = walletg - 100 weapon_damage = 100 hit_bonus = 3 else: print('You do not have enough money') if buy == 8: if wallets >= 2: wallets = wallets - 2 armor_protection = 5 dodge_bonus = 1.2 elif walletg > 1: wallets = wallets + 98 walletg = walletg - 1 armor_protection = 5 dodge_bonus = 1.2 else: print('You do not have enough money') if buy == 9: if wallets >= 5: wallets = wallets - 5 armor_protection = 15 dodge_bonus = 1.1 elif walletg > 1: wallets = wallets + 95 walletg = walletg - 1 armor_protection = 15 dodge_bonus = 1.1 else: print('You do not have enough money') if buy == 10: if wallets >= 30: wallets = wallets - 30 armor_protection = 25 dodge_bonus = 1.0 elif walletg > 1: wallets = wallets + 70 walletg = walletg - 1 armor_protection = 25 dodge_bonus = 1.0 else: print('You do not have enough money') if buy == 11: if walletg >= 1: walletg = walletg - 1 armor_protection = 25 dodge_bonus = 1.2 else: print('You do not have enough money') if buy == 12: if walletg >= 30: walletg = walletg - 30 armor_protection = 50 dodge_bonus = 1.2 else: print('You do not have enough money') if buy == 13: if walletg >= 50: walletg = walletg - 50 armor_protection = 50 dodge_bonus = 1.4 else: print('You do not have enough money') if buy == 14: if walletg >= 100: walletg = walletg - 100 armor_protection = 100 dodge_bonus = 3 else: print('You do not have enough money') if buy == 20: if walletg >= 1: walletg = walletg - 1 boost_hit = 1.5 boost_attack = 1.5 boost_dodge = 1.5 else: print('You do not have enough money') print('') print('You got bored in the town and went out to find another monster to defeat.')