summaryrefslogtreecommitdiffstats
path: root/TemplePushing.c4s/System.c4g/CurseFall.c
blob: 3b8c45193ede23e9b098541c40045c4bdb278bc9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*-- Kill tracking falling curse --*/

#strict 2
#appendto CFAL

protected func FxCurseFallingStart(pClonk, iEffectNumber, iTemp, iX, iY, pCaller)
{
	EffectVar(6, pClonk, iEffectNumber) = GetController(pCaller);
	return _inherited(pClonk, iEffectNumber, iTemp, iX, iY, pCaller);
}

protected func FxCurseFallingTimer(pClonk, iEffectNumber, iEffectTime)
{
	var rval = FxCurseTimer(pClonk, iEffectNumber, iEffectTime);
	if (rval != FX_OK) return rval;
	if (FxCurseIsActive(pClonk, iEffectNumber))
	{
		var killer = EffectVar(6, pClonk, iEffectNumber);
		// Bei Bedarf stolpern
		if(pClonk->GetContact(0, -1, 8))
		{
			if(GetXDir(pClonk) || GetAction(pClonk) != "Walk" )
			{
				if(WildcardMatch(GetAction(pClonk), "*Magic") || WildcardMatch(GetAction(pClonk), "*Cast"))
				{
					// Bei Magie-Aktion nicht so häufig stören
					if(!Random(120)) { ObjectSetAction(pClonk, "FlatUp"); SetXDir(0, pClonk); SetKiller(killer, pClonk); }
				}
				else
				{
					if(!Random(60)) { ObjectSetAction(pClonk, "KneelDown"); SetXDir(0, pClonk); SetKiller(killer, pClonk); }
					if(!Random(60)) { ObjectSetAction(pClonk, "FlatUp"); SetXDir(0, pClonk); SetKiller(killer, pClonk); }
				}
			}
		}
		// In Flug nur Tumble
		else
		{
			if(!Random(50)) { ObjectSetAction(pClonk, "Tumble"); SetKiller(killer, pClonk); }
		}
	}
	return FX_OK;
}