mirror of
https://github.com/pragma-/pbot.git
synced 2025-05-03 13:17:33 +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,12 +302,18 @@ sub battleship_cmd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($self->bomb($player, uc $arguments)) {
|
if ($self->bomb($player, uc $arguments)) {
|
||||||
$self->{player}->[$player]->{done} = 1;
|
if ($self->{player}->[$player]->{won}) {
|
||||||
$self->{player}->[!$player]->{done} = 0;
|
$self->{previous_state} = $self->{current_state};
|
||||||
$self->{state_data}->{current_player} = !$player;
|
$self->{current_state} = 'checkplayer';
|
||||||
$self->{state_data}->{ticks} = 1;
|
$self->run_one_state;
|
||||||
$self->{state_data}->{first_tock} = 1;
|
} else {
|
||||||
$self->{state_data}->{counter} = 0;
|
$self->{player}->[$player]->{done} = 1;
|
||||||
|
$self->{player}->[!$player]->{done} = 0;
|
||||||
|
$self->{state_data}->{current_player} = !$player;
|
||||||
|
$self->{state_data}->{ticks} = 1;
|
||||||
|
$self->{state_data}->{first_tock} = 1;
|
||||||
|
$self->{state_data}->{counter} = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user