/*-- 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); }