Allow state labels in not clauses.
This commit is contained in:
parent
6fe8f98b35
commit
ed4e6ad422
2 changed files with 31 additions and 17 deletions
|
@ -59,7 +59,8 @@
|
||||||
# [pct, N] Roll a die, n% chance of success
|
# [pct, N] Roll a die, n% chance of success
|
||||||
# [carry, OBJ] Must be carrying named object
|
# [carry, OBJ] Must be carrying named object
|
||||||
# [with, OBJ] Must be carrying or in room with
|
# [with, OBJ] Must be carrying or in room with
|
||||||
# [not, OBJ N] Property of named OBJ must not be N
|
# [not, OBJ N] Property of named OBJ must not be N.
|
||||||
|
# N may be numeric or a state label.
|
||||||
# All attributes are optional except the long description and
|
# All attributes are optional except the long description and
|
||||||
# travel. Order of locations is not significant.
|
# travel. Order of locations is not significant.
|
||||||
#
|
#
|
||||||
|
@ -92,8 +93,9 @@
|
||||||
# it can be accessed from above or below). An object may also be
|
# it can be accessed from above or below). An object may also be
|
||||||
# flagged immovable, meaning it cannot be carried. If a state
|
# flagged immovable, meaning it cannot be carried. If a state
|
||||||
# message is a tuple then the first element is made the name of a
|
# message is a tuple then the first element is made the name of a
|
||||||
# #define visble to the code for the associated state, numbered
|
# #define visible to the code for the associated state, numbered
|
||||||
# from zero upwards. If the inventory description begins with "*"
|
# from zero upwards; it is also a state label that can be used in
|
||||||
|
# travel-rule 'not' clauses. If the inventory description begins with "*"
|
||||||
# the object is dungeon furniture that cannot be taken or carried.
|
# the object is dungeon furniture that cannot be taken or carried.
|
||||||
#
|
#
|
||||||
# obituaries: Death messages and reincarnation queries. Order is
|
# obituaries: Death messages and reincarnation queries. Order is
|
||||||
|
@ -790,7 +792,7 @@ locations: !!omap
|
||||||
{verbs: ['WEST'], action: [goto, LOC_FOREST9]},
|
{verbs: ['WEST'], action: [goto, LOC_FOREST9]},
|
||||||
{verbs: ['BUILD'], action: [goto, LOC_START]},
|
{verbs: ['BUILD'], action: [goto, LOC_START]},
|
||||||
{verbs: ['UPSTR', 'GULLY', 'NORTH'], action: [goto, LOC_SLIT]},
|
{verbs: ['UPSTR', 'GULLY', 'NORTH'], action: [goto, LOC_SLIT]},
|
||||||
{verbs: ['ENTER', 'INWAR', 'D'], cond: [not, GRATE, 0,], action: [goto, LOC_BELOWGRATE]},
|
{verbs: ['ENTER', 'INWAR', 'D'], cond: [not, GRATE, GRATE_CLOSED], action: [goto, LOC_BELOWGRATE]},
|
||||||
{verbs: ['ENTER'], action: ["speak", GRATE_NOWAY]},
|
{verbs: ['ENTER'], action: ["speak", GRATE_NOWAY]},
|
||||||
]
|
]
|
||||||
- LOC_BELOWGRATE:
|
- LOC_BELOWGRATE:
|
||||||
|
@ -799,7 +801,7 @@ locations: !!omap
|
||||||
short: 'You''re below the grate.'
|
short: 'You''re below the grate.'
|
||||||
conditions: {LIT: true}
|
conditions: {LIT: true}
|
||||||
travel: [
|
travel: [
|
||||||
{verbs: ['OUT', 'UPWAR'], cond: [not, GRATE, 0], action: [goto, LOC_GRATE]},
|
{verbs: ['OUT', 'UPWAR'], cond: [not, GRATE, GRATE_CLOSED], action: [goto, LOC_GRATE]},
|
||||||
{verbs: ['OUT'], action: ["speak", GRATE_NOWAY]},
|
{verbs: ['OUT'], action: ["speak", GRATE_NOWAY]},
|
||||||
{verbs: ['CRAWL', 'COBBL', 'INWAR', 'WEST'], action: [goto, LOC_COBBLE]},
|
{verbs: ['CRAWL', 'COBBL', 'INWAR', 'WEST'], action: [goto, LOC_COBBLE]},
|
||||||
{verbs: ['PIT'], action: [goto, LOC_PITTOP]},
|
{verbs: ['PIT'], action: [goto, LOC_PITTOP]},
|
||||||
|
@ -821,7 +823,7 @@ locations: !!omap
|
||||||
short: 'You''re in debris room.'
|
short: 'You''re in debris room.'
|
||||||
conditions: {}
|
conditions: {}
|
||||||
travel: [
|
travel: [
|
||||||
{verbs: ['DEPRE'], cond: [not, GRATE, 0], action: [goto, LOC_GRATE]},
|
{verbs: ['DEPRE'], cond: [not, GRATE, GRATE_CLOSED], action: [goto, LOC_GRATE]},
|
||||||
{verbs: ['ENTRA'], action: [goto, LOC_BELOWGRATE]},
|
{verbs: ['ENTRA'], action: [goto, LOC_BELOWGRATE]},
|
||||||
{verbs: ['CRAWL', 'COBBL', 'PASSA', 'LOW', 'EAST'], action: [goto, LOC_COBBLE]},
|
{verbs: ['CRAWL', 'COBBL', 'PASSA', 'LOW', 'EAST'], action: [goto, LOC_COBBLE]},
|
||||||
{verbs: ['CANYO', 'INWAR', 'UPWAR', 'WEST'], action: [goto, LOC_AWKWARD]},
|
{verbs: ['CANYO', 'INWAR', 'UPWAR', 'WEST'], action: [goto, LOC_AWKWARD]},
|
||||||
|
@ -834,7 +836,7 @@ locations: !!omap
|
||||||
short: !!null
|
short: !!null
|
||||||
conditions: {}
|
conditions: {}
|
||||||
travel: [
|
travel: [
|
||||||
{verbs: ['DEPRE'], cond: [not, GRATE, 0], action: [goto, LOC_GRATE]},
|
{verbs: ['DEPRE'], cond: [not, GRATE, GRATE_CLOSED], action: [goto, LOC_GRATE]},
|
||||||
{verbs: ['ENTRA'], action: [goto, LOC_BELOWGRATE]},
|
{verbs: ['ENTRA'], action: [goto, LOC_BELOWGRATE]},
|
||||||
{verbs: ['D', 'EAST', 'DEBRI'], action: [goto, LOC_DEBRIS]},
|
{verbs: ['D', 'EAST', 'DEBRI'], action: [goto, LOC_DEBRIS]},
|
||||||
{verbs: ['INWAR', 'UPWAR', 'WEST'], action: [goto, LOC_BIRD]},
|
{verbs: ['INWAR', 'UPWAR', 'WEST'], action: [goto, LOC_BIRD]},
|
||||||
|
@ -847,7 +849,7 @@ locations: !!omap
|
||||||
conditions: {}
|
conditions: {}
|
||||||
hints: [*bird]
|
hints: [*bird]
|
||||||
travel: [
|
travel: [
|
||||||
{verbs: ['DEPRE'], cond: [not, GRATE, 0], action: [goto, LOC_GRATE]},
|
{verbs: ['DEPRE'], cond: [not, GRATE, GRATE_CLOSED], action: [goto, LOC_GRATE]},
|
||||||
{verbs: ['ENTRA'], action: [goto, LOC_BELOWGRATE]},
|
{verbs: ['ENTRA'], action: [goto, LOC_BELOWGRATE]},
|
||||||
{verbs: ['DEBRI'], action: [goto, LOC_DEBRIS]},
|
{verbs: ['DEBRI'], action: [goto, LOC_DEBRIS]},
|
||||||
{verbs: ['CANYO', 'EAST'], action: [goto, LOC_AWKWARD]},
|
{verbs: ['CANYO', 'EAST'], action: [goto, LOC_AWKWARD]},
|
||||||
|
@ -859,7 +861,7 @@ locations: !!omap
|
||||||
short: 'You''re at top of small pit.'
|
short: 'You''re at top of small pit.'
|
||||||
conditions: {}
|
conditions: {}
|
||||||
travel: [
|
travel: [
|
||||||
{verbs: ['DEPRE'], cond: [not, GRATE, 0], action: [goto, LOC_GRATE]},
|
{verbs: ['DEPRE'], cond: [not, GRATE, GRATE_CLOSED], action: [goto, LOC_GRATE]},
|
||||||
{verbs: ['ENTRA'], action: [goto, LOC_BELOWGRATE]},
|
{verbs: ['ENTRA'], action: [goto, LOC_BELOWGRATE]},
|
||||||
{verbs: ['DEBRI'], action: [goto, LOC_DEBRIS]},
|
{verbs: ['DEBRI'], action: [goto, LOC_DEBRIS]},
|
||||||
{verbs: ['PASSA', 'EAST'], action: [goto, LOC_BIRD]},
|
{verbs: ['PASSA', 'EAST'], action: [goto, LOC_BIRD]},
|
||||||
|
@ -897,9 +899,9 @@ locations: !!omap
|
||||||
conditions: {DEEP: true}
|
conditions: {DEEP: true}
|
||||||
travel: [
|
travel: [
|
||||||
{verbs: ['HALL', 'EAST'], action: [goto, LOC_MISTHALL]},
|
{verbs: ['HALL', 'EAST'], action: [goto, LOC_MISTHALL]},
|
||||||
{verbs: ['JUMP'], cond: [not, FISSURE, 0], action: ["speak", CROSS_BRIDGE]},
|
{verbs: ['JUMP'], cond: [not, FISSURE, UNBRIDGED], action: ["speak", CROSS_BRIDGE]},
|
||||||
{verbs: ['FORWA'], cond: [not, FISSURE, 1], action: [goto, LOC_NOMAKE]},
|
{verbs: ['FORWA'], cond: [not, FISSURE, BRIDGED], action: [goto, LOC_NOMAKE]},
|
||||||
{verbs: ['OVER', 'ACROS', 'WEST', 'CROSS'], cond: [not, FISSURE, 1], action: ["speak", NO_CROSS]},
|
{verbs: ['OVER', 'ACROS', 'WEST', 'CROSS'], cond: [not, FISSURE, BRIDGED], action: ["speak", NO_CROSS]},
|
||||||
{verbs: ['OVER'], action: [goto, LOC_WESTBANK]},
|
{verbs: ['OVER'], action: [goto, LOC_WESTBANK]},
|
||||||
]
|
]
|
||||||
- LOC_NUGGET:
|
- LOC_NUGGET:
|
||||||
|
@ -2226,7 +2228,7 @@ locations: !!omap
|
||||||
conditions: {DEEP: true}
|
conditions: {DEEP: true}
|
||||||
travel: [
|
travel: [
|
||||||
{verbs: ['NORTH', 'OUT'], action: [goto, LOC_DIFFERENT2]},
|
{verbs: ['NORTH', 'OUT'], action: [goto, LOC_DIFFERENT2]},
|
||||||
{verbs: ['SOUTH'], cond: [not, VEND, 0], action: [goto, LOC_ROUGHHEWN]},
|
{verbs: ['SOUTH'], cond: [not, VEND, VEND_BLOCKS], action: [goto, LOC_ROUGHHEWN]},
|
||||||
{verbs: ['SOUTH'], action: [goto, LOC_BADDIRECTION]},
|
{verbs: ['SOUTH'], action: [goto, LOC_BADDIRECTION]},
|
||||||
]
|
]
|
||||||
- LOC_ROUGHHEWN:
|
- LOC_ROUGHHEWN:
|
||||||
|
@ -3098,9 +3100,9 @@ objects: !!omap
|
||||||
locations: [LOC_EASTBANK, LOC_WESTBANK]
|
locations: [LOC_EASTBANK, LOC_WESTBANK]
|
||||||
immovable: true
|
immovable: true
|
||||||
longs:
|
longs:
|
||||||
- ''
|
- [UNBRIDGED, '']
|
||||||
- 'A crystal bridge now spans the fissure.'
|
- [BRIDGED, 'A crystal bridge now spans the fissure.']
|
||||||
- 'The crystal bridge has vanished!'
|
- [VANISHED, 'The crystal bridge has vanished!']
|
||||||
- OBJ_13:
|
- OBJ_13:
|
||||||
words: ['table']
|
words: ['table']
|
||||||
inventory: '*stone tablet'
|
inventory: '*stone tablet'
|
||||||
|
|
|
@ -548,7 +548,19 @@ def buildtravel(locs, objs, voc):
|
||||||
elif cond[0] == "not":
|
elif cond[0] == "not":
|
||||||
# FIXME: Allow named as well as numbered states
|
# FIXME: Allow named as well as numbered states
|
||||||
try:
|
try:
|
||||||
return 300 + objnames.index(cond[1]) + 100 * cond[2]
|
obj = objnames.index(cond[1])
|
||||||
|
if type(cond[2]) == int:
|
||||||
|
state = cond[2]
|
||||||
|
else:
|
||||||
|
for (i, stateclause) in enumerate(objs[obj][1]["longs"]):
|
||||||
|
if type(stateclause) == list:
|
||||||
|
if stateclause[0] == cond[2]:
|
||||||
|
state = i
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
sys.stderr.write("dungeon: unmatched state symbol %s in not caluase of %s\n" % (cond[2], name))
|
||||||
|
sys.exit(0);
|
||||||
|
return 300 + obj + 100 * state
|
||||||
except ValueError:
|
except ValueError:
|
||||||
sys.stderr.write("dungeon: unknown object name %s in not clause of %s\n" % (cond[1], name))
|
sys.stderr.write("dungeon: unknown object name %s in not clause of %s\n" % (cond[1], name))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue