Skip to content

Commit d4371a8

Browse files
committed
make sure CanSelectForBattle is false for attackers who cannot join defense
1 parent 03c7ab5 commit d4371a8

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

ZkLobbyServer/SpringieInterface/PlanetWarsMatchMaker.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -928,6 +928,10 @@ private PwMatchCommand StampLobbyCommand(LobbySnapshot snapshot, PwPhase phase,
928928
}
929929
else // DefendCollect
930930
{
931+
// attack/defend are mutually exclusive across the whole cycle (see JoinPlanetDefense),
932+
// so any squad's attacker list disqualifies this player from defending ANY squad.
933+
var playerIsAttackerAnywhere = playerName != null && snapshot.Options.Any(o => o.AttackerNames.Contains(playerName));
934+
931935
var options = snapshot.Options.Select(s =>
932936
{
933937
var playerIsAttacker = playerName != null && s.AttackerNames.Contains(playerName);
@@ -942,7 +946,7 @@ private PwMatchCommand StampLobbyCommand(LobbySnapshot snapshot, PwPhase phase,
942946
PlanetImage = s.PlanetImage,
943947
Count = s.Count,
944948
Needed = s.Needed,
945-
CanSelectForBattle = canDefend && !playerIsAttacker,
949+
CanSelectForBattle = canDefend && !playerIsAttackerAnywhere,
946950
PlayerIsAttacker = playerIsAttacker,
947951
PlayerIsDefender = playerName != null && s.DefenderNames.Contains(playerName),
948952
AttackerFaction = s.AttackerFactionShortcut,

0 commit comments

Comments
 (0)