Skip to content

Commit 68f2bff

Browse files
committed
add AlarakBuild
1 parent 4735f01 commit 68f2bff

File tree

4 files changed

+87
-8
lines changed

4 files changed

+87
-8
lines changed

src/dsstats.maui/dsstats.builder/dsstats.builder/DsBuilder.cs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,22 @@ public static void Build(DsBuildRequest buildRequest, bool dry = false)
7777
events.Add(new(InputType.KeyPress, 0, 0, 0x57, 100));
7878
foreach (var upgrade in buildRequest.Upgrades)
7979
{
80-
var upgradeChar = build.GetAbilityChar(upgrade.Upgrade.Name);
81-
if (upgradeChar is not null
82-
&& User32Wrapper.TryMapCharToKey(upgradeChar.Value, out var code, out var shift))
80+
var buildOption = build.GetAbilityBuildOption(upgrade.Upgrade.Name);
81+
if (buildOption is not null
82+
&& User32Wrapper.TryMapCharToKey(buildOption.Key, out var code, out var shift))
8383
{
84-
events.Add(new InputEvent(InputType.KeyPress, 0, 0, code, 200));
84+
if (buildOption.IsAbility)
85+
{
86+
events.Add(new(InputType.KeyPress, 0, 0, workerKey, 100));
87+
events.Add(new(InputType.KeyPress, 0, 0, 0x51, 100));
88+
events.Add(new(InputType.KeyPress, 0, 0, code, 100));
89+
events.Add(new(InputType.KeyPress, 0, 0, workerKey, 100));
90+
events.Add(new(InputType.KeyPress, 0, 0, 0x57, 100));
91+
}
92+
else
93+
{
94+
events.Add(new InputEvent(InputType.KeyPress, 0, 0, code, 200));
95+
}
8596
upgrades.Remove(upgrade);
8697
}
8798
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
namespace dsstats.shared.DsFen;
2+
3+
public class AlarakBuild : CmdrBuild
4+
{
5+
public AlarakBuild()
6+
{
7+
UnitMap = new Dictionary<string, BuildOption>
8+
{
9+
{ "Supplicant", new('q') },
10+
{ "Slayer", new('w', 2) },
11+
{ "Havoc", new('e', 1) },
12+
{ "Alarak", new('r', 2) },
13+
14+
{ "Vanguard", new('a', 2) },
15+
{ "Ascendant", new('s') },
16+
{ "Destroyer", new('d', 2, true) },
17+
{ "WarPrism", new('f', 2, true) },
18+
19+
{ "Wrathwalker", new('z', 2) },
20+
{ "MothershipTaldarim", new('x', 3, true) },
21+
};
22+
23+
AbilityMap = new Dictionary<string, BuildOption>
24+
{
25+
{ "SupplicantSoulAugmentation", new('q') },
26+
{ "SupplicantBloodShields", new('w') },
27+
{ "SlayerPhasingArmor", new('e') },
28+
{ "HavocCloakingModule", new('r') },
29+
{ "HavocDetectWeakness", new('t') },
30+
31+
{ "HavocBloodshardResonance", new('a') },
32+
{ "VanguardFusionMortars", new('s') },
33+
{ "VanguardMatterDispersion", new('d') },
34+
{ "AscendantMindBlast", new('f') },
35+
{ "AscendantPowerOverwhelming", new('g') },
36+
37+
{ "AscendantChaoticAttunement", new('z') },
38+
{ "WrathwalkerAerialTracking", new('x') },
39+
{ "WrathwalkerPowerCycling", new('c') },
40+
{ "SupplicantStarlightAirAttack", new('v') },
41+
42+
{ "AlarakImposingPresence", new('r', IsAbility: true) },
43+
{ "AlarakTelekinesis", new('g', IsAbility: true) },
44+
};
45+
46+
UpgradeMap = new Dictionary<string, BuildOption>
47+
{
48+
{ "ProtossGroundWeaponsLevel1", new('a') },
49+
{ "ProtossGroundWeaponsLevel2", new('a') },
50+
{ "ProtossGroundWeaponsLevel3", new('a') },
51+
{ "ProtossGroundArmorsLevel1", new('s') },
52+
{ "ProtossGroundArmorsLevel2", new('s') },
53+
{ "ProtossGroundArmorsLevel3", new('s') },
54+
{ "ProtossShieldsLevel1", new('d') },
55+
{ "ProtossShieldsLevel2", new('d') },
56+
{ "ProtossShieldsLevel3", new('d') },
57+
{ "ProtossAirWeaponsLevel1", new('f') },
58+
{ "ProtossAirWeaponsLevel2", new('f') },
59+
{ "ProtossAirWeaponsLevel3", new('f') },
60+
{ "ProtossAirArmorsLevel1", new('g') },
61+
{ "ProtossAirArmorsLevel2", new('g') },
62+
{ "ProtossAirArmorsLevel3", new('g') },
63+
};
64+
CreateActiveUnits();
65+
}
66+
}

src/dsstats.shared/DsFen/CmdrBuild.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ protected void CreateActiveUnits()
2828
: null;
2929
}
3030

31-
public virtual char? GetAbilityChar(string abilityName)
31+
public virtual BuildOption? GetAbilityBuildOption(string abilityName)
3232
{
3333
return AbilityMap.TryGetValue(abilityName, out var buildOption)
34-
? buildOption.Key
34+
? buildOption
3535
: null;
3636
}
3737

@@ -96,7 +96,8 @@ public static class CmdrBuildFactory
9696
Commander.Protoss,
9797
Commander.Terran,
9898
Commander.Zerg,
99-
Commander.Abathur
99+
Commander.Abathur,
100+
Commander.Alarak,
100101
};
101102

102103
public static CmdrBuild? Create(Commander commander)
@@ -108,6 +109,7 @@ public static class CmdrBuildFactory
108109
Commander.Zerg => new ZergBuild(),
109110

110111
Commander.Abathur => new AbathurBuild(),
112+
Commander.Alarak => new AlarakBuild(),
111113
_ => null
112114
};
113115
}

src/dsstats.shared/DsFen/DsFen.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public static string GetFen(DsBuildRequest buildRequest)
6464
grid.Upgrades.Add(upgradeChar.Value);
6565
continue;
6666
}
67-
var abilityChar = build.GetAbilityChar(upgrade.Upgrade.Name);
67+
var abilityChar = build.GetAbilityBuildOption(upgrade.Upgrade.Name)?.Key;
6868
if (abilityChar is not null)
6969
{
7070
grid.Abilities.Add(abilityChar.Value);

0 commit comments

Comments
 (0)