Event Tokens
Posted: Sat Dec 16, 2017 8:26 pm
Alright, here's the idea for Event Tokens. They are stored in two parts for each player. The First Part stores the turn number of the most recent occurance of an event. The Second Part checks if an event has occured withinin X turns, and can be used in effects.
First Part example:
This records the latest turn a unit has won a battle.
Default stored variable would be -1.
Updated whenever the event type occurs.
The First Part is never checked by anything but Second Part event tokens, never effect requirements.
Should probably be hardcoded to existing events instead.
Second Part example:
This checks if "Unit Victory" event has occured in the past 1 turn or less.
Positive or Null value returns TRUE if First Part's stored variable is between 0 and value. (it happened within value turns)
Negative value always returns TRUE if First Part's stored variable is -1 (it never happened).
Always returns FALSE if First Part's stored variable is greater than value (it did not happen within value turns)
Effect requirements usage example:
This checks if the "Morale Boost" event token is true for this player.
Thoughts:
Events would ideally be recorded at the City level, not just Player level, where appropriate (ie building, unit, city events).
For unit-based events, the city (including special "None" for unhomed units) would be based on the unit's home city to allow for units' success or failure to affect their home cities.
IE, if a unit is killed, its home city would receive military unhappiness for a few turns, perhaps even /more/ military unhappiness than if they were just out-of-border, since no one likes their neighbors being killed. On the other hand, if a unit successfully kills an enemy unit, perhaps their military unhappiness is reduced.
Event Types:
Essentially, anything that triggers an Event Message to be sent to the player. (There are what, 140 or so of these?)
First Part example:
Code: Select all
[event_turn_unit_victory]
name = _("Unit Victory")
type = "unit_win_att"
Default stored variable would be -1.
Updated whenever the event type occurs.
The First Part is never checked by anything but Second Part event tokens, never effect requirements.
Should probably be hardcoded to existing events instead.
Second Part example:
Code: Select all
[event_bool_morale_boost]
name = _("Morale Boost")
type = "Unit Victory"
value = 1
Positive or Null value returns TRUE if First Part's stored variable is between 0 and value. (it happened within value turns)
Negative value always returns TRUE if First Part's stored variable is -1 (it never happened).
Always returns FALSE if First Part's stored variable is greater than value (it did not happen within value turns)
Effect requirements usage example:
Code: Select all
reqs =
{ "type", "name", "range"
"Event", "Morale Boost", "Player"
}
Thoughts:
Events would ideally be recorded at the City level, not just Player level, where appropriate (ie building, unit, city events).
For unit-based events, the city (including special "None" for unhomed units) would be based on the unit's home city to allow for units' success or failure to affect their home cities.
IE, if a unit is killed, its home city would receive military unhappiness for a few turns, perhaps even /more/ military unhappiness than if they were just out-of-border, since no one likes their neighbors being killed. On the other hand, if a unit successfully kills an enemy unit, perhaps their military unhappiness is reduced.
Event Types:
Essentially, anything that triggers an Event Message to be sent to the player. (There are what, 140 or so of these?)