A round of fixes for recruitment-pattern mismatches.

This commit is contained in:
Eric S. Raymond 2008-11-26 15:37:38 +00:00
parent 5cb04c355b
commit c570337316
9 changed files with 29 additions and 15 deletions

View file

@ -67,11 +67,7 @@
recruit=Vampire Bat,Walking Corpse,Dark Adept
#endif
[ai]
#ifdef HARD
recruitment_pattern=fighter,fighter,fighter,fighter,fighter,fighter,fighter,archer
#else
recruitment_pattern=scout,fighter,fighter,fighter,fighter,fighter,fighter,fighter,archer
#endif
grouping=no
aggression=1.0
caution=-1.0

View file

@ -104,10 +104,10 @@
#she's a smart leader and thinks deeply
{ATTACK_DEPTH 4 5 5}
#ifdef EASY
recruitment_pattern=scout,mixed fighter,fighter,fighter
recruitment_pattern=scout,mixed fighter,fighter,fighter,archer
#endif
#ifdef NORMAL
recruitment_pattern=scout,mixed fighter,fighter,fighter
recruitment_pattern=scout,mixed fighter,fighter,fighter,archer
#endif
#ifdef HARD
recruitment_pattern=scout,mixed fighter,fighter,fighter,fighter,archer

View file

@ -128,10 +128,10 @@
{GOLD 200 400 600}
[ai]
#ifdef EASY
recruitment_pattern=fighter
recruitment_pattern=scout,fighter
#endif
#ifdef NORMAL
recruitment_pattern=fighter
recruitment_pattern=fighter,scout
#endif
#ifdef HARD
recruitment_pattern=fighter,fighter,fighter,scout

View file

@ -138,9 +138,9 @@
passive_leader=yes
simple_targetting=yes
#ifndef HARD
recruitment_pattern=scout,fighter,fighter,mixed fighter
recruitment_pattern=scout,fighter,fighter,mixed fighter,archer
#else
recruitment_pattern=scout,fighter,fighter,mixed fighter,healer
recruitment_pattern=scout,fighter,fighter,mixed fighter,healer,archer
#endif
villages_per_scout=0
village_value=0

View file

@ -65,7 +65,7 @@
canrecruit=yes
controller=ai
#ifdef EASY
recruit=Troll Rocklobber,Troll Whelp,
recruit=Troll Rocklobber,Troll Whelp
#else
recruit=Troll,Troll Rocklobber, Troll Warrior
#endif

View file

@ -64,7 +64,7 @@
#endif
#ifdef NORMAL
recruitment_pattern=fighter,mixed fighter,archer,fighter
recruitment_pattern=fighter,mixed fighter,archer,scout,fighter
#endif
#ifdef HARD

View file

@ -82,7 +82,7 @@
#endif
#ifdef NORMAL
recruitment_pattern=scout,scout,fighter,fighter,fighter
recruitment_pattern=scout,scout,fighter,fighter,fighter,archer
#endif
#ifdef HARD

View file

@ -128,7 +128,7 @@
user_team_name=_"Enemies"
#ifdef EASY
recruit=Dwarvish Fighter, Dwarvish Steelclad, Dwarvish Thunderer, Dwarvish Berserker, Dwarvish Thunderguard, Dwarvish Guardsman, Dwarvish Pathfinder,
recruit=Dwarvish Fighter, Dwarvish Steelclad, Dwarvish Thunderer, Dwarvish Berserker, Dwarvish Thunderguard, Dwarvish Guardsman, Dwarvish Pathfinder
#endif
#ifdef NORMAL

View file

@ -703,6 +703,24 @@ def sanity_check(filename, lines):
lines = [lines[w-1].lstrip()] + lines[:w-1] + lines[w:]
return lines
def condition_match(p, q):
"Do two condition-states match?"
# The empty condition state is represented by None
if p is None or q is None or (p == q):
return True
# Past this point it's all about handling cases with negation
sp = p
np = False
if sp.startswith("!"):
sp = sp[1:]
np = True
sq = q
nq = False
if sq.startswith("!"):
sq = sp[1:]
nq == True
return (sp != sq) and (np != nq)
def consistency_check():
"Consistency-check state information picked up by sanity_check"
#utypes = {}
@ -722,7 +740,7 @@ def consistency_check():
continue
utype = usage[rtype]
for (pdifficulty, (pl, recruit_pattern)) in patterndict.items():
if pdifficulty is None or rdifficulty is None or pdifficulty == rdifficulty or ((rdifficulty[0]=="!") == ((pdifficulty[0]=="!"))):
if condition_match(pdifficulty, rdifficulty):
#utypes[rdifficulty].append(utype)
if utype not in recruit_pattern:
rshow = ''