-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNeutralMinions.cs
More file actions
167 lines (100 loc) · 4.41 KB
/
Copy pathNeutralMinions.cs
File metadata and controls
167 lines (100 loc) · 4.41 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
namespace FightMasters
{
public class NeutralMinions
{
internal class Wolf : IMinion
{
public string Name { get; set; } = "Wolf";
public int Duration { get; set; } = 3;
public Damage[]? DamageDealt { get; } = { new Damage("Physical", 2) };
public int Heal { get; } = 0;
public Dictionary<string, List<IToken>>? TokensAppliedCaster { get; } = null;
public Dictionary<string, List<IToken>>? TokensAppliedOpponent { get; } = null;
//Wolf specific fields
private int TurnsAlive { get; set; }
private bool IsWolfPack { get; set; } = false;
//Constructor
public Wolf() { }
//Methods
public string Act(Player p1, Player p2)
{
string ActSummary;
if (!IsWolfPack)
{
//If wolf is not part of a pack, check if it should be
IEnumerable<Wolf> wolves = p1.CurrentSummons.OfType<Wolf>();
if (wolves.Count() >= 3)
{
//If yes, make all wolves in pack deal extra damage
foreach (Wolf wolf in wolves)
{
wolf.DamageDealt![0] = new Damage("Physical", 3);
wolf.Duration++;
wolf.IsWolfPack = true;
}
}
}
//Deal damage
(ActSummary, bool[] dodged) = PlayHelper.DamagePlayer(this, p1, p2);
//If opponent hasn't dodged attack, reduce their physical resistance by 1%
if (!dodged[0])
{
p2.Resistances["Physical"] -= 1;
ActSummary += $"{p2.PlayerName} loses 1% physical resistance.";
}
this.TurnsAlive++;
if ((this.Duration == 1) && (!IsWolfPack))
{
//If this wolf isn't part of a pack, it's physical resistance shred effect is temporary
//As a wolf only reduces the opponent's physical resistance by 1 per turn it is alive,
//the opponent's physical resistance can be reset to normal by simply adding TurnsAlive
//to their current physical resistance
p2.Resistances["Physical"] += this.TurnsAlive;
ActSummary += $"{p2.PlayerName}'s physical resistance returns to normal.";
}
return ActSummary;
}
//ToString
public override string? ToString()
{
return MinionPrinter.PrintMinion(this);
}
}
internal class Zombie : IMinion
{
public string Name { get; set; } = "Zombie";
public int Duration { get; set; } = 2;
public Damage[]? DamageDealt { get; } = { new Damage("Poison", 1) };
public int Heal { get; } = 0;
public Dictionary<string, List<IToken>>? TokensAppliedCaster { get; } = null;
public Dictionary<string, List<IToken>>? TokensAppliedOpponent { get; } =
new Dictionary<string, List<IToken>> {
{ "<P>", new List<IToken> { new PoisonToken() } }
};
//Constructor
public Zombie() { }
//Methods
public string Act(Player p1, Player p2)
{
string ActSummary;
if (p2.TokensActive.ContainsKey("<P>") && ( (int) this.DamageDealt![0].DamageValue == 1))
{
this.DamageDealt[0].DamageValue = 2;
}
//Deal damage
(ActSummary, bool[] dodged) = PlayHelper.DamagePlayer(this, p1, p2);
//If opponent hasn't dodged attack, 50% chance to add a posion token to them
if (!dodged[0] && (new Random().Next(2) == 0))
{
PlayHelper.AddOpponentTokens(this.TokensAppliedOpponent!, p2);
}
return ActSummary;
}
//ToString
public override string? ToString()
{
return MinionPrinter.PrintMinion(this);
}
}
}
}