FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
PythonCoding/Video Game Battle.py at master · nativecs/PythonCoding · GitHub
nativecs
/
PythonCoding
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
PythonCoding
/
Video Game Battle.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
97 lines (80 loc) · 2.05 KB
Breadcrumbs
PythonCoding
/
Video Game Battle.py
Copy path
File metadata and controls
97 lines (80 loc) · 2.05 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
95
96
97
import
random
,
os
,
time
def
rollDice
(
side
):
result
=
random
.
randint
(
1
,
side
)
return
result
def
health
():
healthStat
=
((
rollDice
(
6
)
*
rollDice
(
12
))
/
2
)
+
10
return
healthStat
def
strength
():
strengthStat
=
((
rollDice
(
6
)
*
rollDice
(
8
))
/
2
)
+
12
return
strengthStat
print
(
"⚔️ BATTLE TIME ⚔️"
)
print
()
c1Name
=
input
(
"Name your Legend:
\n
"
)
c1Type
=
input
(
"Character Type (Human, Elf, Wizard, Orc):
\n
"
)
print
()
print
(
c1Name
)
c1Health
=
health
()
c1Strength
=
strength
()
print
(
"HEALTH:"
,
c1Health
)
print
(
"STRENGTH:"
,
c1Strength
)
print
()
print
(
"Who are they battling?"
)
print
()
c2Name
=
input
(
"Name your Legend:
\n
"
)
c2Type
=
input
(
"Character Type (Human, Elf, Wizard, Orc):
\n
"
)
print
()
print
(
c2Name
)
c2Health
=
health
()
c2Strength
=
strength
()
print
(
"HEALTH:"
,
c2Health
)
print
(
"STRENGTH:"
,
c2Strength
)
print
()
round
=
1
winner
=
None
while
True
:
time
.
sleep
(
1
)
os
.
system
(
"clear"
)
print
(
"⚔️ BATTLE TIME ⚔️"
)
print
()
print
(
"The battle begins!"
)
c1Dice
=
rollDice
(
6
)
c2Dice
=
rollDice
(
6
)
difference
=
abs
(
c1Strength
-
c2Strength
)
+
1
if
c1Dice
>
c2Dice
:
c2Health
-=
difference
if
round
==
1
:
print
(
c1Name
,
"wins the first blow"
)
else
:
print
(
c1Name
,
"wins round"
,
round
)
elif
c2Dice
>
c1Dice
:
c1Health
-=
difference
if
round
==
1
:
print
(
c2Name
,
"wins the first blow"
)
else
:
print
(
c2Name
,
"wins round"
,
round
)
else
:
print
(
"Their swords clash and they draw round"
,
round
)
print
()
print
(
c1Name
)
print
(
"HEALTH:"
,
c1Health
)
print
()
print
(
c2Name
)
print
(
"HEALTH:"
,
c2Health
)
print
()
if
c1Health
<=
0
:
print
(
c1Name
,
"has died!"
)
winner
=
c2Name
break
elif
c2Health
<=
0
:
print
(
c2Name
,
"has died!"
)
winner
=
c1Name
break
else
:
print
(
"And they're both standing for the next round"
)
round
+=
1
time
.
sleep
(
1
)
os
.
system
(
"clear"
)
print
(
"⚔️ BATTLE TIME ⚔️"
)
print
()
print
(
winner
,
"has won in"
,
round
,
"rounds"
)
Back
|
FazBrowse Home
|
New Git URL