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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
|
/* Clonk */
#strict 2
#appendto CLNK
local teamHud;
local rotateInJump;
local removeOnDeath;
protected func Initialize()
{
teamHud = CreateObject(THUD);
teamHud->Attach(this);
AddEffect("CheckGlitches", this, 1000, 1, this);
AddEffect("CheckBurn", this, 101, 0, this);
SetPhysical("Fight", 75000, PHYS_Temporary, this);
SetPhysical("Scale", 60000, PHYS_Temporary, this);
SetPhysical("Hangle", 60000, PHYS_Temporary, this);
SetPhysical("Energy", 100000, PHYS_Temporary, this);
SetPhysical("CanScale", 1, PHYS_Temporary, this);
SetPhysical("CanHangle", 1, PHYS_Temporary, this);
DoEnergy(100, this);
return _inherited(...);
}
/*
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 CanPush()
{
return GetAction() == "Walk";
}
func ExecutePush()
{
if (!CanPush()) 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))];
var effect;
if(effect = GetEffect("StoneShieldPSpell", target))
{
EffectCall(target, effect, "Damage", -12000, FX_Call_EngGetPunched);
}
else
{
Fling(target, -1 + GetDir() * 2, -1);
target->SetKiller(GetOwner());
}
}
protected func ControlSpecial()
{
[$Push$|Image=CXIV|Condition=CanPush]
if (!CanPush()) return 0;
PushExecuter->RequestPush(this);
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 (teamHud) RemoveObject(teamHud);
if (removeOnDeath) RemoveObject();
return ret;
}
public func QueryCatchBlow(object arrow)
{
if (arrow->~QueryOwnCatchBlow(this)) return 1;
return _inherited(arrow, ...);
}
private func FxCheckGlitchesTimer(object pTarget, int iEffectNumber, int iEffectTime)
{
var d = GetDir(pTarget)*2 - 1;
var comDir = pTarget->GetComDir();
if (GetProcedure(pTarget) == "FLIGHT" && EffectVar(0, pTarget, iEffectNumber) == "SCALE" && EffectVar(1, pTarget, iEffectNumber) < 0 && (comDir == COMD_Stop || comDir == COMD_Down) && pTarget->GBackSolid(d * 5, 4) && !pTarget->GBackSolid(d * 5, 3))
{
SetPosition(GetX(pTarget), GetY(pTarget) + 1, pTarget);
pTarget->SetAction("Scale");
pTarget->SetPhase(EffectVar(2, pTarget, iEffectNumber));
}
EffectVar(0, pTarget, iEffectNumber) = GetProcedure(pTarget);
EffectVar(1, pTarget, iEffectNumber) = pTarget->GetYDir(0, 65535);
EffectVar(2, pTarget, iEffectNumber) = pTarget->GetPhase();
var action = GetAction(pTarget);
if (action == "Walk")
{
if (!pTarget->GBackSolid(0, 4) && !pTarget->GBackSolid(d, 3) && pTarget->GBackSolid(d, 4))
{
SetPosition(GetX(pTarget), GetY(pTarget) - 1, pTarget);
ObjectSetAction(pTarget, "KneelDown");
pTarget->Schedule("SetXDir(0)", 1);
if ((d == -1 && comDir != COMD_Left) || (d == 1 && comDir != COMD_Right)) SetComDir(COMD_Up, pTarget);
}
}
else if (action == "FlatUp")
{
if ((d == -1) != (GetContact(pTarget, 5, -1) == CNAT_Bottom))
{
d *= -1;
}
if (!pTarget->GBackSolid(0, 4) && (!pTarget->GBackSolid(d * 2, 3) && pTarget->GBackSolid(d * 2, 4)))
{
if (comDir != COMD_Down && comDir != COMD_Up && ((d == -1 && comDir != COMD_Left) || (d == 1 && comDir != COMD_Right)))
{
SetPosition(GetX(pTarget), GetY(pTarget) + 1, pTarget);
}
}
}
}
func FxCheckBurnEffect(string newEffectName, object target, int effectNumber, int newEffectNumber, int causedBy, bool fBlasted, object incineratingObject)
{
if (newEffectName == "Fire" && incineratingObject && incineratingObject->~QueryIncinerateObject(target)) return FX_Effect_Deny;
}
func ShowTeamHUD(string text)
{
if (teamHud) teamHud->Show(text, 72);
}
func Collection(object obj)
{
obj->~Entrance2(this);
return _inherited(obj, ...);
}
|