Difference between revisions of "Bonus system"
From VCMI Project Wiki
Tow dragon (talk | contribs) (Created page with 'The bonus system of VCMI is a set of mechanisms that make handling of different bonuses for heroes, towns, players and units easier. The system consists of a set of nodes represe…') |
Tow dragon (talk | contribs) (→Propagation and inheritance) |
||
Line 8: | Line 8: | ||
== Propagation and inheritance == | == Propagation and inheritance == | ||
− | + | Assuming the graph of bonus system is temporarily not changing, the bonuses are propagated as follows: | |
+ | # We take all bonuses by precedence in red DAG (more accurate description is not yet specified) and using their propagators we apply them to appropriate red children. Propagators default to none. | ||
+ | # We take all bonuses by precedence in black DAG (more accurate description to be specified) and apply them to all black children with respect to limiters. A limiter can specify that inheritance should be stopped at a certain node, default is to propagate to all black children. | ||
== Operations on the graph == | == Operations on the graph == |
Revision as of 19:02, 16 December 2010
The bonus system of VCMI is a set of mechanisms that make handling of different bonuses for heroes, towns, players and units easier. The system consists of a set of nodes representing objects that can be a source or a subject of a bonus and two directed acyclic graphs (DAGs) representing inheritance and propagation of bonuses.
Here is a brief sketch of the system (black arrows indicate the direction of inheritance and red arrows the direction of propagation):
Contents
Propagation and inheritance
Assuming the graph of bonus system is temporarily not changing, the bonuses are propagated as follows:
- We take all bonuses by precedence in red DAG (more accurate description is not yet specified) and using their propagators we apply them to appropriate red children. Propagators default to none.
- We take all bonuses by precedence in black DAG (more accurate description to be specified) and apply them to all black children with respect to limiters. A limiter can specify that inheritance should be stopped at a certain node, default is to propagate to all black children.
Operations on the graph
There are two basic types of operations that can be performed on the graph:
Adding a new node
TBD
Deleting an existing node
TBD
Calculating the total value of a bonus
TBD