#Pick 16 people level 31+ to participate in a royal tournament, which is
#basically a 16 player single elimination bracket type battle to the end.
#the winner gets the same reward as a HOG (but only good). The reward
#sort of sucks for people with low TTL and is uber for people with very large
#TTL's. Perhaps some balancing can be done...
sub tournament {
return if !$opts{tournament};
@tournament = grep { $rps{$_}{online} && $rps{$_}{level} > 30 &&
time()-$rps{$_}{lastlogin} > 14400 } keys %rps;
if (@tournament < 16) {
$tournamenttime = time() + 21600 + int(rand(21600));
return undef @tournament;
}
splice(@tournament,int rand @tournament,1) while @tournament > 16;
chanmsg(join(", ",@tournament)." have been chosen by the gods to ".
"participate in the royal tournament.");
$round = 1;
$battle = 1;
fisher_yates_shuffle( \@tournament );
$tournamenttime = time() + 15; #delay just a little before the next fight
}