From 006f9f0638cfc28c132da394a0ec5b7754127c9a Mon Sep 17 00:00:00 2001 From: Xuc Pan Date: Sat, 11 May 2024 20:53:59 +0800 Subject: [PATCH 1/3] fix: :bug: stunned cannot die? --- logic/GameClass/GameObj/Ship.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/logic/GameClass/GameObj/Ship.cs b/logic/GameClass/GameObj/Ship.cs index 731c40f5..8f0aa20b 100755 --- a/logic/GameClass/GameObj/Ship.cs +++ b/logic/GameClass/GameObj/Ship.cs @@ -334,19 +334,19 @@ public long SetShipState(RunningStateType running, ShipStateType value = ShipSta switch (nowShipState) { case ShipStateType.Attacking: - if (value == ShipStateType.Null || value == ShipStateType.Stunned || value == ShipStateType.Swinging) + if (value == ShipStateType.Null || value == ShipStateType.Deceased || value == ShipStateType.Stunned || value == ShipStateType.Swinging) return ChangeShipState(running, value, gameObj); else return -1; case ShipStateType.Stunned: - if (value == ShipStateType.Null) + if (value == ShipStateType.Null || value == ShipStateType.Deceased) return ChangeShipState(running, value, gameObj); else return -1; case ShipStateType.Swinging: - if (value == ShipStateType.Null || value == ShipStateType.Stunned) + if (value == ShipStateType.Null || value == ShipStateType.Deceased || value == ShipStateType.Stunned) return ChangeShipState(running, value, gameObj); else return -1; case ShipStateType.Deceased: - if (value == ShipStateType.Null) + if (value == ShipStateType.Null || value == ShipStateType.Deceased) return ChangeShipState(running, value, gameObj); else return -1; default: From 8debba9ff10adece88dd75c88325bccb68658a54 Mon Sep 17 00:00:00 2001 From: Xuc Pan Date: Sat, 11 May 2024 20:57:12 +0800 Subject: [PATCH 2/3] fix: :bug: cannot die twice --- logic/GameClass/GameObj/Ship.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/logic/GameClass/GameObj/Ship.cs b/logic/GameClass/GameObj/Ship.cs index 8f0aa20b..a9818643 100755 --- a/logic/GameClass/GameObj/Ship.cs +++ b/logic/GameClass/GameObj/Ship.cs @@ -346,7 +346,7 @@ public long SetShipState(RunningStateType running, ShipStateType value = ShipSta return ChangeShipState(running, value, gameObj); else return -1; case ShipStateType.Deceased: - if (value == ShipStateType.Null || value == ShipStateType.Deceased) + if (value == ShipStateType.Null) return ChangeShipState(running, value, gameObj); else return -1; default: From 03bb2ec7bbbfe300afcdf99da3826f377309cf4f Mon Sep 17 00:00:00 2001 From: Xuc Pan Date: Sat, 11 May 2024 21:03:12 +0800 Subject: [PATCH 3/3] fix: :bug: home with HP 0 should do nothing --- logic/Server/RpcServices.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/logic/Server/RpcServices.cs b/logic/Server/RpcServices.cs index 18ea43b5..2b8d21d8 100755 --- a/logic/Server/RpcServices.cs +++ b/logic/Server/RpcServices.cs @@ -446,6 +446,10 @@ public override Task InstallModule(InstallMsg request, ServerCallContex return Task.FromResult(boolRes); } // var gameID = communicationToGameID[request.TeamId][request.PlayerId]; + if (game.TeamList[(int)request.TeamId].Home.HP <= 0) + { + return Task.FromResult(new BoolRes { ActSuccess = false }); + } boolRes.ActSuccess = game.InstallModule( request.TeamId, request.PlayerId, Transformation.ModuleFromProto(request.ModuleType)); @@ -464,6 +468,10 @@ public override Task Recycle(IDMsg request, ServerCallContext context) return Task.FromResult(boolRes); } // var gameID = communicationToGameID[request.TeamId][request.PlayerId]; + if (game.TeamList[(int)request.TeamId].Home.HP <= 0) + { + return Task.FromResult(new BoolRes { ActSuccess = false }); + } boolRes.ActSuccess = game.Recycle(request.TeamId, request.PlayerId); GameServerLogging.logger.ConsoleLogDebug("END Recycle"); return Task.FromResult(boolRes); @@ -485,6 +493,10 @@ public override Task BuildShip(BuildShipMsg request, ServerCallContext { return Task.FromResult(new BoolRes { ActSuccess = false }); } + if (game.TeamList[(int)request.TeamId].Home.HP <= 0) + { + return Task.FromResult(new BoolRes { ActSuccess = false }); + } BoolRes boolRes = new() { ActSuccess = @@ -515,6 +527,10 @@ public override Task BuildShipRID(BuildShipMsg request, ServerCall { return Task.FromResult(new BuildShipRes { ActSuccess = false }); } + if (game.TeamList[(int)request.TeamId].Home.HP <= 0) + { + return Task.FromResult(new BuildShipRes { ActSuccess = false }); + } var playerId = game.ActivateShip( request.TeamId, Transformation.ShipTypeFromProto(request.ShipType),