Refactor mainline code to not rely on [unit]side defaulting to 1,

...and to not use [unit] within [side].
This commit is contained in:
Eric S. Raymond 2010-01-14 02:07:25 +00:00
parent 767c75358a
commit b2f788e240
9 changed files with 106 additions and 91 deletions

View file

@ -82,8 +82,9 @@
caution=0.0
[/ai]
#give the skeletal dragon something to do when there are no enemies available
#let it look like it's wandering around semi-randomly
#give the skeletal dragon something to do when there are no
#enemies available let it look like it's wandering around
#semi-randomly
[ai]
[leader_goal]
x,y=14,10
@ -120,14 +121,6 @@
[/leader_goal]
time_of_day=second_watch
[/ai]
[unit]
type="Skeletal Dragon"
id="Khrakrahs"
name= _ "Khrakrahs"
x=28
y=23
canrecruit=yes
[/unit]
[/side]
[event]
@ -154,6 +147,16 @@
note={EARLY_FINISH_BONUS_NOTE}+{NEW_GOLD_CARRYOVER_NOTE_40}
[/objectives]
[unit]
type="Skeletal Dragon"
id="Khrakrahs"
name= _ "Khrakrahs"
side=3
x=28
y=23
canrecruit=yes
[/unit]
# Note: the code for the ambushers is mostly identical to that of
# Crossroads in HttT.

View file

@ -815,6 +815,7 @@
y=40
id=Delfador
type=Elder Mage
side=1
profile=portraits/delfador.png
name= _ "Delfador"
unrenamable=yes

View file

@ -100,16 +100,6 @@
shroud=yes
share_view=yes
gold=0
[unit]
type="Orcish Slayer"
id=Urudin
name= _ "Urudin"
canrecruit=yes
x=19
y=11
hitpoints=45
max_hitpoints=45
[/unit]
recruit=""
[ai]
version=10703
@ -129,6 +119,7 @@
[/ai]
[/side]
# wmllint: recognize Urudin
[event]
name=last breath
[filter]
@ -154,14 +145,6 @@
fog=yes
shroud=yes
share_view=yes
[unit]
type=Orcish Warlord
id=Murudin
name= _ "Murudin"
canrecruit=yes
x=1
y=10
[/unit]
#ifdef EASY
recruit=Orcish Archer, Orcish Assassin, Orcish Grunt, Wolf Rider, Orcish Crossbowman, Goblin Knight, Goblin Pillager, Goblin Spearman
#endif
@ -194,15 +177,6 @@
shroud=yes
fog=yes
share_view=yes
[unit]
type=Orcish Warlord
id=Mutaf-uru
name= _ "Mutaf-uru"
profile=portraits/orcs/warlord3.png
canrecruit=yes
x=7
y=2
[/unit]
#ifdef EASY
recruit={ORCS1}, Orcish Crossbowman, Goblin Pillager, Goblin Knight
#endif
@ -225,6 +199,8 @@
{MODIFY_AI_ADD_CANDIDATE_ACTION 5 main_loop {AI_CA_POISONING}}
[/ai]
[/side]
# wmllint: recognize Mutaf-uru
[event]
name=last breath
[filter]
@ -318,6 +294,36 @@
name=prestart
{VARIABLE orc_reserve_used no}
{VARIABLE orc_battlefield_strategy 'wait'}
[unit]
type="Orcish Slayer"
id=Urudin
name= _ "Urudin"
side=3
canrecruit=yes
x=19
y=11
hitpoints=45
max_hitpoints=45
[/unit]
[unit]
type=Orcish Warlord
id=Murudin
name= _ "Murudin"
side=4
canrecruit=yes
x=1
y=10
[/unit]
[unit]
type=Orcish Warlord
id=Mutaf-uru
name= _ "Mutaf-uru"
profile=portraits/orcs/warlord3.png
side=5
canrecruit=yes
x=7
y=2
[/unit]
[/event]
[event]

View file

@ -138,6 +138,7 @@
type=Dwarvish Lord
id=Hamel
name= _ "Hamel"
side=1
profile=portraits/Hamel.png
# This nice macro gives the unit silver crown.
{IS_HERO}

View file

@ -151,6 +151,7 @@
type=Dwarvish Lord
id=Durstorn
name= _ "Durstorn"
side=1
{IS_HERO}
profile=portraits/durstorn.png
random_traits=no
@ -163,6 +164,7 @@
type=Dwarvish Thunderguard
id=Noiraran
name= _ "Noiraran"
side=1
[modifications]
{TRAIT_LOYAL}
{TRAIT_INTELLIGENT}
@ -174,6 +176,7 @@
type=Dwarvish Steelclad
id=Kuhnar
name= _ "Kuhnar"
side=1
[modifications]
{TRAIT_LOYAL}
{TRAIT_QUICK}

View file

@ -35,31 +35,6 @@
{EXTRA_SCENARIO_MUSIC "breaking_the_chains.ogg"}
{EXTRA_SCENARIO_MUSIC "siege_of_laurelmor.ogg"}
[event]
name=prestart
[objectives]
side=1
[objective]
description= _ "Defeat Slowhand and Harman"
condition=win
[/objective]
[objective]
description= _ "Death of Kapou'e"
condition=lose
[/objective]
[objective]
description= _ "Death of Grüü"
condition=lose
[/objective]
[objective]
description= _ "Turns run out"
condition=lose
[/objective]
note={EARLY_FINISH_BONUS_NOTE}+{NEW_GOLD_CARRYOVER_NOTE_40}
[/objectives]
[/event]
[side]
type=Orcish Leader
id="Kapou'e"
@ -133,14 +108,6 @@
team_name=Kapoue
user_team_name=_ "Kapou'e"
no_leader=yes
[unit]
type=Orcish Warrior
id=Affman
name= _ "Affman"
x,y=27,20
random_traits=yes
[/unit]
[/side]
[story]
@ -168,6 +135,37 @@
x=6
y=9
[/unit]
[unit]
type=Orcish Warrior
id=Affman
name= _ "Affman"
side=5
x,y=27,20
random_traits=yes
[/unit]
[objectives]
side=1
[objective]
description= _ "Defeat Slowhand and Harman"
condition=win
[/objective]
[objective]
description= _ "Death of Kapou'e"
condition=lose
[/objective]
[objective]
description= _ "Death of Grüü"
condition=lose
[/objective]
[objective]
description= _ "Turns run out"
condition=lose
[/objective]
note={EARLY_FINISH_BONUS_NOTE}+{NEW_GOLD_CARRYOVER_NOTE_40}
[/objectives]
[/event]
[event]

View file

@ -54,27 +54,6 @@
controller=human
shroud=yes
fog=no
# Start with Nym
[unit]
type=Nym Hunter
id=Nym
name= _ "Nym"
x=27
y=22
unrenamable=yes
[modifications]
{TRAIT_LOYAL}
#ifndef HARD
{TRAIT_RESILIENT}
#ifdef EASY
{TRAIT_QUICK}
#endif
#endif
[/modifications]
{IS_HERO}
[/unit]
[/side]
# Monster side : mudcrawlers and cuttlefish
@ -152,6 +131,26 @@
note={EARLY_FINISH_BONUS_NOTE}+{NEW_GOLD_CARRYOVER_NOTE_40}
[/objectives]
# Start with Nym
[unit]
type=Nym Hunter
id=Nym
name= _ "Nym"
side=1
x=27
y=22
unrenamable=yes
[modifications]
{TRAIT_LOYAL}
#ifndef HARD
{TRAIT_RESILIENT}
#ifdef EASY
{TRAIT_QUICK}
#endif
#endif
[/modifications]
{IS_HERO}
[/unit]
# There are 3 mudcrawler encounter spots, in the NW and SW corner
# and in the barracks. Depending on which way you circle around
# the village, you will encounter the NW or barracks first.

View file

@ -976,6 +976,7 @@
type=Dust Devil
id=Dust Devil
name=_"Dust Devil"
side=1
[modifications]
{TRAIT_LOYAL}
[/modifications]

View file

@ -497,6 +497,9 @@ def validate_on_pop(tagstack, closer, filename, lineno):
if closer == "terrain" and attributes.get("heals") in ("true", "false"):
print '"%s", line %d: heals attribute no longer takes a boolean' % \
(filename, lineno)
if closer == "unit" and attributes.get("id") is not None and attributes.get("type") is not None and attributes.get("side") is None:
print '"%s", line %d: unit declaration without side attribute' % \
(filename, lineno)
def within(tag):
"Did the specified tag lead one of our enclosing contexts?"