-
Notifications
You must be signed in to change notification settings - Fork 4
/
Script.c
78 lines (61 loc) · 1.16 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
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
/**
EarthWallManager
Insert description here
@author
*/
local ManaCost = 30;
local stones;
local HP = 50;
local Dur = 220;
local SpellRange = 100;
func Initialize()
{
}
func Launch(object clonk, int x, int y)
{
var angle = Angle(0,0, x, y);
CreateWall(angle, 8);
Sound("Fire::BlastLiquid1", false, 50);
}
func CreateWall(int angle, int count, int hp)
{
stones = CreateArray(count);
if(hp)
HP = hp;
for(var i = 0; i < count; i++)
{
var r = i - count/2;
var radius = 150;
var stone = CreateObject(EarthStone, -Sin(angle, radius) + Sin(angle + 3*r, radius), +Cos(angle, radius) -Cos(angle + 3*r, radius), GetOwner());
stones[i] = stone;
if(stone)
stone->SetMaster(this);
}
AddEffect("Remove", this, 20, Dur, this);
}
func GotDamage(int dmg)
{
if(GetEffect("DamageCD", this))
return;
HP = HP - dmg;
if(HP <= 0)
ScheduleCall(this, "Destroy", 1);
if(this)
AddEffect("DamageCD", this, 20, 1);
}
func Destroy()
{
for(var s in stones)
{
if(s)
s->RemoveObject();
}
Sound("Fire::BlastLiquid2");
RemoveObject();
}
func FxRemoveStop(object target, proplist effect, int reason, bool temporary)
{
if(temporary)
return;
Destroy();
}