fix(BuildCalc) Cancel now reverts unlocked tech again
This commit is contained in:
@@ -43,6 +43,13 @@ public class BuildOrderModel
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public Dictionary<string, int> UniqueCompletedCount { get; set; } = new()
|
||||||
|
{
|
||||||
|
{
|
||||||
|
DataType.STARTING_Bastion, 1
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public Dictionary<int, int> SupplyCountTimes { get; set; } = new()
|
public Dictionary<int, int> SupplyCountTimes { get; set; } = new()
|
||||||
|
|||||||
@@ -1496,7 +1496,7 @@ public class DATA
|
|||||||
.AddPart(new EntityHotkeyModel { Hotkey = "Q", HotkeyGroup = "TAB" })
|
.AddPart(new EntityHotkeyModel { Hotkey = "Q", HotkeyGroup = "TAB" })
|
||||||
.AddPart(new EntityFactionModel { Faction = FactionType.QRath })
|
.AddPart(new EntityFactionModel { Faction = FactionType.QRath })
|
||||||
.AddPart(new EntityProductionModel { Alloy = 50, Ether = 100, BuildTime = 60 })
|
.AddPart(new EntityProductionModel { Alloy = 50, Ether = 100, BuildTime = 60 })
|
||||||
.AddPart(new EntityRequirementModel() { Id = DataType.BUILDING_Reliquary, Requirement = RequirementType.Research_Building})
|
.AddPart(new EntityRequirementModel { Id = DataType.BUILDING_Reliquary, Requirement = RequirementType.Research_Building})
|
||||||
.AddPart(new EntityVanguardAddedModel
|
.AddPart(new EntityVanguardAddedModel
|
||||||
{ ReplaceId = DataType.UPGRADE_GreavesOfAhqar, ImmortalId = DataType.IMMORTAL_Orzum })
|
{ ReplaceId = DataType.UPGRADE_GreavesOfAhqar, ImmortalId = DataType.IMMORTAL_Orzum })
|
||||||
|
|
||||||
|
|||||||
@@ -65,6 +65,11 @@ public class BuildOrderService : IBuildOrderService
|
|||||||
if (!buildOrder.UniqueCompletedTimes.ContainsKey(entity.DataType))
|
if (!buildOrder.UniqueCompletedTimes.ContainsKey(entity.DataType))
|
||||||
buildOrder.UniqueCompletedTimes.Add(entity.DataType, atInterval);
|
buildOrder.UniqueCompletedTimes.Add(entity.DataType, atInterval);
|
||||||
|
|
||||||
|
if (!buildOrder.UniqueCompletedCount.ContainsKey(entity.DataType))
|
||||||
|
buildOrder.UniqueCompletedCount.Add(entity.DataType, 1);
|
||||||
|
else
|
||||||
|
buildOrder.UniqueCompletedCount[entity.DataType]++;
|
||||||
|
|
||||||
if (supply != null)
|
if (supply != null)
|
||||||
{
|
{
|
||||||
if (!supply.Takes.Equals(0)) buildOrder.CurrentSupplyUsed += supply.Takes;
|
if (!supply.Takes.Equals(0)) buildOrder.CurrentSupplyUsed += supply.Takes;
|
||||||
@@ -159,8 +164,11 @@ public class BuildOrderService : IBuildOrderService
|
|||||||
if (entityRemoved.Supply()?.Takes > 0)
|
if (entityRemoved.Supply()?.Takes > 0)
|
||||||
buildOrder.CurrentSupplyUsed -= entityRemoved.Supply()!.Takes;
|
buildOrder.CurrentSupplyUsed -= entityRemoved.Supply()!.Takes;
|
||||||
|
|
||||||
if (UniqueCompletedTimes[entityRemoved!.DataType].Equals(lastInterval + entityRemoved.Production()!.BuildTime))
|
|
||||||
|
buildOrder.UniqueCompletedCount[entityRemoved!.DataType]--;
|
||||||
|
if (buildOrder.UniqueCompletedCount[entityRemoved!.DataType] == 0) {
|
||||||
UniqueCompletedTimes.Remove(entityRemoved.DataType);
|
UniqueCompletedTimes.Remove(entityRemoved.DataType);
|
||||||
|
}
|
||||||
|
|
||||||
if (entityRemoved.Info().Descriptive == DescriptiveType.Worker)
|
if (entityRemoved.Info().Descriptive == DescriptiveType.Worker)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user