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:
parent
4b5e3d0d41
commit
1cb6a114b8
@ -378,6 +378,14 @@ sub cmd_battleship($self, $context) {
|
|||||||
return "You are not playing in this game.";
|
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
|
# no arguments provided
|
||||||
if (not length $arguments) {
|
if (not length $arguments) {
|
||||||
if (delete $player->{location}) {
|
if (delete $player->{location}) {
|
||||||
@ -399,7 +407,7 @@ sub cmd_battleship($self, $context) {
|
|||||||
|
|
||||||
$x = ord($x) - 65;
|
$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.";
|
return "$nick: Target out of range, try again.";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ use PBot::Imports;
|
|||||||
# These are set by the /misc/update_version script
|
# These are set by the /misc/update_version script
|
||||||
use constant {
|
use constant {
|
||||||
BUILD_NAME => "PBot",
|
BUILD_NAME => "PBot",
|
||||||
BUILD_REVISION => 4704,
|
BUILD_REVISION => 4705,
|
||||||
BUILD_DATE => "2024-03-05",
|
BUILD_DATE => "2024-03-05",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user