/
Patron.cs
52 lines (46 loc) · 1.36 KB
/
Patron.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
using System;
using System.Collections.Generic;
using System.Text;
namespace KeepFaith
{
public class Patron
{
public Patron(List<AilmentType> ailments, int faithInWallet)
{
Ailments = ailments;
FaithInWallet = faithInWallet;
BlessingReceived = null;
}
public Blessing BlessingReceived { get; private set; }
public List<AilmentType> Ailments { get; private set; }
public int FaithInWallet { get; private set; }
public int Tithe()
{
if (Ailments.Count > 0)
{
int roughlyAThird = FaithInWallet / 3;
FaithInWallet -= Math.Clamp(roughlyAThird, 0, FaithInWallet);
return roughlyAThird;
}
return 0;
}
public int PickPocket()
{
int pocketed = FaithInWallet > 0 ? 1 : 0;
FaithInWallet -= pocketed;
return pocketed;
}
public void ReceiveBlessing(Blessing blessing)
{
BlessingReceived = blessing;
foreach(AilmentType curableAilment in blessing.CurableAilments)
{
if (Ailments.Contains(curableAilment))
{
Ailments.Remove(curableAilment);
return;
}
}
}
}
}