From 216443b91032191cb789138412a21882942e7a53 Mon Sep 17 00:00:00 2001 From: Elias Pschernig Date: Sun, 11 Mar 2012 23:24:53 +0000 Subject: [PATCH] [wmlunits] Treat negative defense values as if they were positive. --- data/tools/unit_tree/html_output.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/data/tools/unit_tree/html_output.py b/data/tools/unit_tree/html_output.py index 95380fa055e..d3812139811 100644 --- a/data/tools/unit_tree/html_output.py +++ b/data/tools/unit_tree/html_output.py @@ -992,7 +992,13 @@ class HTMLOutput: not_from_race, d = find_attr("defense", tid) if d == "-": d = 100 - try: d = "%d%%" % (100 - int(d)) + + try: + d = int(d) + # negative defense has something to do with best defense if + # there's multiple terrain types + if d < 0: d = -d + d = "%d%%" % (100 - d) except ValueError: error_message("Warning: Invalid defense %s for %s.\n" % ( d, uid))