Hey Rom,
When the game is going to run an event, the flow looks something like this:
- The game looks at each event that is valid to run. (An event that has already run and has repeat="false" will not be considered.)
- In each of those events, the game looks at each <condition> it contains. If an event has no conditions, it will not be picked to run.[sub]1[sub]
- Each <condition> is evaluated either as success or fail. Based on that, we alter the event's Score, Priority, and Multiplier.
- Any changes to an event's Score are additive to the event's total Score.
- Any changes to an event's Multiplier are multiplicative to an event's total Multiplier.
- We take the highest Priority set in any of that event's conditions as its final Priority.
- Once the system has evaluated all legal events, we take only the ones with the highest Priority. I.e., if we have three events with Pri 1, two with Pri 4, and one with Pri 10, we will discard all of them from consideration except the Pri 10.
- The game multiplies the Score of the event by the Multiplier value.
- The game adds up all the scores together, picks a random number that falls in them, and takes that event to run.
Scoring examples:
<conditions>
<!-- CONDITIONS -->
<condition type="ActionCondition" action="rule">
<failCondition multiplier = "0.0"/>
<successCondition priority="1.0" score="5.0"/>
</condition>
</conditions>
The above is the current condition set for rule_willofthepeople. It examines if we are asking for an event because a hero took the Rule action.
If we are in a Rule action, we set the event's Priority to 1 and add 5 to the Score. Since the Score starts at zero, it is now 5. Multiplier is defaulted to 1. This event, in this case, would evaluate to a Priority of 1 and a total Score of 5.
If we are -not- in a Rule action, we simply set the Multiplier to zero. Priority is defaulted to 1 and Score to 0. In this case the event would evaluate to a Priority of 1 and a Score of 0 (Base unaltered Score of 0 times a multiplier of 0).
<conditions>
<!-- CONDITIONS -->
<condition type="ActionCondition" action="endofturn">
<failCondition multiplier="0.0"/>
<successCondition priority="1.0" score="2.0"/>
</condition>
<condition type="HeroTraitCondition" trait_name="knave1">
<failCondition multiplier = "0.0"/>
<successCondition priority="1.0" score="3.0"/>
</condition>
</conditions>
This set of conditions is for one of the new events, and contains two individual conditions. The first checks if we are looking for an event at the end of a turn. The second sees if the hero we've picked to run the event on has the trait knave1. If either of these conditions fail, they will set the Multiplier to zero - meaning the event has no chance to run, regardless of what the other condition sets the Score to. If both evaluate to true, we end up with a Priority of 1 and a total score of 5.
Hope this is helpful! Hit us with questions, please. We're going to try to get more of the XML definitions up ASAP, but we have to make our internal documentation a bit more reader-friendly first.
[1] Many events lack conditions. These events are called directly by an event that is already running, as opposed to what I'm describing above, the process used by our event scheduler.