make some small changes to merging

This commit is contained in:
2026-07-07 14:30:28 +02:00
parent d504e0b916
commit ccdb52f84b
6 changed files with 69 additions and 14 deletions
+4 -3
View File
@@ -48,16 +48,17 @@ namespace KernelPanic.Meta
int targetVersion = currentVersion + 1;
int cost = GachaTuning.GetVersionUpgradeCost(targetVersion);
if (state.merges < cost)
int merges = Math.Max(0, entry.merges);
if (merges < cost)
{
return VersionUpgradeResult.Failed(unitId, VersionUpgradeFailureReason.InsufficientMerges, currentVersion, targetVersion, cost);
}
state.merges -= cost;
entry.merges = merges - cost;
entry.version = targetVersion;
collection?.SetVersionSilently(unitId, targetVersion);
VersionUpgradeResult result = VersionUpgradeResult.Upgraded(unitId, currentVersion, targetVersion, cost, state.merges);
VersionUpgradeResult result = VersionUpgradeResult.Upgraded(unitId, currentVersion, targetVersion, cost, entry.merges);
UnitUpgraded?.Invoke(result);
return result;
}