I'm trying to implement a mechanic in a turn based game, and deciding when in the turn order a status effect's duration gets decremented.
Background:
Game is turn based, where there are two opposing players. Each player controls a small fixed amount of characters.
On each turn, the current player submits all their actions.
Then after the actions' calculations, it would be the other player's turn.
Problem:
When does status's duration get decreased?
- End of turn
- Start of turn
- Trigger effect on end of turn, but decrease duration on start of turn?
- etc.
Below are some example scenarios, decreasing duration at end of turn.
Say I want to apply a status effect to a target such as poison, barrier (absorbs damage), stun. All these status effects have a duration of 1 turn.
Now, when does this status's duration get decreased when applied?
Consider different scenarios:
3a. If PlayerA.unitA, applies poison to PlayerA.unitB, then at the end of PlayerA's turn then the status effect will reduce PlayerA.unitA's hp, and the status will get removed
3b. If PlayerA.unitA. applies barrier to PlayerA.unitB, then at the end of PlayerA's turn it wouldn't be expected to remove the status barrier, because it hasn't even gotten an opportunity to take effect. Because the opponent's turn hasn't even started yet.
So, both status have a duration of 1. But poison is ok to be removed after PlayerA's turn. But same flow can't be applied to barrier.
The solution should be also neatly applicable to other side. Where PlayerA's units, targets PlayerB's units.