blob: 3ac40a079d2b5a94c3fba9a399479d168d6f446f (
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
/* Clonk */
#strict 2
#appendto CLNK
local rotateInJump;
local removeOnDeath;
/*
protected func ControlThrow(object byObj)
{
// First check if the clonk already handles the throw control
var ret = _inherited(byObj);
if (ret) return ret;
// Launch arrow from pack in inventory
var arrowPack = Contents();
if (!arrowPack || !arrowPack->~IsArrowPack()) return 0;
arrowPack->Activate(this);
return 1;
}
*/
protected func ControlSpecial()
{
[$Push$|Image=CXIV]
if (GetAction() != "Walk") return 0;
// Use action "Throw" starting with phase 3
SetAction("Throw");
SetPhase(3);
// Find clonks in range
var clonks = FindObjects(
Find_ID(CLNK),
Find_InRect(-20 + GetDir() * 29, 0, 12, 10),
Find_OCF(OCF_Alive),
Find_Hostile(GetOwner()),
Find_Not(Find_Action("Tumble")));
if (GetLength(clonks) == 0) return 0;
// Randomly select clonk to be pushed
var target = clonks[Random(GetLength(clonks))];
Fling(target, -1 + GetDir() * 2, -1);
target->SetKiller(GetOwner());
return 1;
}
protected func ControlLeft()
{
if (rotateInJump && GetAction() == "Jump" || GetAction() == "Tumble") SetDir(DIR_Left);
return _inherited();
}
protected func ControlRight()
{
if (rotateInJump && GetAction() == "Jump" || GetAction() == "Tumble") SetDir(DIR_Right);
return _inherited();
}
protected func Death(int killedBy)
{
var ret = _inherited(killedBy);
if (removeOnDeath) RemoveObject();
return ret;
}
public func QueryCatchBlow(object arrow)
{
return arrow->GetOwner() == GetOwner();
}
|