Skip to content

Commit

Permalink
Merge pull request eesast#355 from Panxuc/dev
Browse files Browse the repository at this point in the history
fix: 🐛 plenty of issues
  • Loading branch information
DragonAura authored May 11, 2024
2 parents da304d0 + b5cf5b0 commit 7b38277
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
6 changes: 3 additions & 3 deletions logic/GameClass/GameObj/Ship.cs
Original file line number Diff line number Diff line change
Expand Up @@ -334,15 +334,15 @@ 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:
Expand Down
16 changes: 16 additions & 0 deletions logic/Server/RpcServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,10 @@ public override Task<BoolRes> 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));
Expand All @@ -464,6 +468,10 @@ public override Task<BoolRes> 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);
Expand All @@ -485,6 +493,10 @@ public override Task<BoolRes> 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 =
Expand Down Expand Up @@ -515,6 +527,10 @@ public override Task<BuildShipRes> 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),
Expand Down

0 comments on commit 7b38277

Please sign in to comment.