Fix protection not working against assassin sometimes

This commit is contained in:
skizzerz 2015-07-11 12:16:50 -05:00
parent 130a859458
commit ee2a4ef2cf

View File

@ -3186,32 +3186,45 @@ def transition_day(cli, gameid=0):
# Logic out stacked kills and protections. If we get down to 1 kill remaining that is valid and the victim is in bywolves, # Logic out stacked kills and protections. If we get down to 1 kill remaining that is valid and the victim is in bywolves,
# we re-add them to onlybywolves to indicate that the other kill attempts were guarded against (and the wolf kill is what went through) # we re-add them to onlybywolves to indicate that the other kill attempts were guarded against (and the wolf kill is what went through)
# If protections >= kills, we keep track of which protection message to show (prot totem > GA > bodyguard) # If protections >= kills, we keep track of which protection message to show (prot totem > GA > bodyguard)
for v in victims_set: pl = var.list_players()
numkills = victims.count(v) for v in pl:
numtotems = var.PROTECTED.count(v) if v in victims_set:
if numtotems >= numkills: numkills = victims.count(v)
protected[v] = "totem" numtotems = var.PROTECTED.count(v)
if numtotems > numkills: if numtotems >= numkills:
for i in range(0, numtotems - numkills): protected[v] = "totem"
var.ACTIVE_PROTECTIONS[v].append("totem") if numtotems > numkills:
numkills -= numtotems for i in range(0, numtotems - numkills):
for g in var.ROLES["guardian angel"]: var.ACTIVE_PROTECTIONS[v].append("totem")
if var.GUARDED.get(g) == v: numkills -= numtotems
numkills -= 1 for g in var.ROLES["guardian angel"]:
if numkills <= 0 and v not in protected: if var.GUARDED.get(g) == v:
protected[v] = "angel" numkills -= 1
elif numkills <= 0: if numkills <= 0 and v not in protected:
protected[v] = "angel"
elif numkills <= 0:
var.ACTIVE_PROTECTIONS[v].append("angel")
for g in var.ROLES["bodyguard"]:
if var.GUARDED.get(g) == v:
numkills -= 1
if numkills <= 0 and v not in protected:
protected[v] = "bodyguard"
elif numkills <= 0:
var.ACTIVE_PROTECTIONS[v].append("bodyguard")
numkills -= 1
if numkills == 1 and v in bywolves:
onlybywolves.add(v)
else:
# player wasn't targeted, but apply protections on them
numtotems = var.PROTECTED.count(v)
for i in range(0, numtotems):
var.ACTIVE_PROTECTIONS[v].append("totem")
for g in var.ROLES["guardian angel"]:
if var.GUARDED.get(g) == v:
var.ACTIVE_PROTECTIONS[v].append("angel") var.ACTIVE_PROTECTIONS[v].append("angel")
for g in var.ROLES["bodyguard"]: for g in var.ROLES["bodyguard"]:
if var.GUARDED.get(g) == v: if var.GUARDED.get(g) == v:
numkills -= 1
if numkills <= 0 and v not in protected:
protected[v] = "bodyguard"
elif numkills <= 0:
var.ACTIVE_PROTECTIONS[v].append("bodyguard") var.ACTIVE_PROTECTIONS[v].append("bodyguard")
numkills -= 1
if numkills == 1 and v in bywolves:
onlybywolves.add(v)
fallenkills = set() fallenkills = set()
brokentotem = set() brokentotem = set()