-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEnemy.cs
More file actions
51 lines (46 loc) · 1.59 KB
/
Enemy.cs
File metadata and controls
51 lines (46 loc) · 1.59 KB
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
using System;
namespace EternityRPG
{
public class Enemy : Character
{
public int CounterToReachTheBoss { get; protected set; }
public int ChanceToInterruptTheEscape { get; protected set; }
public override void Attack(Player player, Enemy enemy, double damage, bool crit = false)
{
Print.Text($"\t{enemy.Name} ", ConsoleColor.DarkMagenta);
if (!crit)
{
player.HP -= damage;
Print.Text($"{NormalAttackPhrase} deals ");
Print.Text($"{damage} DMG", ConsoleColor.DarkRed);
}
else
{
player.HP -= damage *= random.Next(2, 4);
Print.Text($"{CriticalAttackPhrase} deals ");
Print.Text($"CRITICAL {damage} DMG", ConsoleColor.DarkRed);
}
Print.Text(", ");
Print.Text($"{player.Name} ", ConsoleColor.DarkCyan);
//if player died
if (player.HP <= 0)
{
player.IsDead = true;
Print.Text("died\n");
Print.YouDied();
}
//otherwise continue
else
{
Print.Text("have ");
Print.Text($"{player.HP} HP\n\n", ConsoleColor.DarkGreen);
//if the player has low HP
if (player.HP <= player.DangerousLevelOfHealth())
{
Print.Text($"\tWARNING, you have {player.HP} HP!\n\n", ConsoleColor.DarkRed);
return;
}
}
}
}
}