Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
krkane
/
Rüütli Vaev
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
1
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
5eca51c4
authored
Mar 20, 2024
by
krkane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update Baaskood.c
parent
e46b7ba9
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
0 deletions
Source/Baaskood.c
Source/Baaskood.c
View file @
5eca51c4
...
@@ -167,6 +167,7 @@ int bossFight(Player *p, Enemy *boss) {
...
@@ -167,6 +167,7 @@ int bossFight(Player *p, Enemy *boss) {
int
playerAttack
,
bossAttack
;
int
playerAttack
,
bossAttack
;
int
escaped
=
0
;
// Flag variable to track if player escaped
int
escaped
=
0
;
// Flag variable to track if player escaped
int
initialHealth
=
p
->
health
;
// Store initial health
int
initialHealth
=
p
->
health
;
// Store initial health
int
specialAttack
=
0
;
printf
(
"
\n
Te seisate võimsa vaenlase, %s, ees. Tal on %dHP ja tema rünnaku tugevus on %d.
\n
"
,
boss
->
type
,
boss
->
health
,
boss
->
attack
);
printf
(
"
\n
Te seisate võimsa vaenlase, %s, ees. Tal on %dHP ja tema rünnaku tugevus on %d.
\n
"
,
boss
->
type
,
boss
->
health
,
boss
->
attack
);
...
@@ -211,6 +212,43 @@ int bossFight(Player *p, Enemy *boss) {
...
@@ -211,6 +212,43 @@ int bossFight(Player *p, Enemy *boss) {
printf
(
"
\n
Vale valik. Palun valige uuesti.
\n
"
);
printf
(
"
\n
Vale valik. Palun valige uuesti.
\n
"
);
}
}
if
(
bossHp
<
bosshp
/
2
&&
specialAttack
==
0
)
{
printf
(
"
\n
Koopa pealik vihastab. Ta kogub ennast tummise rünnaku jaoks."
"
\n
Sa märkasid rünnakut viimasel sekundil ning sul on kaks valikut.
\n
"
);
int
correctChoice
=
rand
()
%
2
+
1
;
printf
(
"1. %s
\n
"
,
(
correctChoice
==
1
)
?
"Põikle vasakule"
:
"Põikle paremale"
);
printf
(
"2. %s
\n
"
,
(
correctChoice
==
2
)
?
"Põikle vasakule"
:
"Põikle paremale"
);
int
choice
;
scanf
(
"%d"
,
&
choice
);
while
(
choice
!=
1
&&
choice
!=
2
)
{
printf
(
"Kummale poole Põikled"
);
scanf
(
"%d"
,
&
choice
);
}
if
((
choice
==
1
&&
correctChoice
==
1
)
||
(
choice
==
2
&&
correctChoice
==
2
))
{
printf
(
"Pealik napilt riivab oma mõõgaga su kätt ning sa ei saanud viga.
\n
"
"Su valik säästis sulle su elu.
\n
"
"Sa kogud sekundiks hinge ning kaklus jätkub
\\
n"
);
}
else
if
((
choice
==
1
&&
correctChoice
==
2
)
||
(
choice
==
2
&&
correctChoice
==
1
))
{
printf
(
"Pealik lööb kogu oma jõu ja uhkusega sulle rangluu pihta.
\n
"
"Sa karjud suurest valust.
\n
"
);
playerHp
-=
SPECIAL_DAMAGE
;
if
(
playerHp
<=
0
)
{
printf
(
"
\n
Su keha ei pidanud löögile vastu ning jooksid nii energiast kui ka verest tühjaks."
"
\n
Kahjuks, sa kaotasid.
\n
"
);
return
0
;
// Mängija kaotas
}
specialAttack
=
1
;
}
if
(
playerHp
<=
0
)
{
if
(
playerHp
<=
0
)
{
printf
(
"
\n
Kahjuks, sa kaotasid.
\n
"
);
printf
(
"
\n
Kahjuks, sa kaotasid.
\n
"
);
return
0
;
// Mängija kaotas
return
0
;
// Mängija kaotas
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment