-
Notifications
You must be signed in to change notification settings - Fork 54
/
Script.c
52 lines (40 loc) · 1.36 KB
/
Script.c
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
/*
Bomb Arrow
Same as an arrow but explodes on impact. Overloads from the arrow script
and implements additional features.
@author Maikel
*/
#include Arrow
// Callback from the hitcheck effect: explode on impact with target.
public func HitObject(object obj)
{
// First let the normal arrow hit with reduced damage take place, then explode for additonal damage.
_inherited(obj, ...);
// Explosion strength a little random with only a small radius.
return Explode(14 + Random(3));
}
// Callback on hit: explode on impact with landscape.
public func Hit()
{
// Only explode on impact with the landscape if the object was in flight.
// Explosion strength a little random with only a small radius.
if (GetEffect("InFlight", this))
return Explode(12 + Random(3));
return;
}
// Determines the arrow strength: only 30% that of the normal arrow.
public func ArrowStrength() { return 3; }
public func HasExplosionOnImpact() { return !!GetEffect("InFlight", this); }
public func IsExplosive() { return true; }
private func OnBurnDown()
{
// Got burned? Explode based on stack size.
Explode(10 + Random(3) + 23 * GetStackCount() / MaxStackCount());
_inherited(...);
return true; // Do not create burned object
}
/*-- Properties --*/
local Name = "$Name$";
local Description = "$Description$";
local Collectible = 1;
local Components = {Wood = 3, Metal = 1, Firestone = 2};