Exemplo n.º 1
0
func FxFireDashStop(object target, proplist effect, int reason, bool temporary)
{
	if(temporary)
		return;
	
	target->Unstuck();
	target->SetObjectLayer(nil);
	
	target->SetAction("Jump");
	ExplosionEffect(effect.Size2, target->GetX(), target->GetY(),0,0,0);
	
	for(var o in FindObjects(Find_Distance(effect.Size2, target->GetX(), target->GetY()), Find_Func("CanBeHit", target)))
	{
		if(o->GetOwner() == target->GetOwner())
			continue;
			
		var angle = Angle(target->GetX(), target->GetY(), o->GetX(), o->GetY());
		
		o->AddFireHitEffect();
		o->Fling(Sin(angle, 8), -Cos(angle, 8) - 2);
		target->WeaponDamage(o, effect.SpellDamage2);
	}
	
	target->CastObjects(Flame, RandomX(6,8), RandomX(10,25));
	//effect.marker->RemoveObject();
	//effect.clonk->MakeHitable(true);

}
Exemplo n.º 2
0
global func FxHitCheckDoCheck(object target, proplist effect)
{
    var obj;
    // rather search in front of the projectile, since a hit might delete the effect,
    // and clonks can effectively hide in front of walls.
    var oldx = target->GetX();
    var oldy = target->GetY();
    var newx = target->GetX() + target->GetXDir() / 10;
    var newy = target->GetY() + target->GetYDir() / 10;
    var dist = Distance(oldx, oldy, newx, newy);
    var is_human = GetPlayerType(target->GetController()) == C4PT_User;

    var shooter = effect.shooter;
    var live = effect.live;

    if (live)
        shooter = target;

    if (dist <= Max(1, Max(Abs(target->GetXDir()), Abs(target->GetYDir()))) * 2)
    {
        // We search for objects along the line on which we moved since the last check
        // and sort by distance (closer first).
        for (obj in FindObjects(Find_OnLine(oldx, oldy, newx, newy),
                                Find_NoContainer(),
                                Find_Layer(target->GetObjectLayer()),
                                Find_PathFree(target),
                                Sort_Distance(oldx, oldy)))
        {
            // Excludes
            if (!obj) continue; // hit callback of one object might have removed other objects
            if(obj == target) continue;
            if(obj == shooter) continue;
            if (is_human) {
                if (obj == g_windgen1) continue;
                if (obj == g_windgen2) continue;
                if (obj == g_windgen3) continue;
                if (obj == g_windmill) continue;
            }

            // Unlike in hazard, there is no NOFF rule (yet)
            // CheckEnemy
            //if(!CheckEnemy(obj,target)) continue;

            // IsProjectileTarget or Alive will be hit
            if (obj->~IsProjectileTarget(target, shooter) || obj->GetOCF() & OCF_Alive)
            {
                target->~HitObject(obj);
                if (!target)
                    return;
            }
        }
    }
    return;
}
Exemplo n.º 3
0
global func SetArrowToObj(object obj)
{
	if (arrow_target == obj) return 0;
  RemoveObject(FindObject(_AR1));
  CreateObject(_AR1, obj->GetX() + obj->GetDefCoreVal("Width") / 4, obj->GetY() - obj->GetDefCoreVal("Height") / 2 - 10, -1);
  arrow_target = obj;
}
Exemplo n.º 4
0
global func AddCyclopsAI(object clonk) // somewhat hacky, but it works
{
	var effect_name = "IntCyclopsAI";
	var fx = GetEffect(effect_name, clonk);
	if (!fx) fx = AddEffect(effect_name, clonk, 1, 2);
	if (!fx || !clonk) return nil;
	
	clonk.ai = fx;

	// bin inventory
	var cnt = clonk->ContentsCount();
	fx.bound_weapons = CreateArray(cnt);
	for (var i=0; i<cnt; ++i) fx.bound_weapons[i] = clonk->Contents(i);

	// set home
	fx.home_x = clonk->GetX();
	fx.home_y = clonk->GetY();
	fx.home_dir = DIR_Left;

	// set guard range
	fx.guard_range = {
                      x = fx.home_x-AI_DefGuardRangeX,
                      y = fx.home_y-AI_DefGuardRangeY,
                      wdt = AI_DefGuardRangeX*2,
                      hgt =  AI_DefGuardRangeY*2};
                      

	fx.spray_old = {time = 0, v0 = 0, v1 = 0, reach = 0};
	fx.spray_cur = {time = 0, v0 = 0, v1 = 0, reach = 0};

	AI->SetMaxAggroDistance(clonk, AI_DefMaxAggroDistance);
	return fx;
}
Exemplo n.º 5
0
global func FxGameKillzoneTimer(object target, proplist effect, int time)
{
	if (target->GetY() > 970)
	{
		target->Kill(target, true);
		return FX_Execute_Kill;
	}
}
Exemplo n.º 6
0
func SetBottom2(object host)
{
	SetGraphics("Bottom");
	SetAction("Bottom", host);
	SetShape(0,0,32,4);
	SetPosition(host->GetX()+13, host->GetY()+12);
	SetSolidMask(0,0,32,4);
	SetVertexXY(0,1-29,-27);
	return true;
}
Exemplo n.º 7
0
func SetLeft(object host)
{
	SetGraphics("Left");
	SetAction("Left", host);
	SetShape(0,0,4,32);
	SetPosition(host->GetX()-16, host->GetY()-16);
	SetSolidMask(0,0,2,32);
	SetVertexXY(0,1,1);
	return true;
}
Exemplo n.º 8
0
func SetTop(object host)
{
	SetGraphics("Top");
	SetAction("Top", host);
	SetShape(0,0,32,4);
	SetPosition(host->GetX()-16, host->GetY()-16);
	SetSolidMask(0,0,32,4);
	SetVertexXY(0,1,1);
	return true;
}
Exemplo n.º 9
0
func SetRight2(object host)
{
	SetGraphics("Right");
	SetAction("Right", host);
	SetShape(0,0,4,32);
	SetPosition(host->GetX()+15, host->GetY()-48);
	SetSolidMask(0,0,2,32,2,0);
	SetVertexXY(0,-27-3,1+32);
	return true;
}
Exemplo n.º 10
0
func Blocked(object clonk)
{
	AddEffect("Blocked", this, 1, 1, this);
	Sound("Ball::ball_blocked", false, 20);
	SetRDir(20);
	var objectangle = Angle(clonk->GetX(), clonk->GetY(), GetX(), GetY());
	
	//var tangle = 2* ( (objectangle + 90)%360 - entryangle) + entryangle;
	SetVelocity(objectangle, Speed);
	Idle();
}
Exemplo n.º 11
0
// Set the home position the Clonk returns to if he has no target
func SetHome(object clonk, int x, int y, int dir)
{
	var fx = GetEffect("S2AI", clonk);
	if (!fx || !clonk) return false;
	// nil/nil defaults to current position
	if (!GetType(x)) x=clonk->GetX();
	if (!GetType(y)) y=clonk->GetY();
	if (!GetType(dir)) dir=clonk->GetDir();
	fx.home_x = x; fx.home_y = y;
	fx.home_dir = dir;
	return true;
}
Exemplo n.º 12
0
func Launch(object clonk, int x, int y)
{
	if(clonk.TimeTravelMark == nil)
	{
		clonk.TimeTravelMark = [clonk->GetX(), clonk->GetY()];
		clonk.timeposfx = AddEffect("TravelPos", clonk, 1, 1, nil, GetID(), Size);
		clonk.timeposfx.size = Size;
		clonk.timeposfx.dur = Dur;
		clonk->Sound("travel_pos", false, 30, clonk->GetOwner());
		RemoveObject();
		return 1;
	}
Exemplo n.º 13
0
func JumpEffect(object clonk, dir)
{
	var from;
	var to;

	if (dir == "Up")
	{
		from = 50; 
		to = 130;
	}
	if (dir == "Left")
	{
		from = -30; 
		to = 50;
	}
	if (dir == "Right")
	{
		from = 130; 
		to = 210;
	}
	if (dir == "Down")
	{
		from = 230; 
		to = 310;
	}

	clonk->Sound("time_hit", false, 30);

	for(var i = from; i < to; i+=5)
	{
		var r = 10;
		var x = clonk->GetX() + Cos(i, r);
		var y = clonk->GetY() + Sin(i, r);
		
		var angle = Angle(0,0,Cos(i, r),Sin(i, r));
		
		var trailparticles =
		{
			Prototype = Particles_ElectroSpark2(),
			Size = PV_Linear(10,0),
			Rotation = angle,
			R = 255,
			G = 165,
			B = 50,
			OnCollision = PC_Bounce(),
		};
	
		CreateParticle("Lightning", x, y, Cos(i, r), Sin(i, r), 10, trailparticles);
	}
}
Exemplo n.º 14
0
func JumpEffect(object clonk, dir)
{
	var from;
	var to;

	if (dir == "Up")
	{
		from = 50; 
		to = 130;
	}
	if (dir == "Left")
	{
		from = -30; 
		to = 50;
	}
	if (dir == "Right")
	{
		from = 130; 
		to = 210;
	}
	if (dir == "Down")
	{
		from = 230; 
		to = 310;
	}

	Sound("hookjump", false, 30);

	for(var i = from; i < to; i+=5)
	{
		var r = 10;
		var x = clonk->GetX() + Cos(i, r);
		var y = clonk->GetY() + Sin(i, r);
		
		var angle = Angle(0,0,Cos(i, r),Sin(i, r));
		
		var trailparticles =
		{
			//Prototype = Particles_ElectroSpark2(),
			Size = PV_Linear(10,0),
			Rotation = angle,
			R = 150,
			G = 150,
			B = 150,
			OnCollision = PC_Bounce(),
		};
	
		CreateParticle("Shockwave", x, y, Cos(i, r + RandomX(-1,1)), Sin(i, r + RandomX(-1, 1)), 10, trailparticles);
	}
}
Exemplo n.º 15
0
func ControlUse(object clonk, x, y)
{
	var objdef = clonk.ObjectSpawnDefinition;
	
	
	if (objdef == Marker)
	{
		var marker = clonk->PlaceNewMarker();
		if (marker) marker->SetPosition(clonk->GetX() + x, clonk->GetY() + y);
	}
	else
	{
		clonk->CreateObject(objdef, x, y);
	}
	
	Sound("UI::Click", true, nil, clonk->GetOwner());
}
Exemplo n.º 16
0
func FxBallShieldStart(object target, proplist effect, int temporary)
{
	effect.dummy = CreateObject(Dummy, target->GetX(), target->GetY(), target->GetOwner());
	effect.dummy.Visibility = VIS_All;
	effect.dummy->SetAction("HangOnto", target);
	effect.shield = ShieldAmount;
	effect.cancel = false;
	
	var props =
		{
			R = 0,
			G = 0,
			B = 255,
			Alpha = 255,
			Size = 40,
			BlitMode = GFX_BLIT_Additive,
			Rotation = PV_Step(10, 0, 1),
			Attach = ATTACH_Back | ATTACH_MoveRelative
			
	};
	effect.dummy->CreateParticle("Shockwave", 0, 0, 0, 0, 0, props);
}
Exemplo n.º 17
0
func BlockEffect(object clonk, range)
{
	for(var i = 0; i < 360; i+=10)
	{
		var r = range;
		var x = clonk->GetX() + Cos(i, r);
		var y = clonk->GetY() + Sin(i, r);
		
		var angle = Angle(0,0,Cos(i, r),Sin(i, r)) + 90;
		
		var trailparticles =
		{
			Size = PV_Linear(15,0),
			Rotation = angle,
			R = 150,
			G = 150,
			B = 150,
		};
	
		CreateParticle("Shockwave", x, y, 0, 0, 10, trailparticles);
	}
	
}
Exemplo n.º 18
0
func BlockEffect(object clonk, range)
{
	for(var i = 0; i < 360; i+=10)
	{
		var r = range;
		var x = clonk->GetX() + Cos(i, r);
		var y = clonk->GetY() + Sin(i, r);
		
		var angle = Angle(0,0,Cos(i, r),Sin(i, r)) + 90;
		
		var trailparticles =
		{
			Prototype = Particles_ElectroSpark2(),
			Size = PV_Linear(15,0),
			Rotation = angle,
			R = 255,
			G = 165,
			B = 50,
		};
	
		CreateParticle("Lightning", x, y, 0, 0, 10, trailparticles);
	}
	
}
Exemplo n.º 19
0
global func Explode(int iLevel, object pObj, id idEffect, string szEffect)
{
  if(!pObj)
    if(!(pObj=this))
      return;
  
  var x = AbsX(pObj->GetX()),
  	  y = AbsY(pObj->GetY());
			
  var boom = FindObject(BOOM);
  if(!boom) boom = CreateObject(BOOM,0,0,-1);
			
	var xdir = GetXDir(pObj) + GetWind(GetX(pObj),GetY(pObj))/20;
	var ydir = GetYDir(pObj);
	
	var opt_angle = Angle(xdir,ydir);
	var speed = BoundBy(Distance(xdir,ydir),0,60);
  
	
	///Feuer-, Funken- und Dirt-Effekte...
  var i=0, count = 3+iLevel/8, angle = Random(360);
  while((count > 0) && (++i < count*10))
  {
    angle += RandomX(40,80);
    
    angle = Interpolate4K(angle,opt_angle,0,60,speed);
    angle -= 180;
        
    //Rauch
    var smokex = +Sin(angle,RandomX(iLevel/4,iLevel/2));
    var smokey = -Cos(angle,RandomX(iLevel/4,iLevel/2));
    if(GBackSolid(x+smokex,y+smokey))
      continue;
     var level = iLevel + Random(iLevel/5);

		var a = angle+RandomX(-15,+15);
		for(var i = 7; i > 0; i--)
		  CreateParticle("BlastSpark1", smokex, smokey, +Sin(a,level+RandomX(-5,+5)), -Cos(a,level+RandomX(-5,+5)), 25+Random(50)); 
    CreateParticle("BlastFlame", smokex, smokey, +Sin(angle,level/2), -Cos(angle,level/2), level*5);
    for(var i = Random(3)+1; i > 0; i--)
		{
		  a = angle+RandomX(-30,+30);
		  CreateParticle("BlastDirt", smokex, smokey, +Sin(a,level+RandomX(-20,+20)), -Cos(a,level+RandomX(-20,+20)), level*RandomX(7,12));
		}
		//CreateSmokeTrail(level,angle,smokex,smokey,pObj);
    count--;
  }

	///Brandspuren...
  // Wir haben keine Effekteinstellungen oä., daher immer an
  //if(EffectLevel() > EM4K_Low)
    CreateBurnMark(x,y,iLevel,20+iLevel/2);

  ///Lichteffekte bei Dunkelheit...
  if(IsDark())
  {
    var iSize = iLevel*100;
    if(iLevel < 20)
      iSize /= 2;
    AddLightFlash(iSize/3, x, y, RGBa(255,220,64,15));
  }
	
	///Feuer-Effekt..
	/*angle = Interpolate4K(0,opt_angle,0,120,speed);
	angle -= 180;
	CreateParticle("BlastBg",0,0,+Sin(angle,100),-Cos(angle,100),iLevel*20);
	//CreateParticle("BlastBg",0,0,0,-1,iLevel*20);
	*/
	
	///Der eigentliche Blast-Partikel...
	CreateParticle("Blast",x,y,0,0,iLevel*11);

	///Standart-Verhalten...
  return inherited(iLevel, pObj, idEffect, szEffect);
}
Exemplo n.º 20
0
public func ControlUse(object pClonk, int ix, int iy)
{
	AddEffect("HardeningSpell", nil, 100, 1, nil, GetID(), Angle(0,0,ix,iy),pClonk->GetX(), pClonk->GetY());
	RemoveObject();
	return 1;
}
Exemplo n.º 21
0
public func ControlUse(object pClonk, int ix, int iy)
{
	AddEffect("Frostbolt", nil, 100, 1, nil, GetID(), pClonk->GetOwner(), Angle(0,0,ix,iy),pClonk->GetX(), pClonk->GetY());
	Sound("Fireball");
	Sound("Fireball");
	RemoveObject();
	return 1;
}
Exemplo n.º 22
0
func FxFireDashTimer(object target, proplist effect, int time)
{
	var a = effect.angle;
		
	var x = target->GetX();
	var y = target->GetY();
	
	target->SetPosition(target->GetX() + Sin(a, 6, effect.angle_prec), target->GetY() + -Cos(a, 6, effect.angle_prec));

	for(var o in FindObjects(Find_Distance(effect.Size1, x, y), Find_Func("CanBeHit", target)))
	{
		if(o->GetOwner() == target->GetOwner())
			continue;
		if(!GetEffect("DashCD", o))
		{
			o->Fling(0, -5);
			AddEffect("DashCD", o, 20, 10);
			o->AddFireHitEffect();
			target->WeaponDamage(o, effect.SpellDamage1);
		}
		
	}
	
	var chaoticspark =
	{
		Size = PV_Linear(1, 0),
		ForceX = PV_KeyFrames(10, 0, PV_Random(-6, 6), 333, PV_Random(-6, -6), 666, PV_Random(6, 6), 1000, PV_Random(-6, 6)),
		ForceY = PV_KeyFrames(10, 0, PV_Random(-8, 5), 333, PV_Random(-8, 5), 666, PV_Random(-10, 10), 1000, PV_Random(-10, 15)),
		Stretch = PV_Speed(1000, 500),
		Rotation = PV_Direction(),
		CollisionVertex = 0,
		OnCollision = PC_Die(),
		R = 255,
		G = PV_Linear(255,100),
		B = PV_Random(0, 100),
		DampingX=950,
		DampingY=950,
		Alpha = PV_Random(100,180),
		BlitMode = GFX_BLIT_Additive
	};
	CreateParticle("Magic", x + RandomX(-5, 5), y + RandomX(-10, 10), RandomX(25, -25) + target->GetXDir(), RandomX(-25, 12) + target->GetYDir(), 50, chaoticspark, 4);


	var firetrailparticles =
	{
		Prototype = Particles_FireTrail(),
		Size = PV_Linear(effect.Size1,0),
		BlitMode = GFX_BLIT_Additive,
		OnCollision=nil,
	};
	CreateParticle("Fire", x, y, PV_Random(-7,7), PV_Random(-7,7), 20, firetrailparticles, 3);
	
	var dist = Distance(x, y, effect.startx + effect.tx, effect.starty + effect.ty);
	if(dist < 10 || (dist > effect.dist + 1 && time > 10))
	{
		effect.clonk->SetObjectLayer(nil);
		return -1;
	}
	else
	{
		//Log("%d %d", dist, effect.dist);
		effect.dist = dist;
	}
	
}
Exemplo n.º 23
0
public func ControlUse(object pClonk, int ix, int iy)
{
	AddEffect("WindScrollStorm", nil, 100, 1, nil, GetID(), Angle(0,0,ix,iy),pClonk->GetX(), pClonk->GetY());
	RemoveObject();
	return 1;
}