From f1ece16c08d8c01e1d49a25f0314a96c021e73cb Mon Sep 17 00:00:00 2001 From: Jan <> Date: Fri, 10 Jul 2015 18:11:22 +0200 Subject: r0.921 --- TemplePushing.c4s/System.c4g/Aimer.c | 47 +++++++ TemplePushing.c4s/System.c4g/ApocalypseEffects.c | 3 +- TemplePushing.c4s/System.c4g/Arrowpack.c | 4 +- TemplePushing.c4s/System.c4g/Blackout.c | 51 +++++++ TemplePushing.c4s/System.c4g/Clonk.c | 9 +- TemplePushing.c4s/System.c4g/CurseFall.c | 43 ++++++ TemplePushing.c4s/System.c4g/Explode.c | 78 +++++++++++ TemplePushing.c4s/System.c4g/FireBall.c | 79 +++++++++++ TemplePushing.c4s/System.c4g/Freeze.c | 36 +++++ TemplePushing.c4s/System.c4g/Frostwave.c | 158 +++++++++++----------- TemplePushing.c4s/System.c4g/Ice.c | 27 ++-- TemplePushing.c4s/System.c4g/IceBall.c | 97 +++++++++++++ TemplePushing.c4s/System.c4g/Icestrike.c | 38 ++++++ TemplePushing.c4s/System.c4g/LavaRain.c | 1 - TemplePushing.c4s/System.c4g/Lenseflare.c | 65 --------- TemplePushing.c4s/System.c4g/MagicLightningBolt.c | 65 +++++++++ TemplePushing.c4s/System.c4g/Plague.c | 25 +++- TemplePushing.c4s/System.c4g/Rain.c | 1 - TemplePushing.c4s/System.c4g/RotationHelper.c | 10 ++ TemplePushing.c4s/System.c4g/Scroll.c | 24 +++- TemplePushing.c4s/System.c4g/ShootInventory.c | 1 + TemplePushing.c4s/System.c4g/Sun.c | 14 -- TemplePushing.c4s/System.c4g/Vanish.c | 3 +- 23 files changed, 691 insertions(+), 188 deletions(-) create mode 100644 TemplePushing.c4s/System.c4g/Aimer.c create mode 100644 TemplePushing.c4s/System.c4g/Blackout.c create mode 100644 TemplePushing.c4s/System.c4g/CurseFall.c create mode 100644 TemplePushing.c4s/System.c4g/Explode.c create mode 100644 TemplePushing.c4s/System.c4g/FireBall.c create mode 100644 TemplePushing.c4s/System.c4g/Freeze.c create mode 100644 TemplePushing.c4s/System.c4g/IceBall.c create mode 100644 TemplePushing.c4s/System.c4g/Icestrike.c delete mode 100644 TemplePushing.c4s/System.c4g/Lenseflare.c create mode 100644 TemplePushing.c4s/System.c4g/MagicLightningBolt.c create mode 100644 TemplePushing.c4s/System.c4g/RotationHelper.c (limited to 'TemplePushing.c4s/System.c4g') diff --git a/TemplePushing.c4s/System.c4g/Aimer.c b/TemplePushing.c4s/System.c4g/Aimer.c new file mode 100644 index 0000000..30a30e9 --- /dev/null +++ b/TemplePushing.c4s/System.c4g/Aimer.c @@ -0,0 +1,47 @@ +/*-- Aimer appendto --*/ + +#strict 2 +#appendto AIMR + +local targetDir; + +private func DoDirControl(int iDir) +{ + // Abbruch, wenn das Zielobjekt weg ist + if (!pTargetObject) return(Abort()); + // Richtungsänderung? + if (iDir != targetDir) + { + iAngle=-iAngle; + if(GetAction(pTargetObject) != "Scale") + { + pTargetObject->SetDir(iDir); + } + pArrow->UpdateAngle(iAngle); + pTargetObject->~AimingAngle(iAngle); + targetDir = iDir; + } + else + // Tastendruck in Zielrichtung: Zaubern! + DoEnter(); + return(1); +} + +private func DoUpDownControl(int iByChange) +{ + // Abbruch, wenn das Zielobjekt weg ist + if (!pTargetObject) return(Abort()); + // Zielrichtung ändern + iAngle = BoundBy(Abs(iAngle) + iByChange, 0, 180); + if (!targetDir) iAngle *= -1; + pArrow->UpdateAngle(iAngle); + pTargetObject->~AimingAngle(iAngle); + return(1); +} + +public func Create(object pCommandObject, object pMenuObj, int iStartAngle) +{ + var ret = _inherited(pCommandObject, pMenuObj, iStartAngle); + targetDir = pTargetObject->GetDir(); + return ret; +} \ No newline at end of file diff --git a/TemplePushing.c4s/System.c4g/ApocalypseEffects.c b/TemplePushing.c4s/System.c4g/ApocalypseEffects.c index cefa608..585a385 100644 --- a/TemplePushing.c4s/System.c4g/ApocalypseEffects.c +++ b/TemplePushing.c4s/System.c4g/ApocalypseEffects.c @@ -9,8 +9,7 @@ global func FxCreateTeraFlintsTimer() var clonk = GetCrew(GetPlayerByIndex(i)); if (!clonk) continue; - var teraflint = CreateObject(EFLN, 0, 0, NO_OWNER); - if (!clonk->Collect(teraflint)) teraflint->RemoveObject(); + if (clonk->ContentsCount(EFLN) < 3) clonk->CreateContents(EFLN); } return 1; diff --git a/TemplePushing.c4s/System.c4g/Arrowpack.c b/TemplePushing.c4s/System.c4g/Arrowpack.c index 5f86151..da2c5ec 100644 --- a/TemplePushing.c4s/System.c4g/Arrowpack.c +++ b/TemplePushing.c4s/System.c4g/Arrowpack.c @@ -8,7 +8,7 @@ local coolingDown; protected func Initialize() { - iUsedItems = Random(MaxPackCount() - 1); + iUsedItems = RandomX(7,8); } private func CooledDown() @@ -37,7 +37,7 @@ protected func Activate(object clonk) // Start cooldown coolingDown = true; - Schedule("coolingDown = false", RandomX(1, 20)); + Schedule("coolingDown = false", RandomX(3, 5)); // Play sound Sound("Arrow"); diff --git a/TemplePushing.c4s/System.c4g/Blackout.c b/TemplePushing.c4s/System.c4g/Blackout.c new file mode 100644 index 0000000..b3f3bdb --- /dev/null +++ b/TemplePushing.c4s/System.c4g/Blackout.c @@ -0,0 +1,51 @@ +/*-- Kill tracking Blackout --*/ + +#appendto MBOT +#strict 2 + +public func Activate(object pCaster, object pRealcaster) { + // Effekte! + Sound("Magic*", 0, this(), 70); + var iRange=100; + var iDuration = 37; + var iAng, iX, iY, iRng; + // Kombo: Stein verlängert Dauer + var pComboObj; + if (pComboObj = FindContents(ROCK, pCaster)) + { + iDuration *= 2; + RemoveObject(pComboObj); + } + // Kombo: Fisch und Kohle vergrößert Radius + pComboObj = FindContents(FISH, pCaster); + if (!pComboObj) pComboObj = FindContents(DFSH, pCaster); + if (!pComboObj) pComboObj = FindContents(COAL, pCaster); + if (pComboObj) + { + if (GetAlive(pComboObj)) + iRange *= 3; + else + iRange *= 2; + RemoveObject(pComboObj); + } + for(var i=iRange/2; i>0; --i) + { + iAng=Random(360); + iRng=Random(iRange/2); + iX=Sin(iAng, iRng); + iY=Cos(iAng, iRng); + CreateParticle("Feather", iX, iY, RandomX(-5,5), -3, 50+Random(25)); + } + var pClonk,pVictim; + if(!(pClonk=pRealcaster)) pClonk=pCaster; + // alle Clonks im näheren Umkreis prüfen + while(pVictim=FindObject(0,-iRange/2,-iRange/2,iRange,iRange,OCF_CrewMember,0,0,NoContainer(),pVictim)) + // die Opfer sind feindliche Clonks oder alle Clonks außer dem Zauberer selbst wenn NoTeamMagic aktiviert ist + if((Hostile(GetOwner(pVictim),GetOwner(pClonk)) || ObjectCount(NTMG)) && pClonk!=pVictim) + { + // wirkt länger bei heruntergekämpften Clonks + AddEffect("SleepNSpell",pVictim,123,25,0,GetID(),iDuration*((115-GetEnergy(pVictim)*100000/GetPhysical("Energy",0, pVictim))/5)); + SetKiller(GetController(pClonk), pVictim); + } + return(1); +} diff --git a/TemplePushing.c4s/System.c4g/Clonk.c b/TemplePushing.c4s/System.c4g/Clonk.c index c934938..3ac40a0 100644 --- a/TemplePushing.c4s/System.c4g/Clonk.c +++ b/TemplePushing.c4s/System.c4g/Clonk.c @@ -7,6 +7,7 @@ local rotateInJump; local removeOnDeath; +/* protected func ControlThrow(object byObj) { // First check if the clonk already handles the throw control @@ -19,6 +20,7 @@ protected func ControlThrow(object byObj) arrowPack->Activate(this); return 1; } +*/ protected func ControlSpecial() { @@ -33,10 +35,11 @@ protected func ControlSpecial() // Find clonks in range var clonks = FindObjects( Find_ID(CLNK), - Find_InRect(-10 + GetDir() * 20, 0, 10, 10), + Find_InRect(-20 + GetDir() * 29, 0, 12, 10), Find_OCF(OCF_Alive), - Find_Hostile(GetOwner())); - + Find_Hostile(GetOwner()), + Find_Not(Find_Action("Tumble"))); + if (GetLength(clonks) == 0) return 0; // Randomly select clonk to be pushed diff --git a/TemplePushing.c4s/System.c4g/CurseFall.c b/TemplePushing.c4s/System.c4g/CurseFall.c new file mode 100644 index 0000000..3b8c451 --- /dev/null +++ b/TemplePushing.c4s/System.c4g/CurseFall.c @@ -0,0 +1,43 @@ +/*-- Kill tracking falling curse --*/ + +#strict 2 +#appendto CFAL + +protected func FxCurseFallingStart(pClonk, iEffectNumber, iTemp, iX, iY, pCaller) +{ + EffectVar(6, pClonk, iEffectNumber) = GetController(pCaller); + return _inherited(pClonk, iEffectNumber, iTemp, iX, iY, pCaller); +} + +protected func FxCurseFallingTimer(pClonk, iEffectNumber, iEffectTime) +{ + var rval = FxCurseTimer(pClonk, iEffectNumber, iEffectTime); + if (rval != FX_OK) return rval; + if (FxCurseIsActive(pClonk, iEffectNumber)) + { + var killer = EffectVar(6, pClonk, iEffectNumber); + // Bei Bedarf stolpern + if(pClonk->GetContact(0, -1, 8)) + { + if(GetXDir(pClonk) || GetAction(pClonk) != "Walk" ) + { + if(WildcardMatch(GetAction(pClonk), "*Magic") || WildcardMatch(GetAction(pClonk), "*Cast")) + { + // Bei Magie-Aktion nicht so häufig stören + if(!Random(120)) { ObjectSetAction(pClonk, "FlatUp"); SetXDir(0, pClonk); SetKiller(killer, pClonk); } + } + else + { + if(!Random(60)) { ObjectSetAction(pClonk, "KneelDown"); SetXDir(0, pClonk); SetKiller(killer, pClonk); } + if(!Random(60)) { ObjectSetAction(pClonk, "FlatUp"); SetXDir(0, pClonk); SetKiller(killer, pClonk); } + } + } + } + // In Flug nur Tumble + else + { + if(!Random(50)) { ObjectSetAction(pClonk, "Tumble"); SetKiller(killer, pClonk); } + } + } + return FX_OK; +} diff --git a/TemplePushing.c4s/System.c4g/Explode.c b/TemplePushing.c4s/System.c4g/Explode.c new file mode 100644 index 0000000..39b4c4a --- /dev/null +++ b/TemplePushing.c4s/System.c4g/Explode.c @@ -0,0 +1,78 @@ +/* Fix kill-tracking for Explosionspunkt + * (only moved SetController under Fling) */ +#strict + +// Objekte beschädigen und wegschleudern +global func BlastObjects(int x, int y, int level, object container, int cause_plr_plus_one, object layer) +{ + var obj; + + // Koordinaten sind immer global angegeben. In lokale Koordinaten umrechnen + var l_x = x - GetX(), l_y = y - GetY(); + + // Im Container? + if (container) + { + if (GetObjectLayer(container) == layer) + { + BlastObject(level, container, cause_plr_plus_one); + if (!container) return true; // Container koennte inzwischen entfernt worden sein + for (obj in FindObjects(Find_Container(container), Find_Layer(layer))) + if (obj) BlastObject(level, obj, cause_plr_plus_one); + } + } + else + { + // Objekt ist draußen + // Objekte am Explosionspunkt beschädigen + for (var obj in FindObjects(Find_AtRect(l_x-5, l_y-5, 10,10), Find_NoContainer(), Find_Layer(layer))) + if (obj) BlastObject(level, obj, cause_plr_plus_one); + // Objekte im Explosionsradius schleudern + var shockwave_objs = FindObjects(Find_Distance(level, l_x,l_y), Find_NoContainer(), Find_Layer(layer), + Find_Or(Find_Category(C4D_Object|C4D_Living|C4D_Vehicle), Find_Func("CanBeHitByShockwaves")), Find_Func("BlastObjectsShockwaveCheck",x,y)); + var cnt = GetLength(shockwave_objs); + if (cnt) + { + // Die Schleuderenergie teilt sich bei vielen Objekten auf + //Log("Shockwave objs %v (%d)", shockwave_objs, cnt); + var shock_speed = Sqrt(2 * level * level / BoundBy(cnt, 2, 12)); + for (var obj in shockwave_objs) if (obj) // obj noch prüfen, weil OnShockwaveHit Objekte aus dem Array löschen könnte + { + // Objekt hat benutzerdefinierte Reaktion auf die Schockwelle? + if (obj->~OnShockwaveHit(level, x,y)) continue; + // Lebewesen leiden besonders + var cat = GetCategory(obj); + if (cat & C4D_Living) + { + DoEnergy(level/-2, obj, false, FX_Call_EngBlast, cause_plr_plus_one); + DoDamage(level/2, obj, FX_Call_DmgBlast, cause_plr_plus_one); + } + // Schockwelle + var mass_fact = 20, mass_mul = 100; if (cat & C4D_Living) { mass_fact = 8; mass_mul = 80; } + mass_fact = BoundBy(GetMass(obj)*mass_mul/1000, 4, mass_fact); + var dx = 100*(GetX(obj)-x)+Random(51)-25; + var dy = 100*(GetY(obj)-y)+Random(51)-25; + var vx, vy; + if (dx) + { + vx = Abs(dx)/dx * (100*level-Abs(dx)) * shock_speed / level / mass_fact; + } + vy = (Abs(dy) - 100*level) * shock_speed / level / mass_fact; + if (cat & C4D_Object) + { + // Objekte nicht zu schnell werden lassen + var ovx = GetXDir(obj, 100), ovy = GetYDir(obj, 100); + if (ovx*vx > 0) vx = (Sqrt(vx*vx + ovx*ovx) - Abs(vx)) * Abs(vx)/vx; + if (ovy*vy > 0) vy = (Sqrt(vy*vy + ovy*ovy) - Abs(vy)) * Abs(vy)/vy; + } + //Log("%v v(%v %v) d(%v %v) m=%v l=%v s=%v", obj, vx,vy, dx,dy, mass_fact, level, shock_speed); + Fling(obj, vx,vy, 100, true); + SetKiller(cause_plr_plus_one-1, obj); + // Killverfolgung bei Projektilen + if (cat & C4D_Object) SetController(cause_plr_plus_one-1, obj); + } + } + } + // Fertig + return true; +} diff --git a/TemplePushing.c4s/System.c4g/FireBall.c b/TemplePushing.c4s/System.c4g/FireBall.c new file mode 100644 index 0000000..40d1eab --- /dev/null +++ b/TemplePushing.c4s/System.c4g/FireBall.c @@ -0,0 +1,79 @@ +/*-- Increase distance to caster to avoid autokills --*/ + +#appendto FIRB +#strict 2 + +func FxFireballFlightTimer(pTarget, iEffectNumber, iEffectTime) +{ + var iSize=EffectVar(0, pTarget, iEffectNumber); + var iMaxSize=EffectVar(1, pTarget, iEffectNumber); + var iAngle=EffectVar(2, pTarget, iEffectNumber); + var iLaunchFree=EffectVar(3, pTarget, iEffectNumber); + var pCaster = EffectVar(4, pTarget, iEffectNumber); + var iSizeBoost=EffectVar(5, pTarget, iEffectNumber); + if(iSize<=0) return(RemoveObject()); + if(GBackLiquid()) return(RemoveObject()); + // Effekt + for( var i=4; i>0; --i) + { + CreateParticle("Fire", RandomX(-iSize/50,iSize/50), RandomX(-iSize/50,iSize/50), RandomX(-2,2)+GetXDir()/2, RandomX(-2,2)+GetYDir()/2, iSize*60/100+Random(15), RGBa(Random(255),0,0,90)); + CreateParticle("Fire2", RandomX(-iSize/50,iSize/50), RandomX(-iSize/50,iSize/50), RandomX(-2,2)+GetXDir()/2, RandomX(-2,2)+GetYDir()/2, iSize+Random(15)); + } + // Ausrichtung nach Caster + if (!iLaunchFree && pCaster) + { + var x=GetX(pCaster)+Sin(iAngle, 25), y=GetY(pCaster)-Cos(iAngle, 25); + if (GetX()!=x || GetY()!=y) + { + DrawParticleLine("Fire", x-GetX(), y-GetY(), 0, 0, 5, 40, 16777215, 16777215, 0); + SetPosition(x, y); + } + } + // Noch nicht voll aufgeladen? + if (iSize < iMaxSize) + { + for( var i=5; i>0; --i) + { + var iR, iD; + var iX=Sin(iR=Random(360), iD=RandomX(iSize/10,iSize/5)); + var iY=Cos(iR, iD); + CreateParticle("Fire", iX, iY, -iX/3, -iY/3, Random(25), RGBa(Random(255),0,0,90)); + CreateParticle("Fire2", iX, iY, -iX/3, -iY/3, Random(35)); + } + // Vergrößern + EffectVar(0, pTarget, iEffectNumber) = ++iSize; + // Nichts weiter während des Wachsens + return(1); + } + // Abschuss noch nicht freigegeben? + if (!iLaunchFree) return(1); + // Maximale Laufzeit + if(iEffectTime-iLaunchFree>550) return(RemoveObject()); + // Geschwindigkeit anpassen + SetXDir(Sin(iAngle, FIRB_Speed)); + SetYDir(-Cos(iAngle, FIRB_Speed)); + // Suche nach brennbaren Zielen + var pObj; + while(pObj=FindObject(0, 0, 1, 0, 0, OCF_Inflammable, 0, 0, NoContainer(), pObj)) + { + if(GBackLiquid(GetX(pObj), GetY(pObj))) continue; + if(GetOCF(pObj) & OCF_CrewMember) if (GetAlive(pObj)) return(Hit()); + if(iSizeBoost || !Random(3)) Incinerate(pObj); + } + // Zielen auf CrewMember - klappt wegen Winkelüberlauf schlecht gerade nach unten (was solls...) + var iMinAngleDiff = 360, iTargetAngle = iAngle; + while (pObj = FindObject(0, Sin(iAngle, FIRB_AimSearchRange)-FIRB_AimSearchRange/2, -Cos(iAngle, FIRB_AimSearchRange)-FIRB_AimSearchRange/2, FIRB_AimSearchRange, FIRB_AimSearchRange, OCF_CrewMember, 0,0, NoContainer(), pObj)) + { + if (!GetAlive(pObj)) continue; + var iThisTargetAngle = Angle(GetX(), GetY(), GetX(pObj), GetY(pObj)); + if (iThisTargetAngle > 180) iThisTargetAngle -= 360; + if (Abs(iThisTargetAngle - iAngle) < iMinAngleDiff) + { + iMinAngleDiff = Abs(iThisTargetAngle - iAngle); + iTargetAngle = iThisTargetAngle; + } + } + EffectVar(2, pTarget, iEffectNumber) = BoundBy(iTargetAngle, iAngle-FIRB_AimDirAdjust, iAngle+FIRB_AimDirAdjust); + // OK; weiter existieren + return(1); +} diff --git a/TemplePushing.c4s/System.c4g/Freeze.c b/TemplePushing.c4s/System.c4g/Freeze.c new file mode 100644 index 0000000..d10457e --- /dev/null +++ b/TemplePushing.c4s/System.c4g/Freeze.c @@ -0,0 +1,36 @@ +/*-- Freeze --*/ + +#strict + +#appendto FREZ + + +global func FxFreezeTimer(pTarget, iEffectNumber, iEffectTime) +{ + // In Lava schwimmend? Dann schnell auftauen (nur für Monster und andere nicht brennbare Lebewesen wichtig) + if(GetMaterialVal("Incindiary", "Material", pTarget->GetMaterial())) + return -1; + // Partikeleffekte für den betroffenen + var id = GetID(pTarget); + CreateParticle("NoGravSpark",GetX(pTarget)+RandomX(-GetDefWidth(id)/2, GetDefWidth(id)/2),GetY(pTarget)+RandomX(-GetDefHeight(id)/2, GetDefHeight(id)/2),0,RandomX(-2, -4),RandomX(18,28),RGB(10,120,210), pTarget); + CreateParticle("Freeze",GetX(pTarget),GetY(pTarget),0,0,EffectVar(1, pTarget, iEffectNumber)*5+20,RGB(0,40,80),pTarget); + // Runterzählen + EffectVar(0, pTarget, iEffectNumber)-=1; + if(EffectVar(0, pTarget, iEffectNumber)<=0) return FX_Execute_Kill; + // Ein bischen tut Einfrieren auch weh + var dmg=EffectVar(4, pTarget, iEffectNumber); + var r=2; + if(dmg) r=1; + + if(!Random(r)) { + var d=RandomX(1200,dmg); + EffectVar(4, pTarget, iEffectNumber)=BoundBy(dmg-d, 0, 0xffffff); + // Damit der richtige Spieler den Schaden verursacht + var pFrom = GetCursor(EffectVar(2, pTarget, iEffectNumber)); + if(pFrom) + pFrom->DoEnergy(-d*2,pTarget, true); + else + DoEnergy(-d*2, pTarget, true); + } + return FX_OK; +} \ No newline at end of file diff --git a/TemplePushing.c4s/System.c4g/Frostwave.c b/TemplePushing.c4s/System.c4g/Frostwave.c index d30db5e..682e502 100644 --- a/TemplePushing.c4s/System.c4g/Frostwave.c +++ b/TemplePushing.c4s/System.c4g/Frostwave.c @@ -1,99 +1,99 @@ /*-- Frostwave --*/ - + #strict 2 - + #appendto MFWV - + local maxRadius; - + protected func Initialize() { - maxRadius = 90; + maxRadius = 90; } - + func Activate(object caster, object realcaster) { - if (realcaster) caster = realcaster; - - if (AddEffect("FrostwaveNSpell", this, 130, 1, this, 0, caster, maxRadius) <= 0) - { - RemoveObject(); - return 1; - } - - Sound("MgWind*"); - return 1; + if (realcaster) caster = realcaster; + + if (AddEffect("FrostwaveNSpell", this, 130, 1, this, 0, caster, maxRadius) <= 0) + { + RemoveObject(); + return 1; + } + + Sound("MgWind*"); + return 1; } - + func FxFrostwaveNSpellStart(object target, int number, int temp, object caster, int maxRadius) { - if (temp) return; - - // Initial radius - EffectVar(1, target, number) = 20; - - // Position - EffectVar(2, target, number) = caster->GetX(); - EffectVar(3, target, number) = caster->GetY(); - - // Caster - EffectVar(4, target, number) = caster; - EffectVar(6, target, number) = caster->GetController(); - - // Maximum radius - EffectVar(7, target, number) = maxRadius; - - // Combo - var combo = caster->FindContents(ICE1); - if (combo) - { - EffectVar(5, target, number) = true; - combo->RemoveObject(); - } - - return 1; + if (temp) return; + + // Initial radius + EffectVar(1, target, number) = 20; + + // Position + EffectVar(2, target, number) = caster->GetX(); + EffectVar(3, target, number) = caster->GetY(); + + // Caster + EffectVar(4, target, number) = caster; + EffectVar(6, target, number) = caster->GetController(); + + // Maximum radius + EffectVar(7, target, number) = maxRadius; + + // Combo + var combo = caster->FindContents(ICE1); + if (combo) + { + EffectVar(5, target, number) = true; + combo->RemoveObject(); + } + + return 1; } - + func FxFrostwaveNSpellTimer(object target, int number, int time) { - var radius = EffectVar(1, target, number); - - // Remove if maximum radius is reached - if (radius >= EffectVar(7, target, number)) return -1; - - // Position - var absX = EffectVar(2, target, number), relX = AbsX(absX); - var absY = EffectVar(3, target, number), relY = AbsY(absY); - - // Combo? - var searchOCF = OCF_Alive; - if (EffectVar(5, target, number)) searchOCF |= OCF_Collectible; - - // Effects! - CreateParticle("FrostWave", relX, relY, RandomX(-1, 1), RandomX(-1, 1), 400 + 10 * radius, RGB(255, 255, 255)); - - // Fling enemies - var caster = EffectVar(4, target, number); - for (var obj in FindObjects( - Find_Distance(radius + 5, relX, relY), Find_Not(Find_Distance(radius - 5)), - Find_OCF(searchOCF), Find_NoContainer(), Find_Not(caster))) - { - var angle = Angle(absX, absY, obj->GetX(), obj->GetY()); - obj->SetKiller(EffectVar(6, target, number)); - Fling(obj, Sin(angle, 80) / 9, -Cos(angle, 80) / 9); - if (!Frozen(obj)) Freeze(obj, caster); - } - - // Increase radius - EffectVar(1, target, number) += 8; - - return 1; + var radius = EffectVar(1, target, number); + + // Remove if maximum radius is reached + if (radius >= EffectVar(7, target, number)) return -1; + + // Position + var absX = EffectVar(2, target, number), relX = AbsX(absX); + var absY = EffectVar(3, target, number), relY = AbsY(absY); + + // Combo? + var searchOCF = OCF_Alive; + if (EffectVar(5, target, number)) searchOCF |= OCF_Collectible; + + // Effects! + CreateParticle("FrostWave", relX, relY, RandomX(-1, 1), RandomX(-1, 1), 400 + 10 * radius, RGB(255, 255, 255)); + + // Fling enemies + var caster = EffectVar(4, target, number); + for (var obj in FindObjects( + Find_Distance(radius + 5, relX, relY), Find_Not(Find_Distance(radius - 5)), + Find_OCF(searchOCF), Find_NoContainer(), Find_Not(caster))) + { + var angle = Angle(absX, absY, obj->GetX(), obj->GetY()); + obj->SetKiller(EffectVar(6, target, number)); + Fling(obj, Sin(angle, 80) / 9, -Cos(angle, 80) / 9); + if (!Frozen(obj)) Freeze(obj, caster); + } + + // Increase radius + EffectVar(1, target, number) += 8; + + return 1; } - + /* Zaubercombo */ - + public func GetSpellClass() { return WATR; } public func GetSpellCombo() { return "335"; } // (1: Backward; 2: Down; 3: Forward; 4: Throw; 5: Jump; 6: Dig) - + /* Custom radius */ -public func SetMaxRadius(int radius) { maxRadius = radius; } +public func SetMaxRadius(int radius) { maxRadius = radius; } \ No newline at end of file diff --git a/TemplePushing.c4s/System.c4g/Ice.c b/TemplePushing.c4s/System.c4g/Ice.c index 329d013..9bfdc89 100644 --- a/TemplePushing.c4s/System.c4g/Ice.c +++ b/TemplePushing.c4s/System.c4g/Ice.c @@ -1,20 +1,21 @@ /*--- Eisklumpen ---*/ - + #strict 2 - + #appendto ICE1 - + local hit; - + protected func Hit() { - if (!hit) - { - var frostwave = CreateObject(MFWV, 0, 0, NO_OWNER); - frostwave->SetMaxRadius(60); - frostwave->Activate(this); - hit = true; - } - - return _inherited(); + if (!hit) + { + var frostwave = CreateObject(MFWV, 0, 0, NO_OWNER); + frostwave->SetMaxRadius(60); + frostwave->Activate(this); + hit = true; + } + + CastParticles("Snow", 50, 20, 0, 0, 50, 80, RGBa(120,120,255,0), RGBa(90,90,255,127)); + RemoveObject(); } \ No newline at end of file diff --git a/TemplePushing.c4s/System.c4g/IceBall.c b/TemplePushing.c4s/System.c4g/IceBall.c new file mode 100644 index 0000000..c9b67ab --- /dev/null +++ b/TemplePushing.c4s/System.c4g/IceBall.c @@ -0,0 +1,97 @@ +/*-- Iceball --*/ + +#strict + +#appendto ICEB + +public func ControlLeft() {} + +public func ControlRight() {} + +// Die restlichen Tasten mit Stop belegen, damit Klassisch auch gerade fliegen kann +public func ControlDig() {} + +public func ControlUp() {} + +public func ControlDown() {} + +// Bei JnR wenn die Taste losgelassen wird auch keine Drehung mehr +public func ControlLeftReleased() {} + +public func ControlRightReleased() {} + +// Werfen löst den Eisschlag aus +public func ControlThrow() {} + +func FxIceStrikeFlightTimer(pTarget, iEffectNumber, iEffectTime) + { + var iSize=EffectVar(0, pTarget, iEffectNumber); + var iMaxSize=EffectVar(1, pTarget, iEffectNumber); + var iAngle=EffectVar(2, pTarget, iEffectNumber)+=EffectVar(5, pTarget, iEffectNumber); + var iLaunchFree=EffectVar(3, pTarget, iEffectNumber); + var pCaster = EffectVar(4, pTarget, iEffectNumber); + if(iSize<=0) return(RemoveObject()); + + // Effekt + for( var i=1; i>0; --i) + { + CreateParticle("NoGravSpark",RandomX(-iSize/50,iSize/50), RandomX(-iSize/50,iSize/50), +RandomX(-2,2), +RandomX(-2,2), iSize*60/100+Random(15), RGB(10,RandomX(40,140),RandomX(250, 100))); + CreateParticle("Freeze",RandomX(-iSize/50,iSize/50), RandomX(-iSize/50,iSize/50), +RandomX(-2,2), +RandomX(-2,2), iSize*60/100+Random(15), RGB(10,RandomX(250,100),RandomX(40,140))); + } + + // Ausrichtung nach Caster + if (!iLaunchFree && pCaster) + { + var x=GetX(pCaster)+Sin(iAngle, 25), y=GetY(pCaster)-Cos(iAngle, 25); + if (GetX()!=x || GetY()!=y) + { + DrawParticleLine("Snow", x-GetX(), y-GetY(), 0, 0, 5, 40, 16777215, 16777215, 0); + SetPosition(x, y); + } + } + + // Noch nicht voll aufgeladen? + if (iSize < iMaxSize) + { + for( var i=5; i>0; --i) + { + var iR, iD; + var iX=Sin(iR=Random(360), iD=RandomX(iSize/10,iSize/5)); + var iY=Cos(iR, iD); + CreateParticle("Snow", iX, iY, -iX/3, -iY/3, Random(25), RGBa(Random(255),0,0,90)); + CreateParticle("Snow", iX, iY, -iX/3, -iY/3, Random(35)); + } + + // Vergrößern + EffectVar(0, pTarget, iEffectNumber) = iSize+=10; + + // Nichts weiter während des Wachsens + return(1); + } + + // Abschuss noch nicht freigegeben? + if (!iLaunchFree) return(1); + + // Maximale Laufzeit + if(iEffectTime-iLaunchFree>550) return(RemoveObject()); + + // Geschwindigkeit anpassen + SetXDir(Sin(iAngle, ICEB_Speed)); + SetYDir(-Cos(iAngle, ICEB_Speed)); + + // Suche nach Zielen + var pObj; + for(pObj in FindObjects(Find_AtPoint(0,1),Find_OCF(OCF_CrewMember),Find_NoContainer(),Find_Layer(GetObjectLayer()))) + { + if(GetOCF(pObj) & OCF_CrewMember) if (GetAlive(pObj)) return(Hit()); + } + + // OK; weiter existieren + return(1); + } + +func FxIceStrikeFlightStop(object pTarget, int iEffectNumber, int iReason, bool fTemp) + { + if (!fTemp) RemoveObject(pTarget); + return(1); + } diff --git a/TemplePushing.c4s/System.c4g/Icestrike.c b/TemplePushing.c4s/System.c4g/Icestrike.c new file mode 100644 index 0000000..ccff6a9 --- /dev/null +++ b/TemplePushing.c4s/System.c4g/Icestrike.c @@ -0,0 +1,38 @@ +/*-- Icestrike --*/ + +#strict 2 + +#appendto MICS + +func Activate(pCaller, pRealcaller) +{ + var pClonk; + if(pRealcaller) pClonk=pRealcaller; + else pClonk=pCaller; + + // Effekt prüfen + var iResult; + if (iResult = CheckEffect("IcestrikeNSpell", 0, 125)) return(iResult!=-1 && RemoveObject()); + + // Zauber + Sound("Magic*"); + var iX, iY; + iX=AbsX(GetX(pCaller)-25+50*GetDir(pCaller)); + iY=AbsY(GetY(pCaller)); + pBall=CreateObject(ICEB, AbsX(GetX(pCaller)-25+50*GetDir(pCaller)), AbsY(GetY(pCaller)), GetOwner(pCaller)); + pBall->SetCaster(pCaller); + + // Zielen wenn möglich + if (pClonk->~DoSpellAim(this(), pCaller)) return(1); + return(1); +} + +// Aktivierung nach Zielen (iAngle: -90=links; 0=oben; +90=rechts) +public func ActivateAngle(object pCaller, int iAngle) +{ + // Eisball freigeben (wenn noch existent) + if (pBall) pBall->SetAngle(iAngle); + + // Objekt löschen + return(RemoveObject()); +} \ No newline at end of file diff --git a/TemplePushing.c4s/System.c4g/LavaRain.c b/TemplePushing.c4s/System.c4g/LavaRain.c index 22369e0..b2c1552 100644 --- a/TemplePushing.c4s/System.c4g/LavaRain.c +++ b/TemplePushing.c4s/System.c4g/LavaRain.c @@ -4,7 +4,6 @@ global func FxLavaRainStart() { - SoundLevel("Rain", 10); return 1; } diff --git a/TemplePushing.c4s/System.c4g/Lenseflare.c b/TemplePushing.c4s/System.c4g/Lenseflare.c deleted file mode 100644 index 6de037a..0000000 --- a/TemplePushing.c4s/System.c4g/Lenseflare.c +++ /dev/null @@ -1,65 +0,0 @@ -/* Lenseflare */ - -#strict - -#appendto LENS - -protected func TuWasBraves() -{ - // Hat es seinen Besitzer verloren? :( - if((!GetPlayerName(GetOwner())) || GetOwner()==-1) - { - for(var i=0; i 0) SetDir(DIR_Right); else SetDir(DIR_Left); + obj->~LightningStrike(this); + Punch(obj, 12); + if(!Frozen(obj)) Freeze(obj); + DrawParticleLine ("LightningSpark2", iVtxX-GetX(), iVtxY-GetY(), + GetX(obj)-GetX(), GetY(obj)-GetY(), 6, 60, RGB(0,100,255)); + DrawParticleLine ("LightningSpark2", iVtxX-GetX(), iVtxY-GetY(), + GetX(obj)-GetX(), GetY(obj)-GetY(), 3, 25, RGB(250,250,255)); + } + return(Remove()); + } + + // Objektanziehung + iVtx = GetVertexNum()-1; iVtxX = GetVertex(iVtx, 0); iVtxY = GetVertex(iVtx, 1); + if (iVtx>7) + { + for (var obj in FindObjects( Find_AtRect(iVtxX-GetX()-13, iVtxY-GetY()-13, 26, 26), Find_Or(Find_OCF(OCF_Alive), Find_Func("IsForceField")), Find_Layer(GetObjectLayer()), Find_NoContainer() ) ) + { + if(!PathFree(iVtxX, iVtxY, GetX(obj), GetY(obj))) continue; + Attraction(obj); + break; + } + } + for(obj in FindObjects(Find_ID(GetID()), Find_Distance(35,iVtxX-GetX(), iVtxY-GetY()), Find_Layer(GetObjectLayer()), Find_Exclude(this()))) + { + AttractionLightning(obj); + break; + } + + Timer(); + // Weiter + return; +} \ No newline at end of file diff --git a/TemplePushing.c4s/System.c4g/Plague.c b/TemplePushing.c4s/System.c4g/Plague.c index ea80c2e..ec7268e 100644 --- a/TemplePushing.c4s/System.c4g/Plague.c +++ b/TemplePushing.c4s/System.c4g/Plague.c @@ -4,6 +4,20 @@ #appendto MGPL +protected func Slay() { + var pClonk; + while(pClonk=FindObject(0,-iRand/6,-iRand/6,iRand/3,iRand/3,OCF_Alive(),0,0,0, pClonk)) + if(GetActionTarget() != pClonk) + AddEffect("Poison",pClonk,182,10,0,GetID(), fSnake, GetActionTarget()); + RemoveObject(); +} + +func FxPoisonStart(object pClonk,int iEffectNumber, int iTemp, fSnake, pCaster) +{ + EffectVar(2, pClonk, iEffectNumber) = GetController(pCaster); + return _inherited(pClonk, iEffectNumber, iTemp, fSnake); +} + func FxPoisonTimer(pClonk, iEffectNumber, iEffectTime) { if(iEffectTime >= 1200) return(-1); @@ -13,7 +27,12 @@ func FxPoisonTimer(pClonk, iEffectNumber, iEffectTime) CreateParticle("PSpark", GetX(pClonk), GetY(pClonk), 0, -1, EffectVar(0, pClonk, iEffectNumber)*5+50, RGBa(fSnake*55, 55, 0), pClonk, 1); if(GBackLiquid(GetX(pClonk), GetY(pClonk))) return(-1); - if(!Random(7)) DoEnergy(-2, pClonk); + var pFrom = GetCursor(EffectVar(2, pClonk, iEffectNumber)); + if(!Random(5)) + { + if(pFrom) pFrom->DoEnergy(-2, pClonk); + else DoEnergy(-2, pClonk); + } var obj; var iRadius = EffectCall(pClonk,iEffectNumber,"MaxRange"); while(obj = FindObject(0, -iRadius+GetX(pClonk),-iRadius+GetY(pClonk),iRadius*2,iRadius*2, OCF_Alive(),0,0, NoContainer(), obj)) @@ -22,12 +41,12 @@ func FxPoisonTimer(pClonk, iEffectNumber, iEffectTime) { if(!GetAction(obj)S="Field") { - AddEffect("Poison",obj,182,10,0,MGPL,fSnake); + AddEffect("Poison",obj,182,10,0,MGPL,fSnake,pFrom); } } } return(1); } -func FxPoisonMaxRange() { return(100); } +func FxPoisonMaxRange() { return(175); } diff --git a/TemplePushing.c4s/System.c4g/Rain.c b/TemplePushing.c4s/System.c4g/Rain.c index c44285f..ed48a6d 100644 --- a/TemplePushing.c4s/System.c4g/Rain.c +++ b/TemplePushing.c4s/System.c4g/Rain.c @@ -4,7 +4,6 @@ global func FxRainStart() { - SoundLevel("Rain", 100); return 1; } diff --git a/TemplePushing.c4s/System.c4g/RotationHelper.c b/TemplePushing.c4s/System.c4g/RotationHelper.c new file mode 100644 index 0000000..8d86781 --- /dev/null +++ b/TemplePushing.c4s/System.c4g/RotationHelper.c @@ -0,0 +1,10 @@ + +#strict 2 + + +global func SetDTRotation (int r, int xoff, int yoff, object obj) +{ + var fsin=Sin(r, 1000), fcos=Cos(r, 1000); // set matrix values + SetObjDrawTransform ( +fcos, +fsin, (1000-fcos)*xoff - fsin*yoff, + -fsin, +fcos, (1000-fcos)*yoff + fsin*xoff, obj ); +} \ No newline at end of file diff --git a/TemplePushing.c4s/System.c4g/Scroll.c b/TemplePushing.c4s/System.c4g/Scroll.c index 7228fe0..6156e26 100644 --- a/TemplePushing.c4s/System.c4g/Scroll.c +++ b/TemplePushing.c4s/System.c4g/Scroll.c @@ -2,12 +2,28 @@ #appendto SCRL +static SCRL_spells; + protected func Initialize() { - var spells = [ABLA, MBOT, MFRB, MDBT, GVTY, MMTR, MLGT, CFAL, MSSH, MINV, MQKE, MARK, MFWV, MGFL, LAVS, MGPL, ICNL]; - if (mode == MODE_Festive) spells = [ABLA, MFWV, MICS, MLGT, MGPL, ICNL]; - - SetSpell(spells[Random(GetLength(spells))]); + SetSpell(SCRL_spells[Random(GetLength(SCRL_spells))]); return _inherited(); } + +public func SpellFailed(id idSpell, object pAimingClonk) +{ + // Spell canceled? Give back the scroll + SetSpell(idSpell); + if(pAimingClonk && !pAimingClonk->~RejectCollect(GetID(this), this)) + { + Enter(pAimingClonk, this); + } + pAimingClonk = 0; + return 0; +} + +global func SetScrollSpells(array spells) +{ + SCRL_spells = spells; +} diff --git a/TemplePushing.c4s/System.c4g/ShootInventory.c b/TemplePushing.c4s/System.c4g/ShootInventory.c index f310e61..b0260b5 100644 --- a/TemplePushing.c4s/System.c4g/ShootInventory.c +++ b/TemplePushing.c4s/System.c4g/ShootInventory.c @@ -11,6 +11,7 @@ #appendto SWOR #appendto SPER #appendto TSWB +#appendto METO protected func Activate(object clonk) { diff --git a/TemplePushing.c4s/System.c4g/Sun.c b/TemplePushing.c4s/System.c4g/Sun.c index 9a52923..7ad69a8 100644 --- a/TemplePushing.c4s/System.c4g/Sun.c +++ b/TemplePushing.c4s/System.c4g/Sun.c @@ -30,18 +30,4 @@ protected func TuWasBraves() // Sonnenposition anpassen BerechneSonne(); SetPosition(SonneX,SonneY); - // Nachts ausblenden - if(IsDay()) - SetVisibility (VIS_Owner()); - else - SetVisibility (VIS_None()); - // Bei Nähe zur Sonne blenden - var VektorDist=GibVektorDist(GetOwner()); - if(IsDay()) - { - var Gelbstich = BoundBy((500-VektorDist)/5,0,100); // Prozentangabe 0 = weit weg, 100 = nahe; 500 Pixel sind dabei "weit weg" - SetGamma (RGB(000+(30*Gelbstich)/100,000+(30*Gelbstich)/100,000), - RGB(128+(60*Gelbstich)/100,128+(60*Gelbstich)/100,128), - RGB(255,255,255), GammaRampe_Lenseflare()); - } } \ No newline at end of file diff --git a/TemplePushing.c4s/System.c4g/Vanish.c b/TemplePushing.c4s/System.c4g/Vanish.c index 1ad5222..702b776 100644 --- a/TemplePushing.c4s/System.c4g/Vanish.c +++ b/TemplePushing.c4s/System.c4g/Vanish.c @@ -6,6 +6,7 @@ #appendto FARW #appendto TSWB #appendto SPER +#appendto ICE1 protected func Hit() { @@ -16,7 +17,7 @@ protected func Hit() } else if (GetID() == SPER) { - Schedule("CastParticles(\"MSpark\", 20, 5, 0, 0, 25, 30, RGBa(128,128,255,0), RGBa(255,255,255,127))", 49, 0, 0); + Schedule("CastParticles(\"MSpark\", 20, 5, 0, 0, 25, 30, RGBa(255,128,128,0), RGBa(255,128,128,127))", 49, 0, 0); Schedule("RemoveObject()", 50, 0, 0); } else if (GetID() == TSWB) -- cgit v1.2.3-54-g00ecf