Fix bug where night would abruptly end if there are no wolves alive to receive gun.
This commit is contained in:
parent
d34a65dd98
commit
6ee671f903
@ -2521,19 +2521,22 @@ def transition_day(cli, gameid=0):
|
|||||||
|
|
||||||
if var.WOLF_STEALS_GUN and victim in bywolves and victim in var.GUNNERS.keys() and var.GUNNERS[victim] > 0:
|
if var.WOLF_STEALS_GUN and victim in bywolves and victim in var.GUNNERS.keys() and var.GUNNERS[victim] > 0:
|
||||||
# victim has bullets
|
# victim has bullets
|
||||||
while True:
|
try:
|
||||||
guntaker = random.choice(var.list_players(var.WOLFCHAT_ROLES)) # random looter
|
while True:
|
||||||
if guntaker not in dead:
|
guntaker = random.choice(var.list_players(var.WOLFCHAT_ROLES)) # random looter
|
||||||
break
|
if guntaker not in dead:
|
||||||
numbullets = var.GUNNERS[victim]
|
break
|
||||||
var.WOLF_GUNNERS[guntaker] = 1 # transfer bullets a wolf
|
numbullets = var.GUNNERS[victim]
|
||||||
mmsg = ("While searching {0}'s belongings, You found " +
|
var.WOLF_GUNNERS[guntaker] = 1 # transfer bullets a wolf
|
||||||
"a gun loaded with 1 silver bullet! " +
|
mmsg = ("While searching {0}'s belongings, You found " +
|
||||||
"You may only use it during the day. " +
|
"a gun loaded with 1 silver bullet! " +
|
||||||
"If you shoot at a wolf, you will intentionally miss. " +
|
"You may only use it during the day. " +
|
||||||
"If you shoot a villager, it is likely that they will be injured.")
|
"If you shoot at a wolf, you will intentionally miss. " +
|
||||||
mmsg = mmsg.format(victim)
|
"If you shoot a villager, it is likely that they will be injured.")
|
||||||
pm(cli, guntaker, mmsg)
|
mmsg = mmsg.format(victim)
|
||||||
|
pm(cli, guntaker, mmsg)
|
||||||
|
except IndexError:
|
||||||
|
pass # no wolves to give gun to (they were all killed during night or something)
|
||||||
var.GUNNERS[victim] = 0 # just in case
|
var.GUNNERS[victim] = 0 # just in case
|
||||||
|
|
||||||
for havetotem in havetotem.values():
|
for havetotem in havetotem.values():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user