Created
June 6, 2022 21:59
-
-
Save krypted/8899a8da2d8a4ea2caac7851fc7f107a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
card_colors=['red','black','blue','green','white'] | |
op_hp = 20 | |
player_hp = 20 | |
while op_hp >0 and player_hp >0: | |
run_or_attack = input('Do you want to run (run) or use a magic card (use)?') | |
if run_or_attack == 'run': | |
random_run = random.random() | |
if random_run > .3: | |
print ('You run away from the battle.') | |
break | |
else: | |
print('The other Magic player did not let you run away.') | |
print('The other player attacks') | |
op_damage=random.randint(3,6) | |
player_hp=player_hp-op_damage | |
print('You have '+ str(player_hp)+' hit points left.') | |
elif run_or_attack: | |
print('You play a ',random.choice(card_colors), ' with a 50 percent chance to hit.') | |
random_attack = random.randint(1,20) | |
if random_attack > 5: | |
print('Your attack was successful') | |
op_hp=op_hp - random.randint(5,10) | |
else: | |
print('Your attack missed') | |
print('The op attacks you') | |
op_damage=random.randint(5,12) | |
player_hp=player_hp-op_damage | |
print('You have '+ str(player_hp)+' hit points left.') | |
if op_hp > 0: | |
print('The other player now has '+str(op_hp)+' hit points') | |
else: | |
print('The other player has been defeated') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment