summaryrefslogtreecommitdiffstats
path: root/TemplePushing.c4s/Misc.c4d/AdditionalSpells.c4d/CrystalSpikes.c4d/Kristall.c4d/Script.c
blob: 1d25b23998d4491d964773f66126abefa7592d20 (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
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
/*-- Crystal Spike --*/

#strict

local iMaxTime;

local iExtra;

public func IsBigCrystal(){ return(1); }

func Initialize() {
   var Randi = RandomX(1,4);
   if(Randi == 1) SetGraphics("A",this(), GetID(), 1,GFXOV_MODE_ExtraGraphics);
   if(Randi == 2) SetGraphics("B",this(), GetID(), 1,GFXOV_MODE_ExtraGraphics);
   if(Randi == 3) SetGraphics("C",this(), GetID(), 1,GFXOV_MODE_ExtraGraphics);
   if(Randi == 4) SetGraphics("D",this(), GetID(), 1,GFXOV_MODE_ExtraGraphics);
   SetAction("Bohr");
  return(1);
}
public func Set(inMaxTime, int iMetl){
 iMaxTime = inMaxTime;
 if(iMetl){ iExtra = iMetl;
 SetGraphics("Metl",this(), GetID(), 1,GFXOV_MODE_ExtraGraphics);
  }
  return(1);
}

func StossEffect() {
for(var pClonk in FindObjects(Find_Distance(20), Find_OCF(OCF_Living), Find_NoContainer ())){
   if(GetAlive(pClonk)) {
   if(!GetEffect("NoCrystallAttack",pClonk))
   HitObject(pClonk);
   }
 }
for(var pDing in FindObjects(Find_Distance(30), Find_Category(C4D_Object), Find_NoContainer ())){
   HitDing(pDing);
 }

if(!Random(1)) {CreateParticle("Smoke",0,+21,RandomX(-4,4),-5,80,RGB(120,120,120)); }
if(!Random(2)) {
var ebk = CreateObject(1EBK,0,+21,GetOwner());
if(ebk) SetSpeed(RandomX(-5,5),RandomX(-40,-80),ebk);
 }
}

func ExistTimer() {
if(!Random(20)) Sound("Sparkle");
if(!Random(4)) {
CreateParticle("NoGravSpark",RandomX(-8,8),RandomX(-28,26),0,-5,RandomX(10,30),GetTeamColor(GetPlayerTeam(GetOwner())));
 }

for(var pClonk in FindObjects(Find_Distance(40), Find_OCF(OCF_Living), Find_NoContainer ())){
   if(GetAlive(pClonk)) if(!Random(20)) EffectObject(pClonk);
 }

if(iMaxTime > 0){
if(GetActTime() > iMaxTime) SetAction("Remove");
 }
}

global func CreateBigCrystal(int iX,int iY, int iCon, int iMTime, int iOwner) { // Erstell an der Position ein großen Kristall
var pCrys = CreateObject(QBCY,iX,iY,iOwner);
pCrys->Set(iMTime);
SetCon(iCon,pCrys);
return(pCrys);
}
func HitObject(object pClonk) {
if(!pClonk) return(0);
Sound("Crystal2",0,pClonk);
if(!FindObject(NTMG)){
  if(!Hostile(GetOwner(),GetOwner(pClonk))) return(0);
 }
if(GetAction(pClonk) ne "Tumble"){
DoEnergy(RandomX(-10,-20)+iExtra,pClonk);
Fling(pClonk, RandomX(-4,4), RandomX(-5,-9));
  AddEffect("NoCrystallAttack",pClonk,100,1,pClonk);
 }
}
func HitDing(object pDing) {
if(GetID(pDing) == QBCY) return(0);
if(pDing){ SetSpeed(RandomX(-4,4),RandomX(-20,-40),pDing);
pDing->~Hit(); }
}

func EffectObject(object pClonk) {
if(!FindObject(NTMG)){
  if(!Hostile(GetOwner(),GetOwner(pClonk))) return(0);
 }
CreateParticle("NoGravSpark",GetX()-GetX(pClonk)+RandomX(-8,8),GetY()-GetY()+RandomX(-12,12),0,-5,RandomX(10,20),GetColorDw (this()));
if(!Random(2))
DoEnergy(-7,pClonk);
}
func RemoveMe(){
RemoveObject(this());
}
func SoundBamm(){
  Sound("RockBreak*");
  Sound("Blast2",0,0,50);
for(var i = 0; i < 5; i++){
var ebk = CreateObject(1EBK,0,+21,GetOwner());
if(ebk) SetSpeed(RandomX(-5,5),RandomX(-40,-80),ebk);
 }
}
global func FxNoCrystallAttackTimer(object pTarget, int iIndex, int iTime)
{
  if(!pTarget) return (false);
  if(iTime >= 20) return (-1);
  return (true);
}