⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 playscn.pas

📁 传奇源代码的delphi版本
💻 PAS
📖 第 1 页 / 共 5 页
字号:
        case magnumb of
        39: begin
            meff.frame := 4;
            if wimg <> nil then
              meff.ImgLib:=wimg;
          end;
        38: begin
              meff.TargetActor := self;
              meff.MagExplosionBase := TDBBASE;
              meff.ExplosionFrame := 215;
              meff.Light := 2;
              meff.ImgLib:=wimg;
          end;
        56: begin
              meff := nil;
              PlaySound (10566);
          end;
          44: meff := nil;
        end;
        bofly := TRUE;
      end;
      mtExplosion:
        case magnumb of
          18: begin
            meff := TMagicEff.Create (magid, effnum, scx, scy, sctx, scty, mtype, Recusion, anitime);
            meff.MagExplosionBase := 1570;
            meff.TargetActor := target;
            meff.NextFrameTime := 80;
          end;
          21: begin
            meff := TMagicEff.Create (magid, effnum, scx, scy, sctx, scty, mtype, Recusion, anitime);
            meff.MagExplosionBase := 1660;
            meff.TargetActor := nil; //target;
            meff.NextFrameTime := 80;
            meff.ExplosionFrame := 20;
            meff.Light := 3;
          end;
          26: begin
            meff := TMagicEff.Create (magid, effnum, scx, scy, sctx, scty, mtype, Recusion, anitime);
            meff.MagExplosionBase := 3990;
            meff.TargetActor := target;
            meff.NextFrameTime := 80;
            meff.ExplosionFrame := 10;
            meff.Light := 2;
          end;
          27: begin
            meff := TMagicEff.Create (magid, effnum, scx, scy, sctx, scty, mtype, Recusion, anitime);
            meff.MagExplosionBase := 1800;
            meff.TargetActor := nil; //target;
            meff.NextFrameTime := 80;
            meff.ExplosionFrame := 10;
            meff.Light := 3;
          end;
          30: begin
            meff := TMagicEff.Create (magid, effnum, scx, scy, sctx, scty, mtype, Recusion, anitime);
            meff.MagExplosionBase := 3930;
            meff.TargetActor := target;
            meff.NextFrameTime := 80;
            meff.ExplosionFrame := 16;
            meff.Light := 3;
          end;
          31: begin
            meff := TMagicEff.Create (magid, effnum, scx, scy, sctx, scty, mtype, Recusion, anitime);
            meff.MagExplosionBase := 3850;
            meff.TargetActor := nil; //target;
            meff.NextFrameTime := 80;
            meff.ExplosionFrame := 20;
            meff.Light := 3;
          end;
          34: begin
            meff := TMagicEff.Create (magid, effnum, scx, scy, sctx, scty, mtype, Recusion, anitime);
            meff.MagExplosionBase := 140;
            meff.TargetActor := target; //target;
            meff.NextFrameTime := 80;
            meff.ExplosionFrame := 20;
            meff.Light := 3;
            if wimg <> nil then
              meff.ImgLib:=wimg;
          end;
          40: begin
            meff := TMagicEff.Create (magid, effnum, scx, scy, sctx, scty, mtype, Recusion, anitime);
            meff.MagExplosionBase := 620;
            meff.TargetActor := nil; //target;
            meff.NextFrameTime := 100;
            meff.ExplosionFrame := 20;
            meff.Light := 3;
            if wimg <> nil then
              meff.ImgLib:=wimg;
          end;
          45: begin
            meff := TMagicEff.Create (magid, effnum, scx, scy, scx, scy, mtype, Recusion, anitime);
            meff.MagExplosionBase := 920{920};
            meff.TargetActor := nil; //target;
            meff.NextFrameTime := 100;
            meff.ExplosionFrame := 20{20};
            meff.Light := 3;
            if wimg <> nil then
              meff.ImgLib:=wimg;
          end;
          47: begin
            meff := TMagicEff.Create (magid, effnum, scx, scy, sctx, scty, mtype, Recusion, anitime);
            meff.MagExplosionBase := 1010;
            meff.TargetActor := Target; //target;
            Meff.FixedEffect := False;
            meff.NextFrameTime := 100;
            meff.ExplosionFrame := 17;
            meff.Light := 3;
            meff.magnumber := magnumb;
            if wimg <> nil then
              meff.ImgLib:=wimg;
          end;
          48: begin
            meff := TMagicEff.Create (magid, effnum, scx, scy, sctx, scty, mtype, Recusion, anitime);
            meff.MagExplosionBase := 1060;
            meff.NextFrameTime := 50;
            meff.ExplosionFrame := 20;
            meff.Light := 3;
            if wimg <> nil then
              meff.ImgLib:=wimg;
          end;
          49: begin
            meff := TMagicEff.Create (magid, effnum, scx, scy, sctx, scty, mtype, TRUE, anitime);
            meff.MagExplosionBase := 1110;
            meff.TargetActor := nil; //target;
            meff.NextFrameTime := 100;
            meff.ExplosionFrame := 10;
            meff.Light := 3;
            if wimg <> nil then
              meff.ImgLib:=wimg;
          end;
          52: begin //Blizzard
            meff := TMagicEff.Create (magid, effnum, scx, scy, sctx, scty-SCREENHEIGHT, mtype, Recusion, anitime);
            meff.MagExplosionBase := 1550;
            meff.NextFrameTime := 70;
            meff.ExplosionFrame := 30;
            meff.ImgLib := g_WMagic2Images;
            PlaySound (10523);
          end;
          53: begin //MeteorShower
            meff := TMagicEff.Create (magid, effnum, scx, scy, sctx, scty-SCREENHEIGHT, mtype, Recusion, anitime);
            meff.NextFrameTime := 70;
            meff.MagExplosionBase := 1610;
            meff.ExplosionFrame := 30;
            meff.ImgLib := g_WMagic2Images;

            meff2 := TMagicEff.Create (magid, effnum, scx, scy, sctx, scty, mtype, Recusion, anitime);
            meff2.MagExplosionBase := 1600;
            meff2.NextFrameTime := 210;
            meff2.ExplosionFrame := 10;
            meff2.ImgLib := g_WMagic2Images;
            PlaySound (10533);
          end;
          57: meff := nil;
          else begin
            meff := TMagicEff.Create (magid, effnum, scx, scy, sctx, scty, mtype, Recusion, anitime);
            meff.TargetActor := target;
            meff.NextFrameTime := 80;
         end;
      end;
      mtFireWind:
         meff := nil;
      mtFireGun: 
         meff := TFireGunEffect.Create (930, scx, scy, sctx, scty);
      mtThunder: begin
        meff := TThuderEffect.Create (10, sctx, scty, nil); //target);
        meff.ExplosionFrame := 6;
        meff.ImgLib := g_WMagic2Images;
      end;
      mtRedThunder: begin
        meff := TRedThunderEffect.Create (230, sctx, scty, nil); //target);
        meff.ExplosionFrame := 6;
        //meff.ImgLib := g_WMagic2Images;
      end;
      mtFoxAnnoy: begin
        meff := TFoxAnnoyEffect.Create (2160, sctx, scty, nil); //target);
        meff.ExplosionFrame := 20;
      end;
      mtFoxThunder: begin
        meff := TFoxThunderEffect.Create (2120, sctx, scty, nil); //target);
        meff.ExplosionFrame := 20;
      end;

      mtLava: begin
        meff := TLavaEffect.Create (440, sctx, scty, nil); //target);
//        meff.ExplosionFrame := 6;
        //meff.ImgLib := g_WMagic2Images;
      end;
      mtRedFoxThunder: begin
        meff := TRedFoxThunderEffect.Create (780, sctx, scty, nil); //target);
        meff.ExplosionFrame := 10;
      end;
      mtRedFoxFire: begin
        meff := TRedFoxFireEffect.Create (790, sctx, scty, nil); //target);
        meff.ExplosionFrame := 10;
      end;
      mtIceSickle: begin
         meff := TIceSickle.Create (1790, scx, scy, sctx, scty, target);
      end;
      mtLightingThunder:
         meff := TLightingThunder.Create (970, scx, scy, sctx, scty, target);
      mtExploBujauk: begin
        case magnumb of
          10: begin  //
            meff := TExploBujaukEffect.Create (1160, scx, scy, sctx, scty, target);
            meff.MagExplosionBase := 1360;
          end;
          17: begin  //
            meff := TExploBujaukEffect.Create (1160, scx, scy, sctx, scty, target);
            meff.MagExplosionBase := 1540;
          end;
          54: begin  // 复活术
            meff := TExploBujaukEffect.Create (1160, scx, scy, sctx, scty, target);
            meff.ImgLib := g_WMagic2Images;
            meff.MagExplosionBase := 1220;
            PlaySound (10543);
          end;
          55: begin  // 毒云
            meff := TExploBujaukEffect.Create (1160, scx, scy, sctx, scty, target);
            meff.ImgLib := g_WMagic2Images;
            meff.MagExplosionBase := 1650;
            PlaySound (10553);
          end;
        end;
        bofly := TRUE;
      end;
      mtBujaukGroundEffect: begin
        meff := TBujaukGroundEffect.Create (1160, magnumb, scx, scy, sctx, scty);
        case magnumb of
          11: meff.ExplosionFrame := 16; //
          12: meff.ExplosionFrame := 16; //
          46: meff.ExplosionFrame := 24;
        end;
        bofly := TRUE;
      end;
      mtKyulKai: begin
        meff := nil; //TKyulKai.Create (1380, scx, scy, sctx, scty);
      end;
      mt12: begin

      end;
      mt13: begin
        meff := TMagicEff.Create (magid, effnum, scx, scy, sctx, scty, mtype, Recusion, anitime);
        if meff <> nil then begin
          case magnumb of
            32: begin
              meff.ImgLib := FrmMain.WMon21Img;
              meff.MagExplosionBase:=3580;
              meff.TargetActor := target;
              meff.Light := 5;
              meff.NextFrameTime := 20;
            end;
            37: begin
              meff.ImgLib := FrmMain.WMon22Img;
              meff.MagExplosionBase:=3520;
              meff.TargetActor := target;
              meff.Light := 5;
              meff.NextFrameTime := 100;
            end;
          end;
        end;
      end;
      mt14: begin
        meff := TThuderEffect.Create (140, sctx, scty, nil); //target);
        meff.ExplosionFrame := 10;
        meff.ImgLib := g_WMagic2Images;
      end;
      mt15: begin
        meff := TFlyingBug.Create (magid, effnum, scx, scy, sctx, scty, mtype, Recusion, anitime);
        meff.TargetActor := target;
        bofly:=True;
      end;
      mt16: begin

      end;
   end;
   
   if (meff = nil) then exit;
   meff.TargetRx := tx;
   meff.TargetRy := ty;
   if meff.TargetActor <> nil then begin
      meff.TargetRx := TActor(meff.TargetActor).m_nCurrX;
      meff.TargetRy := TActor(meff.TargetActor).m_nCurrY;
   end;
   meff.MagOwner := aowner;
   m_EffectList.Add (meff);

   if (meff2 = nil) then exit;
   meff2.TargetRx := tx;
   meff2.TargetRy := ty;
   if meff2.TargetActor <> nil then begin
      meff2.TargetRx := TActor(meff2.TargetActor).m_nCurrX;
      meff2.TargetRy := TActor(meff2.TargetActor).m_nCurrY;
   end;
   meff2.MagOwner := aowner;
   m_EffectList.Add (meff2);

end;

procedure TPlayScene.DelMagic (magid: integer);
var
   i: integer;
begin
   for i:=0 to m_EffectList.Count-1 do begin
      if TMagicEff(m_EffectList[i]).ServerMagicId = magid then begin
         TMagicEff(m_EffectList[i]).Free;
         m_EffectList.Delete (i);
         break;
      end;
   end;
end;

function  TPlayScene.NewFlyObject (aowner: TActor; cx, cy, tx, ty, targetcode: integer;  mtype: TMagicType): TMagicEff;
var
   i, scx, scy, sctx, scty: integer;
   meff: TMagicEff;
begin
   ScreenXYfromMCXY (cx, cy, scx, scy);
   ScreenXYfromMCXY (tx, ty, sctx, scty);
   case mtype of
      mtFlyArrow: meff := TFlyingArrow.Create (1, 1, scx, scy, sctx, scty, mtype, TRUE, 0);
      mt12: meff := TFlyingFireBall.Create (1, 1, scx, scy, sctx, scty, mtype, TRUE, 0);
      mt15: meff := TFlyingBug.Create (1, 1, scx, scy, sctx, scty, mtype, TRUE, 0);
      else meff := TFlyingAxe.Create (1, 1, scx, scy, sctx, scty, mtype, TRUE, 0);
   end;
   meff.TargetRx := tx;
   meff.TargetRy := ty;
   meff.TargetActor := FindActor (targetcode);
   meff.MagOwner := aowner;
   m_FlyList.Add (meff);
   Result := meff;
end;

{function  NewStaticMagic (aowner: TActor; tx, ty, targetcode, effnum: integer);
var
   i, scx, scy, sctx, scty, effbase: integer;
   meff: TMagicEff;
begin
   ScreenXYfromMCXY (cx, cy, scx, scy);
   ScreenXYfromMCXY (tx, ty, sctx, scty);
   case effnum of
      1: effbase := 340;
      else exit;
   end;

   meff := TLightingEffect.Create (effbase, 1, 1, scx, scy, sctx, scty, mtype, TRUE, 0);
   meff.TargetRx := tx;
   meff.TargetRy := ty;
   meff.TargetActor := FindActor (targetcode);
   meff.MagOwner := aowner;
   FlyList.Add (meff);
   Result := meff;
end;  }

{-------------------------------------------------------}

{procedure TPlayScene.ScreenXYfromMCXY (cx, cy: integer; var sx, sy: integer);
begin
   if Myself = nil then exit;
   sx := -UNITX*2 - Myself.ShiftX + AAX + 14 + (cx - Map.ClientRect.Left) * UNITX + UNITX div 2;
   sy := -UNITY*3 - Myself.ShiftY + (cy - Map.ClientRect.Top) * UNITY + UNITY div 2;
end; }

procedure TPlayScene.ScreenXYfromMCXY (cx, cy: integer; var sx, sy: integer);
begin
   if g_MySelf = nil then exit;
     if SWH = SWH800 then begin
       sx := (cx-g_MySelf.m_nRx)*UNITX + 364 + UNITX div 2 - g_MySelf.m_nShiftX;
       sy := (cy-g_MySelf.m_nRy)*UNITY + 192 + UNITY div 2 - g_MySelf.m_nShiftY;
       exit;
     end else
       sx := (cx-g_MySelf.m_nRx)*UNITX + 505 + UNITX div 2 - g_MySelf.m_nShiftX;
       sy := (cy-g_MySelf.m_nRy)*UNITY + 290 + UNITY div 2 - g_MySelf.m_nShiftY;
end;

//屏幕座标 mx, my转换成ccx, ccy地图座标
procedure TPlayScene.CXYfromMouseXY (mx, my: integer; var ccx

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -