mirror of https://github.com/pragma-/pbot.git
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') {
|
||||
$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 $player;
|
||||
|
||||
|
@ -298,6 +302,11 @@ sub battleship_cmd {
|
|||
}
|
||||
|
||||
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} = 0;
|
||||
$self->{state_data}->{current_player} = !$player;
|
||||
|
@ -306,6 +315,7 @@ sub battleship_cmd {
|
|||
$self->{state_data}->{counter} = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
when ($_ eq 'specboard' or $_ eq 'board') {
|
||||
if ($self->{current_state} eq 'nogame' or $self->{current_state} eq 'accept'
|
||||
|
|
Loading…
Reference in New Issue