Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 🐛 plenty of issues #355

Merged
merged 4 commits into from
May 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading