/
Knight.cs
59 lines (44 loc) · 1.68 KB
/
Knight.cs
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace game
{
class Knight : Player
{
public int AtacSword { get; set; }
public int AtacMagic { get; set; }
public int AtacArbalets { get; set; }
public void GetAtac( Dragon dragon)
{
Random rand = new Random();
while (dragon.Life >= 0 && Life >= 0)
{
AtacArbalets = rand.Next(5, 10);
AtacSword = rand.Next(10, 15);
AtacMagic = rand.Next(10, 20);
dragon.Atac = rand.Next(5, 20);
if (rand.Next(1, 100) > 50)
{
Console.WriteLine("Atac knight!");
Console.WriteLine("Take weapon: 1 - Arbalets, 2 - Sword, 3 - Magic");
string answer = Console.ReadLine();
if (answer == "1")
dragon.Life = dragon.Life - (AtacArbalets - dragon.ProtectionArbalest);
if (answer == "2")
dragon.Life = dragon.Life - (AtacSword - dragon.ProtectionSword);
if (answer == "3")
dragon.Life = dragon.Life - (AtacMagic - dragon.ProtectionMagic);
}
if (rand.Next(1, 100) > 50)
{
Console.WriteLine("Atac dragon!");
Life = Life - (dragon.Atac - Protection);
}
Console.WriteLine("Dragon: " + dragon.Life);
Console.WriteLine("Knight: " + Life);
}
}
}
}