playscn.pas

来自「2009最新 传奇汉化0599代码 传奇汉化」· PAS 代码 · 共 1,884 行 · 第 1/5 页

PAS
1,884
字号
        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;
          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;
          end;
          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;
      mtLava: begin
        meff := TLavaEffect.Create (440, sctx, scty, nil); //target);
//        meff.ExplosionFrame := 6;
        //meff.ImgLib := g_WMagic2Images;
      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;
          55: begin  // PoisonCloud
            meff := TExploBujaukEffect.Create (1160, scx, scy, sctx, scty, target);
            meff.ImgLib := g_WMagic2Images;
            meff.MagExplosionBase := 1650;
          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;

//cx, cy, tx, ty : 甘狼 谅钎
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;

//傈扁筋绰 粱厚狼 付过贸烦 辨霸 唱啊绰 付过
//effnum: 阿 锅龋付促 Base啊 促 促福促.
{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, ccy: integer);
begin
   if g_MySelf = nil then exit;
     if SWH = SWH800 then begin
       ccx := UpInt((mx - 364 + g_MySelf.m_nShiftX - UNITX) / UNITX) + g_MySelf.m_nRx;
       ccy := UpInt((my - 192 + g_MySelf.m_nShiftY - UNITY) / UNITY) + g_MySelf.m_nRy;
       exit;
     end else
       ccx := UpInt((mx - 505 + g_MySelf.m_nShiftX - UNITX) / UNITX) + g_MySelf.m_nRx;
       ccy := UpInt((my - 290 + g_MySelf.m_nShiftY - UNITY) / UNITY) + g_MySelf.m_nRy;
end;

//拳搁谅钎肺 某腐磐, 侨伎 窜困肺 急琶..
function  TPlayScene.GetCharacter (x, y, wantsel: integer; var nowsel: integer; liveonly: Boolean): TActor;
var
   k, i, ccx, ccy, dx, dy: integer;
   a: TActor;
begin
   Result := nil;
   nowsel := -1;
   CXYfromMouseXY (x, y, ccx, ccy);
   for k:=ccy+8 downto ccy-1 do begin
      for i:=m_ActorList.Count-1 downto 0 do
         if TActor(m_ActorList[i]) <> g_MySelf then begin
            a := TActor(m_ActorList[i]);
            if (not liveonly or not a.m_boDeath) and (a.m_boHoldPlace) and (a.m_boVisible) then begin
               if a.m_nCurrY = k then begin
                  //歹 承篮 裹困肺 急琶登霸
                  dx := (a.m_nRx-Map.m_ClientRect.Left)*UNITX + m_nDefXX + a.m_nPx + a.m_nShiftX;
                  dy := (a.m_nRy-Map.m_ClientRect.Top-1)*UNITY + m_nDefYY + a.m_nPy + a.m_nShiftY;
                  if a.CheckSelect (x-dx, y-dy) then begin
                     Result := a;
                     Inc (nowsel);
                     if nowsel >= wantsel then
                        exit;
                  end;
               end;
            end;
         end;
   end;
end;

//取得鼠标所指坐标的角色
function  TPlayScene.GetAttackFocusCharacter (x, y, wantsel: integer; var nowsel: integer; liveonly: Boolean): TActor;
var
   k, i,

⌨️ 快捷键说明

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