* closed door -> (open) -> open door
* closed door -> (bash) -> (open door or broken door)
* repeat above for locked and jammed doors
* most walls -> (tunnel) -> no terrain
* curtain -> (open or move) -> opened curtain
This kind of thing makes me want to encode the valid state transitions into the terrain record. The main problem here is that many of the transitions have a difficulty rating and/or a progress value, or may generate items when completed (for treasure veins or rubble), or the like. So there's a lot of complexity here.
It seems clear I should be trying to leverage the proc/effect code here somehow. Procs are stateful, so I could handle progress that way. That still leaves me with the problem of how to represent all this in the records, though. And I really can't see a way I can avoid having a separate entry for each of normal, locked, and jammed doors, for example...
(Note that I'm omitting a bunch of stuff like visibility/walkability/etc. flags, and display info, for the sake of brevity)
Code:
{
"name": "granite wall",
"interactions": (
{
"action": "tunnel",
"procs": ({"name": "tunnelWall", "difficulty": 1000})
}
)
},
{
"name": "quartz vein",
"interactions": (
{
"action": "tunnel",
"procs": ({"name": "tunnelWall", "difficulty": "200})
)
}
)
},
{
"name": "quartz vein with treasure",
"ancestor": "quartz vein",
"interactions": (
{
"action": "tunnel",
"postProcs": ({"name": "dropTreasure", "amount": "10+5d10M800"})
}
)
},
{
"name": "door",
"interactions": (
{
"action": "open",
"procs": ({"name": "replaceTerrain", "replacement": "open door"})
},
{
"action": "bash",
"procs": ({"name": "bashDoor", "difficulty": "1+M10"},
{"name": "replaceTerrain", "replacement": "broken door"}
)
}
)
},
{
"name": "locked door",
"ancestor": "door",
"interactions": (
{
"action": "open",
"preProcs": ({"name": "unlockDoor", "difficulty": "1+M10"})
}
)
}
This is pretty verbose, and it doesn't let you bash a door and end up with a non-broken door afterwords. And I'm not certain that the execution-chain system is going to handle all the different use cases I can think of.
Leave a comment: