3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-25 13:29:29 +01:00

Plugin/Battleship: fix bomb input constraints

Players who have been removed or have lost can no longer attack.

Fix attack range checks.
This commit is contained in:
Pragmatic Software 2024-03-05 22:00:55 -08:00
parent 4b5e3d0d41
commit 1cb6a114b8
No known key found for this signature in database
GPG Key ID: CC916B6E3C84ECCE
2 changed files with 10 additions and 2 deletions

View File

@ -378,6 +378,14 @@ sub cmd_battleship($self, $context) {
return "You are not playing in this game.";
}
if ($player->{lost}) {
return "You have been knocked out of this game. Try again next game.";
}
if ($player->{removed}) {
return "You have been removed from this game. Try again next game.";
}
# no arguments provided
if (not length $arguments) {
if (delete $player->{location}) {
@ -399,7 +407,7 @@ sub cmd_battleship($self, $context) {
$x = ord($x) - 65;
if ($x < 0 || $x > $self->{N_Y} || $y < 0 || $y > $self->{N_X}) {
if ($x < 0 || $x > $self->{N_Y} - 1 || $y < 1 || $y > $self->{N_X}) {
return "$nick: Target out of range, try again.";
}

View File

@ -25,7 +25,7 @@ use PBot::Imports;
# These are set by the /misc/update_version script
use constant {
BUILD_NAME => "PBot",
BUILD_REVISION => 4704,
BUILD_REVISION => 4705,
BUILD_DATE => "2024-03-05",
};