Skip to content

Commit 0d5dfd6

Browse files
committed
Added comments to clarify win condition methods and turn method + changed their placement to better fit with the rest of the code
1 parent ba7526d commit 0d5dfd6

File tree

1 file changed

+27
-22
lines changed

1 file changed

+27
-22
lines changed

Game.cs

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -209,27 +209,8 @@ private static void Match()
209209

210210
}
211211

212-
//Method to decide a winner if the match goes past a certain round limit
213-
private static string OvertimeWinner()
214-
{
215-
216-
if(Player1.ActiveHp > Player2.ActiveHp)
217-
{
218-
219-
return $"\n === {Player1.PlayerName} WINS! === \n";
220-
221-
}
222-
if (Player2.ActiveHp > Player1.ActiveHp)
223-
{
224-
225-
return $"\n === {Player2.PlayerName} WINS! === \n";
226-
227-
}
228-
229-
return "\n === DRAW! === \n";
230-
}
231-
232-
//Turn method
212+
//Method that dictates what happens during a player's turn
213+
//returns true if a winner has been decided during the current turn, false if not
233214
private static bool Turn(Player CurrentPlayer, Player Opponent)
234215
{
235216

@@ -272,6 +253,29 @@ private static bool Turn(Player CurrentPlayer, Player Opponent)
272253

273254
}
274255

256+
//Win condition checking methods
257+
258+
//Method to decide a winner if the match goes past a certain round limit
259+
private static string OvertimeWinner()
260+
{
261+
262+
if (Player1.ActiveHp > Player2.ActiveHp)
263+
{
264+
265+
return $"\n === {Player1.PlayerName} WINS! === \n";
266+
267+
}
268+
if (Player2.ActiveHp > Player1.ActiveHp)
269+
{
270+
271+
return $"\n === {Player2.PlayerName} WINS! === \n";
272+
273+
}
274+
275+
return "\n === DRAW! === \n";
276+
}
277+
278+
//Method to decide a winner if either player has <1 hp
275279
private static bool CheckWinCons()
276280
{
277281

@@ -313,6 +317,7 @@ ETC. AND ADD THEM TO PROFILE STATS
313317

314318
}
315319

320+
//Method that displays a player's current hand and plays their card of choice if so chosen
316321
private static void PlayCards(Player CurrentPlayer, Player Opponent)
317322
{
318323

@@ -376,7 +381,7 @@ private static void PlayCards(Player CurrentPlayer, Player Opponent)
376381

377382
}
378383

379-
//Method to get a player's choice from their hand
384+
//Get a player's choice of card from their hand
380385
private static int GetChoice(Player CurrentPlayer)
381386
{
382387

0 commit comments

Comments
 (0)