示例#1
0
global func DoBaseProduction(int plr, id def, int change)
{
	var base = FindObject(Find_ID(BaseMaterial), Find_Owner(plr));
	if (!base) 
		base = CreateObjectAbove(BaseMaterial, AbsX(10), AbsY(10), plr);
	if (base) 
		return base->DoBaseProd(def, change);
}
示例#2
0
global func GetBaseProduction(int plr, id def, int index, int category)
{
	var base = FindObject(Find_ID(BaseMaterial), Find_Owner(plr));
	if (!base)
		base = CreateObjectAbove(BaseMaterial, AbsX(10), AbsY(10), plr);
	if (base) 
		return base->GetBaseProd(def, index, category);
}
示例#3
0
global func SetBaseMaterial(int plr, id def, int cnt)
{
	var base = FindObject(Find_ID(BaseMaterial), Find_Owner(plr));
	if (!base) 
		base = CreateObjectAbove(BaseMaterial, AbsX(10), AbsY(10), plr);
	if (base)
		return base->SetBaseMat(def, cnt);
}
示例#4
0
func Activate(pCaller, pRealCaster)
{
  // Zauber
  Sound("Magic*");
  var iX, iY;
  iX=AbsX(GetX(pCaller)-15+30*GetDir(pCaller));
  iY=AbsY(GetY(pCaller));
  // Zielen wenn möglich
  if (!pRealCaster) pRealCaster = pCaller;
  if (pRealCaster->~DoSpellAim(this(), pCaller)) return(1);
    // Zielen wenn möglich
  if (pCaller->~DoSpellAim(this())) return(1);
  // Clonk kann nicht zielen:
  ActivateAngle(pCaller, GetDir(pCaller)*180-90);
  return(1);
  RemoveObject();
  return(1);
}
示例#5
0
public func Activate(oCaller, oClonk)
{                            
  if(!oClonk) oClonk = oCaller;
  // Effekt prüfen
  var iChkEff;
  if (iChkEff = CheckEffect("ExtinguishPSpell", oExtiObj, 180)) return(iChkEff!=-1 && RemoveObject());
  // Lavafässer zu Granit werden lassen
  var obj;
  if (obj = FindContents(LBRL, oClonk))
    if (!CheckEffect("ExtinguishPSpell", obj, 180))
    {
      var mat = "Granite";
      // Granit nicht geladen -> Stein casten
      if (!MaterialLoaded(Material(mat))) mat = "Rock";
      // Stein nicht geladen -> Kohle casten
      if (!MaterialLoaded(Material(mat))) mat = "Coal";
      // Material schleudern
      var amount = Min(400, obj->GetAmount()*3);
      CastPXS(mat, amount, 40, AbsX(GetX(oClonk)), AbsY(GetY(oClonk)));
      // Objekt entfernen
      RemoveObject(obj);
    }
  // Nächstes brennendes Objekt finden
  var oExtiObj, iExtiCount;
  // Den Clonk selbst?
  if(OnFire(oClonk)) 
    iExtiCount += DoExtinguish(oClonk, oCaller);
  // Nächstliegende Objekte
  SetPosition(GetX(oCaller), GetY(oCaller));
  // Suchradius ist abhängig von Höhe des Aufrufenden - ein Zauberturm hat einen größeren Radius
  var iSearchRadius = GetObjHeight(oCaller) * 3;
  while(oExtiObj = FindObject(0, 0, 0, -1, -1, 0, 0, 0, 0, oExtiObj))
    if(ObjectDistance(oCaller, oExtiObj) > iSearchRadius)
      break;
    else if(OnFire(oExtiObj))
      iExtiCount += DoExtinguish(oExtiObj, oCaller);
    else if (oExtiObj->~MagicExtinguish(oCaller))
      iExtiCount += DoExtinguish(oExtiObj, oCaller);
  // Irgendwas gelöscht?
  if (!iExtiCount) return(0, Message("$NoExtinguish$", oClonk), RemoveObject());
  // Einmaliger Effekt pro Zauber
  Sound("Splash1");
  return(true);
}
示例#6
0
public func Activate(caster, real_caster) {
  // Zaubernden Clonk ermitteln
  var clonk = caster;
  if (real_caster) clonk = real_caster;
  // Kombiniert mit Beton -> Clonk in den Boden stecken
  var obj;
  if (!Contained(clonk) && (obj = FindContents(CNCR, clonk))) {
    var height = GetDefCoreVal("Height", "DefCore", GetID(clonk));
    var radius = RandomX(25, 35);
    var x = GetX(clonk);
    var y = GetY(clonk);
    // Unter dem Clonk freischütteln und buddeln
    DigFree(x, y+height+radius, height/2);
    ShakeFree(x, y+height+(radius/2), radius);
    // Tiefstes freigeschüttelte Y-Position ermitteln
    while (!GBackSolid(AbsX(x), AbsY(y++ + height))) {}
    // Effekte!
    DrawParticleLine("MSpark",
      0, 0, 0, AbsY(y),
      height*3/2, height*5/2,
      RGBa(255-Random(50),255-Random(50), 0,128),
      RGBa(155-Random(50),155-Random(50), 0,128),
      -10);
    // Zauberer an ermittelte Stelle versetzen
    SetPosition(x, y, clonk);
    // Objekt entfernen
    RemoveObject(obj);
  }
  // Sonst normale Wirkung (Gravitation erhöhen)
  else {
    // Gravitation bereits auf Maximum?
    if (GetGravity() >= 290)
      return(0, Message("$MsgAlreadyMaxed$", caster), RemoveObject());
    // Sonst erhöhen
    // Effekt global starten
    if (!AddEffect("GravChangeUSpell", 0, 150, 80, 0, MGDW, 20))
      return(0, RemoveObject());
    Message("$MsgRaised$", caster, GetGravity());
  }
  Sound("Magic1");
  RemoveObject();
  return(1);
}
示例#7
0
global func FindPosInMat(string sMat, int iXStart, int iYStart, int iWidth, int iHeight, int iSize)
{
	var iX, iY;
	var iMaterial = Material(sMat);
	for(var i = 0; i < 500; i++)
	{
		iX = AbsX(iXStart+Random(iWidth));
		iY = AbsY(iYStart+Random(iHeight));
		if(GetMaterial(iX,iY)==iMaterial &&
		   GetMaterial(iX+iSize,iY+iSize)==iMaterial &&
		   GetMaterial(iX+iSize,iY-iSize)==iMaterial &&
		   GetMaterial(iX-iSize,iY-iSize)==iMaterial &&
		   GetMaterial(iX-iSize,iY+iSize)==iMaterial
		) {
			return [iX, iY]; // Location found.
		}
	}
	return 0; // No location found.
}
示例#8
0
文件: Script.c 项目: lluchs/ClonkMars
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);
}
示例#9
0
global func CreateWP(int x, int y) {
  var WP = CreateObject(WAYP,AbsX(x),AbsY(y+8),-1);
  return WP;
}
示例#10
0
public func Outro_Init(int for_plr)
{
	this.plr = for_plr;
	// Store villagers.
	this.village_head = Dialogue->FindByName("VillageHead")->GetDialogueTarget();
	this.farmer = Dialogue->FindByName("Farmer")->GetDialogueTarget();
	this.lookout = Dialogue->FindByName("Lookout")->GetDialogueTarget();
	this.lumberjack = Dialogue->FindByName("Lumberjack")->GetDialogueTarget();
	this.fireman = Dialogue->FindByName("Fireman")->GetDialogueTarget();
	this.builder = Dialogue->FindByName("Builder")->GetDialogueTarget();
	// Create two airplanes with pilots and let them fly from left to right.
	this.airplane1 = CreateObject(Airplane, AbsX(40), AbsY(160));
	this.pilot1 = CreateObject(Clonk);
	this.pilot1->SetSkin(2);
	this.pilot1->Enter(this.airplane1);
	this.pilot1->SetAction("Walk");
	this.pilot1->SetColor(0xff000000);
	this.airplane1->PlaneMount(this.pilot1);
	this.airplane1->FaceRight();
	this.airplane1->StartInstantFlight(90, 15);
	this.airplane1->SetXDir(12);
	this.airplane1->SetYDir(-1);
	this.airplane1->MakeInvincible();
	this.airplane1->SetColor(0xff000000);
	this.airplane1.BorderBound = 0;
	this.airplane2 = CreateObject(Airplane, AbsX(0), AbsY(190));
	this.pilot2 = CreateObject(Clonk);
	this.pilot2->SetSkin(2);
	this.pilot2->Enter(this.airplane2);
	this.pilot2->SetAction("Walk");
	this.pilot2->SetColor(0xff000000);
	this.airplane2->PlaneMount(this.pilot2);
	this.airplane2->FaceRight();
	this.airplane2->StartInstantFlight(90, 15);
	this.airplane2->SetXDir(12);
	this.airplane2->SetYDir(-1);
	this.airplane2->MakeInvincible();
	this.airplane2->SetColor(0xff000000);
	this.airplane2.BorderBound = 0;
	// Each plane has a henchman which will kidnap the wipfs.
	this.henchman1 = CreateObject(Clonk);
	this.henchman1->SetAlternativeSkin("Leather");
	this.henchman1->Enter(this.airplane1);
	this.henchman1->SetAction("Walk");
	this.henchman1->SetColor(0xff000000);
	this.henchman1->CreateContents(Blunderbuss)->CreateContents(LeadBullet);
	this.henchman2 = CreateObject(Clonk);
	this.henchman2->SetAlternativeSkin("Leather");
	this.henchman2->Enter(this.airplane2);
	this.henchman2->SetAction("Walk");
	this.henchman2->SetColor(0xff000000);
	this.henchman2->CreateContents(Blunderbuss)->CreateContents(LeadBullet);
	
	// Another henchman which will control the lookout.
	this.henchman3 = CreateObject(Clonk);
	this.henchman3->SetAlternativeSkin("Leather");	
	this.henchman3->Enter(this.airplane2);
	this.henchman3->SetAction("Walk");
	this.henchman3->SetColor(0xff000000);
	this.henchman3->CreateContents(Blunderbuss)->CreateContents(LeadBullet);
	
	// The faction leader which will do the talking.
	this.leader = CreateObject(Clonk);
	this.leader->SetAlternativeSkin("Doctor");
	this.leader->SetName("Gotham");
	this.leader->Enter(this.airplane1);
	this.leader->SetAction("Walk");
	this.leader->SetColor(0xff000000);
	this.leader->CreateContents(Blunderbuss)->CreateContents(LeadBullet);
	
	// There is also a kidnapper on an airship with a lorry to collect the wipfs.
	// The third henchman shoots down the balloons.
	this.airship = CreateObject(Airship, AbsX(20), AbsY(280));
	this.lorry = CreateObject(Lorry, AbsX(32), AbsY(280));
	this.kidnapper = CreateObject(Clonk, AbsX(30), AbsY(280));
	this.kidnapper->SetSkin(3);
	this.kidnapper->SetAction("Walk");
	this.kidnapper->SetCommand("Grab", this.airship);
	this.kidnapper->SetColor(0xff000000);
	this.airship->ControlRight(this.kidnapper);
	return true;
}