wmllint now lifts 1.x-style abilities and specials.
This commit is contained in:
parent
2eaaac8db7
commit
0d43f5f6e9
3 changed files with 33 additions and 11 deletions
|
@ -63,7 +63,9 @@
|
|||
range=melee
|
||||
damage=7
|
||||
number=2
|
||||
special=charge
|
||||
[specials]
|
||||
{SPECIAL_CHARGE}
|
||||
[/specials]
|
||||
[/attack]
|
||||
[attack_anim]
|
||||
[attack_filter]
|
||||
|
|
|
@ -14,7 +14,9 @@
|
|||
alignment=chaotic
|
||||
advanceto=Death Knight
|
||||
cost=36
|
||||
ability=leadership
|
||||
[abilities]
|
||||
{ABILITY_LEADERSHIP_LEVEL_2}
|
||||
[/abilities]
|
||||
usage=fighter
|
||||
unit_description= _ "Sometimes the mightiest warriors and generals, cursed with hate and angst, came back to this world as Death Knights. Death Squires serve them whilst accruing enough unholy power to become Death Knights. In the process they pick up a good deal of the Knight's power, including the ability to command underlings."
|
||||
get_hit_sound=skeleton-hit.wav
|
||||
|
|
|
@ -802,18 +802,36 @@ def hack_syntax(filename, lines):
|
|||
if in_sound:
|
||||
lines[i] = ""
|
||||
# Upconvert ancient ability declarations from 1.x
|
||||
converting = False
|
||||
level = None
|
||||
abilities = []
|
||||
specials = []
|
||||
lastability = None
|
||||
# TODO: special=plague(unitname) -> {WEAPON_SPECIAL_PLAGUE_TYPE unitype}
|
||||
# TODO: special=plague -> {WEAPON_SPECIAL_PLAGUE}
|
||||
lastspecial = None
|
||||
for i in range(len(lines)):
|
||||
if "no-syntax-rewrite" in lines[i]:
|
||||
break
|
||||
if "[unit]" in lines[i]:
|
||||
abilities = []
|
||||
converting = True
|
||||
if "[attack]" in lines[i]:
|
||||
specials = []
|
||||
elif "[/attack]" in lines[i]:
|
||||
if specials:
|
||||
if verbose:
|
||||
print "Lifting obsolete specials:", " ".join(specials)
|
||||
ws = leader(lines[i])
|
||||
insertion = ws + baseindent + "[specials]\n"
|
||||
for special in specials:
|
||||
if special.startswith("plague("):
|
||||
insertion += ws + baseindent*2 + "{SPECIAL_PLAGUE_TYPE " + special[7:-1] + "}\n"
|
||||
elif special in ("backstab", "berserk", "charge", "drain",
|
||||
"firstrtrike", "magical", "plague",
|
||||
"poison", "slow", "stone", "swarm",):
|
||||
insertion += ws + baseindent*2 + "{SPECIAL_" + special.upper() + "}\n"
|
||||
else:
|
||||
print "Don't know how to convert '%s'" % special
|
||||
insertion += ws + baseindent + "[/specials]\n"
|
||||
lines[lastspecial] = insertion
|
||||
modcount += 1
|
||||
elif "[/unit]" in lines[i]:
|
||||
if abilities:
|
||||
if verbose:
|
||||
|
@ -829,13 +847,12 @@ def hack_syntax(filename, lines):
|
|||
elif ability in ("cures", "heals", "regenerates",
|
||||
"skirmisher", "illuminates",
|
||||
"teleport", "ambush",):
|
||||
insertion += ws + baseindent*2 + "{ABILITY_" + + "}\n"
|
||||
insertion += ws + baseindent*2 + "{ABILITY_" + ability.upper() + "}\n"
|
||||
else:
|
||||
print "Don't know how to convert '%d'" % ability
|
||||
print "Don't know how to convert '%s'" % ability
|
||||
insertion += ws + baseindent + "[/abilities]\n"
|
||||
lines[lastability] = insertion
|
||||
modcount += 1
|
||||
converting = False
|
||||
elif lines[i].count("=") == 1:
|
||||
(tag, value) = lines[i].strip().split("=")
|
||||
if tag == "level":
|
||||
|
@ -845,8 +862,9 @@ def hack_syntax(filename, lines):
|
|||
lastability = i
|
||||
lines[i] = ""
|
||||
if tag == "special":
|
||||
print "%s, line %d, %s: can't translate 1.x-style specials" \
|
||||
% (filename, i+1, `lines[i].strip()`)
|
||||
specials.append(value)
|
||||
lastspecial = i
|
||||
lines[i] = ""
|
||||
# Upconvert old radius usage
|
||||
if "1.3.7" in versions and "older" not in versions:
|
||||
radius_pos = wmlfind("radius=", WmlIterator(lines, filename))
|
||||
|
|
Loading…
Add table
Reference in a new issue