-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPotion.cs
More file actions
64 lines (54 loc) · 1.65 KB
/
Potion.cs
File metadata and controls
64 lines (54 loc) · 1.65 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
52
53
54
55
56
57
58
59
60
61
62
63
64
using System;
using System.Threading;
namespace EternityRPG
{
public class Potion : Item
{
public Potion(int potionType) => GetPotion(potionType);
private void GetPotion(int potionType)
{
switch (potionType)
{
case 1:
Cost = 45;
HealingPower = 100;
Title = "Light bandage";
break;
case 2:
Cost = 95;
HealingPower = 200;
Title = "Pain reliever";
break;
case 3:
Cost = 190;
HealingPower = 400;
Title = "Strong aid kit";
break;
}
}
public override void Buy(Player player, Item[] inventory, int choice)
{
if (player.Gold >= Cost)
{
player.Gold -= Cost;
Amount++;
Print.Text($"\t\t\t +1 {Title}\n", ConsoleColor.DarkGreen);
}
else Print.Text("not enough gold".PadLeft(41, ' ') + "\n", ConsoleColor.DarkRed);
Thread.Sleep(1500);
}
public override void Use(Player player, Item[] inventory, int choice)
{
player.HP += HealingPower;
Amount--;
}
public static int AmountOfPotions()
{
int amountOfPotions = default;
for (int i = 0; i < Game.inventory.Length; i++)
if (Game.inventory[i] is Potion)
amountOfPotions++;
return amountOfPotions;
}
}
}