mirror of
https://github.com/pragma-/pbot.git
synced 2025-05-06 22:57:32 +02:00
Fix Battleship win condition bug from previous commit
This commit is contained in:
parent
4316e0c6de
commit
684ed5351f
@ -274,6 +274,10 @@ sub battleship_cmd {
|
|||||||
when ('bomb') {
|
when ('bomb') {
|
||||||
$self->{pbot}->{logger}->log("Battleship: bomb state: $self->{current_state}\n" . Dumper $self->{state_data});
|
$self->{pbot}->{logger}->log("Battleship: bomb state: $self->{current_state}\n" . Dumper $self->{state_data});
|
||||||
|
|
||||||
|
if ($self->{current_state} ne 'playermove') {
|
||||||
|
return "$nick: It's not time to do that now.";
|
||||||
|
}
|
||||||
|
|
||||||
my $id = $self->{pbot}->{messagehistory}->{database}->get_message_account($nick, $user, $host);
|
my $id = $self->{pbot}->{messagehistory}->{database}->get_message_account($nick, $user, $host);
|
||||||
my $player;
|
my $player;
|
||||||
|
|
||||||
@ -298,6 +302,11 @@ sub battleship_cmd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($self->bomb($player, uc $arguments)) {
|
if ($self->bomb($player, uc $arguments)) {
|
||||||
|
if ($self->{player}->[$player]->{won}) {
|
||||||
|
$self->{previous_state} = $self->{current_state};
|
||||||
|
$self->{current_state} = 'checkplayer';
|
||||||
|
$self->run_one_state;
|
||||||
|
} else {
|
||||||
$self->{player}->[$player]->{done} = 1;
|
$self->{player}->[$player]->{done} = 1;
|
||||||
$self->{player}->[!$player]->{done} = 0;
|
$self->{player}->[!$player]->{done} = 0;
|
||||||
$self->{state_data}->{current_player} = !$player;
|
$self->{state_data}->{current_player} = !$player;
|
||||||
@ -306,6 +315,7 @@ sub battleship_cmd {
|
|||||||
$self->{state_data}->{counter} = 0;
|
$self->{state_data}->{counter} = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
when ($_ eq 'specboard' or $_ eq 'board') {
|
when ($_ eq 'specboard' or $_ eq 'board') {
|
||||||
if ($self->{current_state} eq 'nogame' or $self->{current_state} eq 'accept'
|
if ($self->{current_state} eq 'nogame' or $self->{current_state} eq 'accept'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user