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

📄 playscn.pas

📁 在网上有很多传奇源程序DELPHI
💻 PAS
📖 第 1 页 / 共 5 页
字号:
      //if j = (meff.Ry - Map.BlockTop) then begin
      meff.DrawEff (ObjSurface);
      if ViewFog then begin
         AddLight (meff.Rx, meff.Ry, 0, 0, meff.Light, FALSE);
      end;
   end;
   if ViewFog then begin
      for k:=0 to EventMan.EventList.Count-1 do begin
         evn := TClEvent (EventMan.EventList[k]);
         if evn.light > 0 then
            AddLight (evn.X, evn.Y, 0, 0, evn.light, FALSE);
      end;
   end;
   except
      DebugOutStr ('109');
   end;

   //顶俊 冻绢柳 酒捞袍 湖娄芭府绰 芭
   try
      for k:=0 to DropedItemList.Count-1 do begin
         pd := PTDropItem (DropedItemList[k]);
         if pd <> nil then begin
            if GetTickCount - pd.FlashTime > 5 * 1000 then begin
               pd.FlashTime := GetTickCount;
               pd.BoFlash := TRUE;
               pd.FlashStepTime := GetTickCount;
               pd.FlashStep := 0;
            end;
            if pd.BoFlash then begin
               if GetTickCount - pd.FlashStepTime >= 20 then begin
                  pd.FlashStepTime := GetTickCount;
                  Inc (pd.FlashStep);
               end;
               ix := (pd.x-Map.ClientRect.Left)*UNITX+defx + SOFFX;
               iy := (pd.y-Map.ClientRect.Top-1)*UNITY+defy + SOFFY;
               if (pd.FlashStep >= 0) and (pd.FlashStep < 10) then begin
                  DSurface := FrmMain.WProgUse.GetCachedImage (FLASHBASE+pd.FlashStep, ax, ay);
                  DrawBlend (ObjSurface, ix+ax, iy+ay, DSurface, 1);
               end else
                  pd.BoFlash := FALSE;
            end;
         end;
      end;
   except
      DebugOutStr ('110');
   end;

   try
   if ViewFog then begin
      ApplyLightMap;
      DrawFog (ObjSurface, PFogScreen, FogWidth);
      MSurface.Draw (SOFFX, SOFFY, ObjSurface.ClientRect, ObjSurface, FALSE);
   end else begin
      if Myself.Death then
         DrawEffect (0, 0, ObjSurface.Width, ObjSurface.Height, ObjSurface, ceGrayScale);
      //坷宏璃飘 饭捞绢客  硅版苞 钦己
      MSurface.Draw (SOFFX, SOFFY, ObjSurface.ClientRect, ObjSurface, FALSE);
   end;
   except
      DebugOutStr ('111');
   end;

   if BoViewMiniMap then begin
      DrawMiniMap (MSurface);
   end;


end;

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

//cx, cy, tx, ty : 甘狼 谅钎
procedure TPlayScene.NewMagic (aowner: TActor;
                               magid, magnumb, cx, cy, tx, ty, targetcode: integer;
                               mtype: TMagicType;
                               Recusion: Boolean;
                               anitime: integer;
                               var bofly: Boolean);
var
   i, scx, scy, sctx, scty, effnum: integer;
   meff: TMagicEff;
   target: TActor;
   wimg: TWMImages;
begin
   bofly := FALSE;
   if magid <> 111 then //惯荤 付过篮 吝汗凳.
      for i:=0 to EffectList.Count-1 do
         if TMagicEff(EffectList[i]).ServerMagicId = magid then
            exit; //捞固 乐澜..
   ScreenXYfromMCXY (cx, cy, scx, scy);
   ScreenXYfromMCXY (tx, ty, sctx, scty);
   if magnumb > 0 then GetEffectBase (magnumb-1, 0, wimg, effnum)
   else effnum := -magnumb;
   target := FindActor (targetcode);

   meff := nil;
   case mtype of
      mtReady, mtFly, mtFlyAxe:
         begin
            meff := TMagicEff.Create (magid, effnum, scx, scy, sctx, scty, mtype, Recusion, anitime);
            meff.TargetActor := target;
            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;
            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 (950, sctx, scty, nil); //target);
            meff := TThuderEffect.Create (10, sctx, scty, nil); //target);
            meff.ExplosionFrame := 6;
            meff.ImgLib := FrmMain.WMagic2;
         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;
            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; //措瘤盔龋
            end;
            bofly := TRUE;
         end;
      mtKyulKai:
         begin
            meff := nil; //TKyulKai.Create (1380, scx, scy, sctx, scty);
         end;
   end;
   if meff = nil then exit;

   meff.TargetRx := tx;
   meff.TargetRy := ty;
   if meff.TargetActor <> nil then begin
      meff.TargetRx := TActor(meff.TargetActor).XX;
      meff.TargetRy := TActor(meff.TargetActor).YY;
   end;
   meff.MagOwner := aowner;
   EffectList.Add (meff);
end;

procedure TPlayScene.DelMagic (magid: integer);
var
   i: integer;
begin
   for i:=0 to EffectList.Count-1 do begin
      if TMagicEff(EffectList[i]).ServerMagicId = magid then begin
         TMagicEff(EffectList[i]).Free;
         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);
      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;
   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 Myself = nil then exit;
   sx := (cx-Myself.Rx)*UNITX + 364 + UNITX div 2 - Myself.ShiftX;
   sy := (cy-Myself.Ry)*UNITY + 192 + UNITY div 2 - Myself.ShiftY;
end;

//胶农赴狼 mx, my肺 甘狼 ccx, ccy谅钎甫 掘绢晨
procedure TPlayScene.CXYfromMouseXY (mx, my: integer; var ccx, ccy: integer);
begin
   if Myself = nil then exit;
   ccx := UpInt((mx - 364 + Myself.ShiftX - UNITX) / UNITX) + Myself.Rx;
   ccy := UpInt((my - 192 + Myself.ShiftY - UNITY) / UNITY) + Myself.Ry;
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:=ActorList.Count-1 downto 0 do
         if TActor(ActorList[i]) <> Myself then begin
            a := TActor(ActorList[i]);
            if (not liveonly or not a.Death) and (a.BoHoldPlace) and (a.Visible) then begin
               if a.YY = k then begin
                  //歹 承篮 裹困肺 急琶登霸
                  dx := (a.Rx-Map.ClientRect.Left)*UNITX+DefXX + a.px + a.ShiftX;
                  dy := (a.Ry-Map.ClientRect.Top-1)*UNITY+DefYY + a.py + a.ShiftY;
                  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, ccx, ccy, dx, dy, centx, centy: integer;
   a: TActor;
begin
   Result := GetCharacter (x, y, wantsel, nowsel, liveonly);
   if Result = nil then begin
      nowsel := -1;
      CXYfromMouseXY (x, y, ccx, ccy);
      for k:=ccy+8 downto ccy-1 do begin
         for i:=ActorList.Count-1 downto 0 do
            if TActor(ActorList[i]) <> Myself then begin
               a := TActor(ActorList[i]);
               if (not liveonly or not a.Death) and (a.BoHoldPlace) and (a.Visible) then begin
                  if a.YY = k then begin
                     //
                     dx := (a.Rx-Map.ClientRect.Left)*UNITX+DefXX + a.px + a.ShiftX;
                     dy := (a.Ry-Map.ClientRect.Top-1)*UNITY+DefYY + a.py + a.ShiftY;
                     if a.CharWidth > 40 then centx := (a.CharWidth - 40) div 2
                     else centx := 0;
                     if a.CharHeight > 70 then centy := (a.CharHeight - 70) div 2
                     else centy := 0;
                     if (x-dx >= centx) and (x-dx <= a.CharWidth-centx) and (y-dy >= centy) and (y-dy <= a.CharHeight-centy) then begin
                        Result := a;
                        Inc (nowsel);
                        if nowsel >= wantsel then
                           exit;
                     end;
                  end;
               end;
            end;
      end;
   end;
end;

function  TPlayScene.IsSelectMyself (x, y: integer): Boolean;
var
   k, i, ccx, ccy, dx, dy: integer;
begin
   Result := FALSE;
   CXYfromMouseXY (x, y, ccx, ccy);
   for k:=ccy+2 downto ccy-1 do begin
      if Myself.YY = k then begin
         //歹 承篮 裹困肺 急琶登霸
         dx := (Myself.Rx-Map.ClientRect.Left)*UNITX+DefXX + Myself.px + Myself.ShiftX;
         dy := (Myself.Ry-Map.ClientRect.Top-1)*UNITY+DefYY + Myself.py + Myself.ShiftY;
         if Myself.CheckSelect (x-dx, y-dy) then begin
            Result := TRUE;
            exit;
         end;
      end;
   end;
end;

⌨️ 快捷键说明

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