diff options
author | Julien Dessaux | 2015-01-01 20:47:59 +0100 |
---|---|---|
committer | Julien Dessaux | 2015-01-01 20:47:59 +0100 |
commit | e78d44f6cbb618e95805c1eeb731d2bf8551688e (patch) | |
tree | d81d3a3d44abe0ebb049995bfb6d85aece696836 | |
parent | Implemented TEAMVOTE game phase (diff) | |
download | avalon-arthur-e78d44f6cbb618e95805c1eeb731d2bf8551688e.tar.gz avalon-arthur-e78d44f6cbb618e95805c1eeb731d2bf8551688e.tar.bz2 avalon-arthur-e78d44f6cbb618e95805c1eeb731d2bf8551688e.zip |
Added evil_wins endgame
-rw-r--r-- | Avalon.pm | 17 |
1 files changed, 13 insertions, 4 deletions
@@ -32,16 +32,25 @@ sub check_endgame_and_proceed { my $self = shift; my $av = $self->{avalon}; - if ($av->{round}->{failed_votes} >= 5) { - # TODO $self->evil_wins - } given ($av->{gamephase}) { when (TEAMVOTE) { - $self->new_king; + if ($av->{round}->{failed_votes} == 5) { + $self->evil_wins; + } else { + $self->new_king; + } } } } +sub evil_wins { + my ( $self, $who ) = @_; + my $av = $self->{avalon}; + my $evil_msg = "WINNERSIDE EVIL $av->{roles}->{ASSASSIN}->[0] " . join(' ', @{$av->{roles}->{EVIL}}); + $self->say( channel => $av->{config}->{'game.channel'}, body => $evil_msg ); + $self->reset_game; +} + sub game_ready { my $av = shift->{avalon}; return ( $av->{gamephase} == GAMESTART and scalar keys $av->{registered} >= 5 ); |