Werewolf: Fixed a leave before game begin bug.
This commit is contained in:
1 parent
bc287589bb
commit
8f58cb3c9f
2 files changed
+5
-2
No files matched your search
@@ -3,6 +3,7 @@ Auto IRC Bot 3.0: Change Log
|
|||||||
|
|
||||||
3.0 Indev
|
3.0 Indev
|
||||||
===============================================================================
|
===============================================================================
|
||||||
|
* Werewolf: Fixed a leave before game begin bug.
|
||||||
* Aliases now work in PM's to the bot too.
|
* Aliases now work in PM's to the bot too.
|
||||||
* Added an epic, Werewolf module.
|
* Added an epic, Werewolf module.
|
||||||
* Made slog() saner.
|
* Made slog() saner.
|
||||||
|
|||||||
+4
-2
@@ -1245,7 +1245,7 @@ sub _getrole {
|
|||||||
elsif ($PLAYERS{$plyr} =~ m/h/xsm) { $role = 'harlot' }
|
elsif ($PLAYERS{$plyr} =~ m/h/xsm) { $role = 'harlot' }
|
||||||
elsif ($PLAYERS{$plyr} =~ m/g/xsm) { $role = 'guardian angel' }
|
elsif ($PLAYERS{$plyr} =~ m/g/xsm) { $role = 'guardian angel' }
|
||||||
elsif ($PLAYERS{$plyr} =~ m/d/xsm) { $role = 'detective' }
|
elsif ($PLAYERS{$plyr} =~ m/d/xsm) { $role = 'detective' }
|
||||||
else { $role = 'villager' }
|
elsif ($PLAYERS{$plyr} =~ m/v/xsm) { $role = 'villager' }
|
||||||
}
|
}
|
||||||
elsif ($lev == 2) {
|
elsif ($lev == 2) {
|
||||||
if ($PLAYERS{$plyr} =~ m/w/xsm) { $role = 'wolf' }
|
if ($PLAYERS{$plyr} =~ m/w/xsm) { $role = 'wolf' }
|
||||||
@@ -1254,7 +1254,7 @@ sub _getrole {
|
|||||||
elsif ($PLAYERS{$plyr} =~ m/g/xsm) { $role = 'guardian angel' }
|
elsif ($PLAYERS{$plyr} =~ m/g/xsm) { $role = 'guardian angel' }
|
||||||
elsif ($PLAYERS{$plyr} =~ m/d/xsm) { $role = 'detective' }
|
elsif ($PLAYERS{$plyr} =~ m/d/xsm) { $role = 'detective' }
|
||||||
elsif ($PLAYERS{$plyr} =~ m/t/xsm) { $role = 'traitor' }
|
elsif ($PLAYERS{$plyr} =~ m/t/xsm) { $role = 'traitor' }
|
||||||
else { $role = 'villager' }
|
elsif ($PLAYERS{$plyr} =~ m/v/xsm) { $role = 'villager' }
|
||||||
}
|
}
|
||||||
if (!$role) { $role = 'person' }
|
if (!$role) { $role = 'person' }
|
||||||
|
|
||||||
@@ -1286,12 +1286,14 @@ sub _player_del {
|
|||||||
if ($SEEN) { if ($SEEN eq $player) { $SEEN = 0 } }
|
if ($SEEN) { if ($SEEN eq $player) { $SEEN = 0 } }
|
||||||
|
|
||||||
# Check for winning conditions.
|
# Check for winning conditions.
|
||||||
|
if (!$PGAME) {
|
||||||
my $wolves;
|
my $wolves;
|
||||||
while ((undef, $_) = each %PLAYERS) { if ($_ =~ m/(w|t)/xsm) { $wolves++ } }
|
while ((undef, $_) = each %PLAYERS) { if ($_ =~ m/(w|t)/xsm) { $wolves++ } }
|
||||||
if (!$wolves) { _gameover('v'); return }
|
if (!$wolves) { _gameover('v'); return }
|
||||||
my $villagers;
|
my $villagers;
|
||||||
while ((undef, $_) = each %PLAYERS) { if ($_ =~ m/(v|s|g|h|d)/xsm) { $villagers++ } }
|
while ((undef, $_) = each %PLAYERS) { if ($_ =~ m/(v|s|g|h|d)/xsm) { $villagers++ } }
|
||||||
if ($villagers <= $wolves) { _gameover('w'); return }
|
if ($villagers <= $wolves) { _gameover('w'); return }
|
||||||
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user