Show accuracy/parry as weapon specials in html, fixes #7895 (#8259)

This commit is contained in:
Toom 2024-01-18 23:01:53 +02:00 committed by GitHub
parent df359880e4
commit c3bc1f3bbe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -957,9 +957,15 @@ class HTMLOutput:
sname = T(special, "name")
if sname:
s.append(sname)
accuracy = attack.get_text_val("accuracy", default="0")
parry = attack.get_text_val("parry", default="0")
if accuracy != "0":
s.append("accuracy "+accuracy+"%")
if parry != "0":
s.append("parry "+parry+"%")
if s:
s = ", ".join(s)
if s:
write(" (%s)" % cleantext(s, quote=False))
write(" (%s)" % cleantext(s, quote=False))
write('</div>')
write('</div>')
@ -1235,6 +1241,12 @@ class HTMLOutput:
else:
error_message("Warning: Weapon special %s has no name for %s.\n" %
(special.name.decode("utf8"), uid))
accuracy = attack.get_text_val("accuracy", default="0")
parry = attack.get_text_val("parry", default="0")
if accuracy != "0":
s.append(cleantext("accuracy "+accuracy+"%"))
if parry != "0":
s.append(cleantext("parry "+parry+"%"))
if s:
write('<td>(%s)</td>' % ', '.join(s))
write('</tr>')