Had some time between classes, so I programmed something that I wanted to do a LONG time ago, but hadn't gotten around to (unfortunately that means I didn't program the thing that I really want, the thing that I really like, or the thing that I really need).
Also, the first post has finally broken the character limit, so I clipped the Mods from other users into the second post. Will probably have to move even more the next time I do a major update, or clip a lot of the information, but I would rather avoid that if I can.
Anyway: The new fields/abilities are....
PROMOTION DURATION!
This can be set via PromotionInfos, SpellInfos, or Python. Spellinfos overrides any value set in PromotionInfos, and python does whatever python wants.
Duration will not count down while a valid caster is in the stack, and if the promotion has a chance to expire, that chance becomes active only after the duration hits 0 (otherwise when duration hits 0 the promotion is removed). Currently you cannot refresh a promotion before the promotion fully expires (so if you set a promotion with duration of 10, you cannot restore the promotion when the duration is only 2, you have to wait for it to expire, then restore it)
The current test promotions I set up to use this are Hasted being set via SpellInfos to use a Duration of 1, meaning that if the caster hits a stack and they go walking off like normal, the spell works just like now. But if the caster stays with the stack, they stay hasted forever. Obviously this means that the Adept who has Body I will always be hasted as he is always in his own stack. Anyway, this one is set by spell because Hasted is also applied to Centaurs with the spell Sprint. That one doesn't set a duration, so for them Hasted still only lasts for the single turn. But I modified Sprint a bit as well (more later).
The other trial promotion is Dance of Blades. This one I set by PromotionInfos, so now anything that grants Dance of Blades will grant the promotion for a single turn, unless a unit on the tile is able to cast the buff, then it remains till a turn when that unit is not around.
So, more on Sprint. I removed the application of Fatigued that this spell included. Instead I made Hasted apply Fatigued naturally as a <PromotionDegrades> field. So now ANY unit that loses Hasted will gain Fatigued, even if you gained Hasted by the spell Haste, and even if you lost Hasted by the spell Slow. I feel this is justified because now a unit could be hasted for 50 turns running without micromanagement, so having to deal with a 50% chance to wear off per turn -10% strength is quite worthwhile. And I wanted to use the new field
THINGS YOU CAN DO:
So, nifty things you can do with this new field:
Have a spell apply a Promotion that doesn't actually do anything, but has a duration of 10, and degrades to a spell that DOES do something.
Have a spell provide a promotion that already exists (like an item) for a limited period of time. Thinking of that... I need to block promotions with durations from being treated like normal equipment... that could be a bit tricky. So just don't use items in this manner for the time being
I guess the best approach would be to make certain that the unit which spawns has the same duration as the promotion had, and that when the unit is "picked up" that the duration goes with it. Last part is in python though, which is what makes this a messy thing to clean up. Eventually I intend for all Equipment to move out of python, as it is a HUGE chunk of code for a relatively simple function.
Anyway, new toy... have fun playing with it when next version is out.