Zomis / Games

Many kinds of games, playable in both multiplayer or local play. Replays, spectator mode, and AIs.
https://games.zomis.net
MIT License
17 stars 5 forks source link

Interjection of steps #318

Closed Zomis closed 1 year ago

Zomis commented 2 years ago

It would be useful to have a feature that can insert temporary steps after a step is done.

Basically every action that has some kind of "when you do this (or whenever X happens), choose Y, do Z".

Or also potentially "take an extra turn after this one"

class TemporaryStep: Step {
    override fun step() {
        nextStep = originalNextStep // Can be changed to insert another step (and another, and another...) before returning to the original next step. This `originalNextStep` can be passed onward to other steps to make them later return to it. (Or will they just do so by default anyway?)
        // Can set some kind of repeat condition. Or use `nextStep = this`?
        // Can have yieldAction and all the other things that a step can have.
    }
}

And then an action has something like:

perform {
    interjectStep(TemporaryStep())
}