summaryrefslogtreecommitdiffstats
path: root/TemplePushing.c4s/System.c4g/Scroll.c
blob: c9098df8c9ea0955a222337aa831a646f3f6ea2d (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
#strict 2

#appendto SCRL

static SCRL_spells;

protected func Initialize()
{
	SetSpell(SCRL_spells[Random(GetLength(SCRL_spells))]);

	return _inherited();
}

public func SpellFailed(id idSpell, object pAimingClonk)
{
	// Spell canceled? Give back the scroll
	SetVisibility(VIS_All);
	SetSpell(idSpell);
	if(pAimingClonk && !pAimingClonk->~RejectCollect(GetID(this), this))
	{
		Enter(pAimingClonk, this);
	}
	pAimingClonk = 0;
	return 0;
}

global func SetScrollSpells(array spells)
{
	SCRL_spells = spells;
}

protected func WannaRemove()
{
	// manche Zauber hängen gerne Effekte an den Caster
	if(!(GetEffectCount(0,this()) - GetEffectCount("FadeOut", this)) && !pAimingClonk) RemoveObject();
}

public func AvoidFadeOut()
{
	return GetAction(this) == "WannaRemove";
}

private func DoMagic(object pByClonk)
{
	SetVisibility(VIS_Owner | VIS_Allies, this);
	return _inherited(pByClonk);
}

func SetSpell(id spell)
{
	SetClrModulation(spell->~ScrollColor());
	return _inherited(spell, ...);
}

func Entrance2(object pContainer)
{
	if (pContainer && GetOCF(pContainer) & OCF_CrewMember)
	{
		pContainer->~ShowTeamHUD(Format("{{%i}}", idSpell));
	}
	return _inherited(pContainer, ...);
}