Skip to content

Commit 9aaeb85

Browse files
committed
add Abathur build
1 parent 7a756e6 commit 9aaeb85

File tree

3 files changed

+84
-2
lines changed

3 files changed

+84
-2
lines changed

src/dsstats.razorlib/Replays/ReplayPlayerDetails.razor

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
@using dsstats.razorlib.Modals
33
@using dsstats.shared
44
@using dsstats.razorlib.Services
5+
@using dsstats.shared.DsFen
56
@using dsstats.shared.Interfaces
67
@using static dsstats.razorlib.Replays.ReplayPlayersDetailContainer
78
@inject IDsDataService dsDataService
@@ -92,7 +93,7 @@
9293
</h5>
9394
</div>
9495
}
95-
@if (Spawn != null && Player.Race != Commander.None && (int)Player.Race <= 3)
96+
@if (Spawn != null && CmdrBuildFactory.IsSupported(Player.Race))
9697
{
9798
<div class="col-auto">
9899
<button type="button" class="btn btn-sm btn-outline-light"
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
namespace dsstats.shared.DsFen;
2+
3+
public class AbathurBuild : CmdrBuild
4+
{
5+
public AbathurBuild()
6+
{
7+
UnitMap = new Dictionary<string, BuildOption>
8+
{
9+
{ "VileRoach", new('q') },
10+
{ "SwarmQueen", new('w') },
11+
12+
{ "Mutalisk", new('a', 1, true) },
13+
{ "Ravager", new('s', 2) },
14+
{ "Devourer", new('d', 2, true) },
15+
{ "Overseer", new('f', 2, true) },
16+
{ "SwarmHost", new('g', 2) },
17+
18+
{ "Viper", new('z', 2, true) },
19+
{ "Guardian", new('x', 2, true) },
20+
{ "Brutalisk", new('c', 2) },
21+
{ "Leviathan", new('v', 3, true) },
22+
};
23+
24+
AbilityMap = new Dictionary<string, BuildOption>
25+
{
26+
{ "GlialReconstitution", new('q') },
27+
{ "TunnelingClaws", new('w') },
28+
{ "VileRoachHydriodicBile", new('r') },
29+
{ "VileRoachAdaptivePlating", new('e') },
30+
{ "SwarmQueenBioMechanicalTransfusion", new('t') },
31+
32+
{ "RavagerBloatedBileDucts", new('a') },
33+
{ "RavagerPotentBile", new('s') },
34+
{ "GuardianProlongedDispersion", new('d') },
35+
{ "DevourerCorrosiveSpray", new('f') },
36+
{ "overlordspeed", new('g') },
37+
38+
{ "BroodMutaliskViciousGlave", new('z') },
39+
{ "BroodMutaliskSunderingGlave", new('x') },
40+
{ "SwarmHostPressurizedGlands", new('c') },
41+
{ "ViperVirulentMicrobes", new('v') },
42+
};
43+
44+
UpgradeMap = new Dictionary<string, BuildOption>
45+
{
46+
{ "ZergMeleeWeaponsLevel1", new('a') },
47+
{ "ZergMeleeWeaponsLevel2", new('a') },
48+
{ "ZergMeleeWeaponsLevel3", new('a') },
49+
{ "ZergGroundArmorsLevel1", new('s') },
50+
{ "ZergGroundArmorsLevel2", new('s') },
51+
{ "ZergGroundArmorsLevel3", new('s') },
52+
{ "ZergMissileWeaponsLevel1", new('d') },
53+
{ "ZergMissileWeaponsLevel2", new('d') },
54+
{ "ZergMissileWeaponsLevel3", new('d') },
55+
{ "ZergFlyerWeaponsLevel1", new('f') },
56+
{ "ZergFlyerWeaponsLevel2", new('f') },
57+
{ "ZergFlyerWeaponsLevel3", new('f') },
58+
{ "ZergFlyerArmorsLevel1", new('g') },
59+
{ "ZergFlyerArmorsLevel2", new('g') },
60+
{ "ZergFlyerArmorsLevel3", new('g') },
61+
};
62+
CreateActiveUnits();
63+
}
64+
}

src/dsstats.shared/DsFen/CmdrBuild.cs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
namespace dsstats.shared.DsFen;
1+
using System.Collections.Frozen;
2+
3+
namespace dsstats.shared.DsFen;
24

35
public abstract class CmdrBuild
46
{
@@ -89,14 +91,29 @@ public sealed record BuildOption(char Key, int UnitSize = 1, bool IsAir = false,
8991

9092
public static class CmdrBuildFactory
9193
{
94+
private static readonly HashSet<Commander> SupportedCommanders = new()
95+
{
96+
Commander.Protoss,
97+
Commander.Terran,
98+
Commander.Zerg,
99+
Commander.Abathur
100+
};
101+
92102
public static CmdrBuild? Create(Commander commander)
93103
{
94104
return commander switch
95105
{
96106
Commander.Protoss => new ProtossBuild(),
97107
Commander.Terran => new TerranBuild(),
98108
Commander.Zerg => new ZergBuild(),
109+
110+
Commander.Abathur => new AbathurBuild(),
99111
_ => null
100112
};
101113
}
114+
115+
public static bool IsSupported(Commander commander)
116+
{
117+
return SupportedCommanders.Contains(commander);
118+
}
102119
}

0 commit comments

Comments
 (0)