Is the CC system designed around specific ability usage? Such as your Sap example, meaning Sap could have 1/4 of it's base duration but some other CC ability that you haven't used yet would work at 100% effectiveness?
OR does a unit have a "CC Resistance" stat that determines how long CC effects last on it. This stat changes as a unit gets hit by CC, and eventually resets back to normal.
The 2nd option is a lot easier to make since it's more general. A unit casts CC on a target, the targets CC Resistance gets divided by 2, the duration of the CC ability gets reduced based on this CC Resistance.
Here's an example of the 2nd option using a Unit Indexer. I don't have the Editor open so I'm just writing the names of things from memory:
-
Events:
-
A unit starts the effect of an ability
-
Conditions:
-
Ability being cast equal to Slow
-
Actions:
-
Custom script: local integer i = GetUnitUserData(GetSpellTargetUnit())
-
Set CV = Custom value of target unit of ability being cast
-
Set CC_Resistance[CV] = CC_Resistance[CV] / 2.0
-
Set N_Duration = Get Ability being cast Normal Duration (GetAbilityRealLevelField)
-
Set H_Duration = Get Ability being cast Hero Duration (GetAbilityRealLevelField)
-
Set Ability being cast Normal Duration equal to N_Duration*CC_Resistance[CV] (SetAbilityRealLevelField)
-
Set Ability being cast Hero Duration equal to N_Duration*CC_Resistance[CV] (SetAbilityRealLevelField)
-
Wait 5.00 seconds
-
Custom script: set udg_CV = i
-
Set CC_Resistance[CV] = CC_Resistance[CV] * 2.0
-
Custom script: set i = null
CC_Resistance has a default value of 1.0
Note that this would reduce the first cast duration by half, since the CC Resistance gets updated immediately.
So if Slow's duration is 10.00 seconds:
First cast = 10.00/2.00 -> 5.00
Second cast = 5.00/2.00 = 2.50
Third cast = 2.50/2.00 = 1.25
etc...
The 5.00 second Wait happens after each cast of CC, and undos a "stack" of reduction.