-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprompt_3.py
94 lines (79 loc) · 2.51 KB
/
prompt_3.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import random
import os
from time import sleep
print("##########################################################""\n")
print("KNIGHTS vs. GOBLINS")
print("Created by Kurtiss Frost with the assistance of ChatGPT")
print("https://chat.openai.com/chat""\n")
print("##########################################################")
sleep (5)
os.system('cls')
print("Narrator: WELCOME to the Kingdom of Larion brave Knight!")
sleep (4)
os.system('cls')
print("Narrator: I hope your sword serves you well on your adventure.")
sleep (4)
os.system('cls')
print("Narrator: There have been signs of Goblin activity reported in the forrest.")
sleep (4)
os.system('cls')
print("Narrator: His excellency, the King, has requested that you head there immediately to stop the Goblin menace!")
sleep (4)
os.system('cls')
print("Narrator: You should set out at once!")
sleep (4)
os.system('cls')
print("After hours of riding, you finally approach the forest. You dismount from your horse and head into the forest.")
sleep (4)
os.system('cls')
print("As soon as you step inside, YOU ARE ATTACKED!")
sleep (4)
os.system('cls')
# Initialize player and goblin stats
player_hp = 10
player_atk = 3
goblin_hp = 6
goblin_atk = 2
# Start the combat loop
while player_hp > 0 and goblin_hp > 0:
# Display current health
print(f"Your health: {player_hp}")
print(f"Goblin's health: {goblin_hp}")
# Player's turn
print("What do you want to do?")
print("1. Attack")
print("2. Defend")
print("3. Run")
choice = int(input())
if choice == 1:
# Attack the goblin
print("You attack the goblin!")
goblin_hp -= player_atk
elif choice == 2:
# Defend and reduce damage taken by 25%
print("You defend and reduce the damage taken by 25%.")
player_atk = player_atk * 0.75
elif choice == 3:
# Try to run away
print("You try to run away...")
if random.randint(1, 2) == 1:
# Success! End the combat
print("You successfully run away!")
break
else:
# Failure! Stay in combat
print("You failed to run away!")
# Goblin's turn
print("The goblin attacks you!")
action = random.randint(1, 2)
if action == 1:
# Attack the player
player_hp -= goblin_atk
elif action == 2:
# Defend and reduce damage taken by 25%
goblin_atk = goblin_atk * 0.75
# Print the outcome of the combat
if player_hp > 0:
print("You have defeated the goblin!")
else:
print("You have been defeated by the goblin.")