Werewolf: Wounded villagers are now excluded from winning villager count.
This commit is contained in:
1 parent
a1beabe76a
commit
3ef78078c4
2 files changed
+25
-13
No files matched your search
@@ -3,6 +3,7 @@ Auto IRC Bot 3.0: Change Log
|
||||
|
||||
3.0 Indev
|
||||
===============================================================================
|
||||
* Werewolf: Wounded villagers are now excluded from winning villager count.
|
||||
* Werewolf: Dynamic lynch and no victim messages.
|
||||
* Werewolf 1.05: Added WAIT command.
|
||||
* Werewolf: Improved STATS to be smart.
|
||||
|
||||
+24
-13
@@ -610,6 +610,9 @@ sub cmd_wolf {
|
||||
}
|
||||
# Set number of votes required to lynch.
|
||||
_calclvn();
|
||||
|
||||
# Check for winning conditions.
|
||||
_chkwin();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1415,19 +1418,8 @@ sub _player_del {
|
||||
if ($LVOTEN) { _calclvn() }
|
||||
|
||||
# Check for winning conditions.
|
||||
if (!$PGAME) {
|
||||
my $wolves;
|
||||
for (values %PLAYERS) { if (m/w/xsm) { $wolves++ } }
|
||||
if (!$wolves) { _gameover('v'); return }
|
||||
my $villagers;
|
||||
for (values %PLAYERS) { if (m/(v|s|g|h|d)/xsm) { $villagers++ } }
|
||||
if ($villagers <= $wolves) { _gameover('w'); return }
|
||||
}
|
||||
else {
|
||||
# Check if there's any more players.
|
||||
if (!keys %PLAYERS) { _gameover('n') }
|
||||
}
|
||||
|
||||
if (!_chkwin()) { return }
|
||||
|
||||
# Call lynch management IF judgment did not call us.
|
||||
if ($PHASE and !$judgment) {
|
||||
if ($PHASE eq 'd') { _lynchmng() }
|
||||
@@ -1457,6 +1449,25 @@ sub _lynchmng {
|
||||
return 1;
|
||||
}
|
||||
|
||||
# Subroutine for checking if we have a winner.
|
||||
sub _chkwin {
|
||||
if (!$PGAME) {
|
||||
my $wolves;
|
||||
for (values %PLAYERS) { if (m/w/xsm) { $wolves++ } }
|
||||
if (!$wolves) { _gameover('v'); return }
|
||||
my $villagers;
|
||||
for (values %PLAYERS) { if (m/(v|s|g|h|d)/xsm) { $villagers++ } }
|
||||
$villagers -= scalar @SHOT;
|
||||
if ($villagers <= $wolves) { _gameover('w'); return }
|
||||
}
|
||||
else {
|
||||
# Check if there's any more players.
|
||||
if (!keys %PLAYERS) { _gameover('n') }
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
# Handling the end of the game.
|
||||
sub _gameover {
|
||||
my ($winner) = @_;
|
||||
|
||||
Reference in new issue
Block a user