-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAmmoDeck.cs
37 lines (31 loc) · 1.01 KB
/
AmmoDeck.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
namespace liveorlive_server {
public class AmmoDeck : Deck<AmmoType> {
public int LiveCount { get; private set; } = 0;
public int BlankCount { get; private set; } = 0;
public override void Refresh() {
this.deck.Clear();
this.LiveCount = 0;
this.BlankCount = 0;
this.AddAmmo(AmmoType.Live);
this.AddAmmo(AmmoType.Blank);
this.Shuffle();
}
public int AddAmmo(AmmoType type) {
Random random = new();
int count = random.Next(1, 7);
for (int i = 0; i < count; i++) {
this.deck.Add(type);
}
if (type == AmmoType.Live) {
this.LiveCount += count;
} else if (type == AmmoType.Blank) {
this.BlankCount += count;
}
return count;
}
// Used by check bullet item
public AmmoType Peek() {
return this.deck[^1]; // From the end
}
}
}