Example #1
0
public func Activate(caster, real_caster)
{
  var clonk = caster;
  if (real_caster) clonk = real_caster;
  
  Sound("Magic1");

  var iChkEff;
  if (iChkEff = CheckEffect("FirefistNSpell", 0, 130)) return(iChkEff!=-1 && RemoveObject());

  var obj, nocrcnt;
  if (InLiquid(clonk) && (obj = FindContents(METL, clonk)))
    {
    var torpedo;
    SetDir(DIR_Left(),  torpedo=CreateObject(TRP1,-15,+10,-1));
    if (torpedo)
      {
      torpedo->Launch(torpedo); // Kleiner Trick damit das Torpedo in die richtige Richtung schwimmt
      torpedo->SetController(GetOwner(clonk)); // Damit eventuelle Tötungen auch gezählt werden
      }
    else ++nocrcnt;
    SetDir(DIR_Right(), torpedo=CreateObject(TRP1,+15,+10,-1));
    if (torpedo)
      {
      torpedo->Launch(torpedo); 
      torpedo->SetController(GetOwner(clonk));
      }
    else ++nocrcnt;
    if (nocrcnt < 2) RemoveObject(obj);
    }
  else
    {
    var firefist=CreateObject(FSHW,-15,0,GetOwner(clonk));
    if (firefist)
      {
      firefist->SetController(GetOwner(clonk));
      ObjectSetAction(firefist,"Left");
      }
    else ++nocrcnt;
    
    firefist=CreateObject(FSHW,+15,0,GetOwner(clonk));
    if (firefist)
      {
      firefist->SetController(GetOwner(clonk));
      ObjectSetAction(firefist,"Right");
      }
    else ++nocrcnt;
  }
  
  RemoveObject();
  return(nocrcnt < 2);
}
Example #2
0
public func Activate(caster, real_caster) {
  // Zaubernden Clonk ermitteln
  var clonk = caster;
  if (real_caster) clonk = real_caster;

  // Richtungsvorzeichen ermitteln
  var dir_sign = -1;
  if (GetDir(caster) == DIR_Right()) dir_sign = +1;

  // Evtl. mit Flint kombinieren
  var obj;
  if (obj = FindContents(FLNT, clonk)) {
    // Holz erzeugen, anzünden und in Guckrichtung schleudern
    var wood = CreateObject(WOOD, 5*dir_sign, 0, -1);
    Incinerate(wood);
    // Richtigen Controller setzen
    SetController(GetController(clonk),wood);
    SetXDir(40*dir_sign, wood);
    SetYDir(-10, wood);
    // Flint verbrauchen
    RemoveObject(obj);
  }
  // Evtl. mit Pfeil kombinieren
  else
  {
    obj = FindContents(ARRW, clonk);
    if(!obj) if(FindContents(ARWP, clonk))
      obj = FindContents(ARWP, clonk)->GetItem();
    if(obj) {
      // Ein paar Objekte schleudern
      var fling_cnt = RandomX(4, 10);
      var fling_obj;
      while (fling_obj = FindObject(0, 0, 0, -1, -1, OCF_InFree(), 0, 0, NoContainer(), fling_obj)) {
        // Zu weit weg vom Clonk?
        if (ObjectDistance(clonk, fling_obj) > 5*GetDefCoreVal("Width", "DefCore", GetID(caster)))
          break;
        // Der Wolf konnte keine Steinhütten wegblasen - Clonks können keine Hütten mit Fundament wegblasen
        if (!LocalN("basement", fling_obj))
          {
          var pBasement = Local(9, fling_obj);
          if (GetType(pBasement) != C4V_C4Object()) pBasement=0;
          if (pBasement) if (!PrivateCall(pBasement, "BasementID")) pBasement=0;
          if (!pBasement)
            {
            SetXDir(dir_sign*Min(80, 80*350/GetMass(fling_obj)), fling_obj);
            SetYDir(-Min(20, 20/GetMass(fling_obj)), fling_obj);
            // Bei Objekten noch den Controller anpassen
            if(GetCategory(fling_obj) & C4D_Object())
              SetController(GetController(clonk),fling_obj);
            }
          }
        // Schon genügend Objekte geschleudert?
        if (!fling_cnt--) break;
      }
      if (!Contained(clonk)) {
        Fling(clonk, 8*dir_sign, -2);
      }
      // Pfeil verbrauchen
      RemoveObject(obj);
    }
    // Sonst normale Wirkung
    else {
      AddEffect("WindUSpell", 0, 104, 50, 0, GetID(), GetDir(caster));
      Sound("Wind2");
    }
  }
  
  RemoveObject();
  return(1);
}