diff options
| author | Jan <> | 2015-08-03 01:46:52 +0200 |
|---|---|---|
| committer | Jan <_> | 2015-08-03 02:18:03 +0200 |
| commit | 231f6362538dbd7e17a329849e33ca58d4627dbd (patch) | |
| tree | 2b42cf38ee5bc41163c532004b2d54f9213e49df /TemplePushing.c4s/System.c4g/Curses.c | |
| parent | 38096017fcfdf89f60f388486cd5f6a7770f55ab (diff) | |
| download | tempelschubsen-231f6362538dbd7e17a329849e33ca58d4627dbd.tar.gz tempelschubsen-231f6362538dbd7e17a329849e33ca58d4627dbd.zip | |
Limit lifetime of activated curse
Diffstat (limited to 'TemplePushing.c4s/System.c4g/Curses.c')
| -rw-r--r-- | TemplePushing.c4s/System.c4g/Curses.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/TemplePushing.c4s/System.c4g/Curses.c b/TemplePushing.c4s/System.c4g/Curses.c index f436b8e..f0f4d8b 100644 --- a/TemplePushing.c4s/System.c4g/Curses.c +++ b/TemplePushing.c4s/System.c4g/Curses.c @@ -1,4 +1,5 @@ /*-- Prevent curse scrolls from vanishing --*/ +/*-- Limit lifetime of activated curse */ #strict 2 @@ -34,3 +35,27 @@ public func ActivateTarget(object pCaller, object pTarget) } return _inherited(pCaller, pTarget); } + +protected func FxCurseTimer(pClonk, iEffectNumber, iEffectTime) +{ + var rval = _inherited(pClonk, iEffectNumber, iEffectTime); + if (rval != FX_OK) return rval; + + if (EffectVar(2, pClonk, iEffectNumber) <= 0) + { + if (GetActivatedLifeTime() + --EffectVar(2, pClonk, iEffectNumber) <= 0) return FX_Execute_Kill; + } + + return FX_OK; +} + +protected func FxCurseIsActive(pClonk, iEffectNumber) +{ + // Old meaning of effect variable 2: true if still chasing target or false if activated + // New meaning: + // == 1: Still chasing target + // <= 0: Was activated and remaining lifetime is GetActivatedLifeTime() + value + return EffectVar(2, pClonk, iEffectNumber) <= 0; +} + +private func GetActivatedLifeTime() { return 720 / 2; } |
