fix: improve endgame clock and gameplay stability

This commit is contained in:
CAtlas0784 committed 2026-11-04 15:59:48 +07:00
1 parent ce6aabfc55
commit 658298ee86
46 files changed
+1915 -99

No files matched your search

@@ -79,19 +79,20 @@ func cwInitialRound(catalog *common.CurrencyWarsCatalog, run *pb.MPIMAEMCEFH) (*
}
// Reserve starter copies from the same finite pool before drawing the shop.
for _, role := range team.GridGameRoleList {
r, ok := pool.Roles[role.Id]
if !ok {
if role == nil {
return nil, fmt.Errorf("CW starter role is missing")
}
if _, ok := pool.Roles[role.Id]; !ok {
continue
}
config, e := catalog.CapturedRole(role.Id)
if e != nil {
return nil, e
if _, err := catalog.CapturedRoleVariant(role.Id, role.RoleStar); err != nil {
return nil, fmt.Errorf("CW starter role %d star %d not captured: %w", role.Id, role.RoleStar, err)
}
if role.RoleStar != config.DefaultStar || r.Remaining == 0 {
return nil, fmt.Errorf("CW starter pool reservation is not supported")
// Reserve the number of base copies represented by this star, using
// the same captured merge rules as later shop restocks.
if err := pool.ReserveOwned(catalog, role.Id, role.RoleStar); err != nil {
return nil, fmt.Errorf("CW starter role %d star %d: %w", role.Id, role.RoleStar, err)
}
r.Remaining--
pool.Roles[role.Id] = r
}
level, err := catalog.PlayerLevel(player.EHNJDIDABHD)
if err != nil {