This is a request to include two new elements for your XML elements.
I. <GameModifier Target="effect target" /> and <SpellDefEffect.Target>
Behavior: This attribute determines who/what the effect is applied to.
Possible Values:
- NULL. Effect is applied exactly how it would be applied in the current scheme.
- Source. Effect is applied to "Source" of whatever element it's living in. In the case of a SpellDef, this would be the unit casting the spell. When building a city, it would be the player, etc. These effects with things like "AdjustUnitStat" with a negative value could be used by the engine to determine the "cost" for a spell/ability similarly to how the Improvements calculate build cost, allowing a wider range of cost effects like damage, attribute loss, etc.
- Default. Effect is applied exactly how it would be applied in the current scheme.
II. <GameModifier ApplyEffectWhen="event" /> and <SpellDefEffect.PlayEventWhen>
Behavior: This attribute specifies when the game modifier is actually applied, and to what it is applied.
Possible Values:
- NULL. Effect is applied exactly how it would be applied in the current scheme.
- Instant. Effect is applied exactly how it would be applied in the current scheme.
- OnEnter, OnLeave. Effect is applied to units as they enter or leave the map location where this effect is in place. This would only work for effects with a nonzero duration that are applied to map locations.
- OnStartTurn, OnEndTurn. These would only work for effects with a nonzero duration.
When GameModifier.Target is NULL or Default: If the target of the spell was a location, the effect is applied to all units who start or end their turns in the location. If the target was a unit, the effect is applied to the unit at the start or end of its turn.
When GameModifier.Target = Source: The effect is applied to the "Source" (described above) at the start/end of each of his turns.
Conflicts: This would eliminate the need for your "PerTurn" attribute.
Gnilbert