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

📄 herbactor.pas

📁 在网上有很多传奇源程序DELPHI
💻 PAS
📖 第 1 页 / 共 2 页
字号:
begin
   inherited Create;
   Dir := 0;
   EffectSurface := nil;
   DownDrawLevel := 1;  //1伎 刚历 弊覆. (荤恩 赣府啊 己巩 关栏肺 甸绢啊绰 巴阑 阜澜)
end;

procedure TCastleDoor.ApplyDoorState (dstate: TDoorState);
var
   bowalk: Boolean;
begin
   Map.MarkCanWalk (XX, YY-2, TRUE);
   Map.MarkCanWalk (XX+1, YY-1, TRUE);
   Map.MarkCanWalk (XX+1, YY-2, TRUE);
   if dstate = dsClose then bowalk := FALSE
   else bowalk := TRUE;

   Map.MarkCanWalk (XX, YY, bowalk);
   Map.MarkCanWalk (XX, YY-1, bowalk);
   Map.MarkCanWalk (XX, YY-2, bowalk);
   Map.MarkCanWalk (XX+1, YY-1, bowalk);
   Map.MarkCanWalk (XX+1, YY-2, bowalk);
   Map.MarkCanWalk (XX-1, YY-1, bowalk);
   Map.MarkCanWalk (XX-1, YY, bowalk);
   Map.MarkCanWalk (XX-1, YY+1, bowalk);
   Map.MarkCanWalk (XX-2, YY, bowalk);

   if dstate = dsOpen then begin
      Map.MarkCanWalk (XX, YY-2, FALSE);
      Map.MarkCanWalk (XX+1, YY-1, FALSE);
      Map.MarkCanWalk (XX+1, YY-2, FALSE);
   end;
end;

procedure  TCastleDoor.LoadSurface;
var
   mimg: TWMImages;
begin
   inherited LoadSurface;
   mimg := GetMonImg (Appearance);
   if BoUseEffect then
      EffectSurface := mimg.GetCachedImage (DOORDEATHEFFECTBASE + (currentframe - startframe), ax, ay);
end;

procedure TCastleDoor.CalcActorFrame;
var
   pm: PTMonsterAction;
   haircount: integer;
begin
   BoUseEffect := FALSE;
   currentframe := -1;

   BodyOffset := GetOffset (Appearance);
   pm := RaceByPM (Race);
   if pm = nil then exit;
   UserName := ' ';

   case CurrentAction of
      SM_NOWDEATH:
         begin
            startframe := pm.ActDie.start;
            endframe := startframe + pm.ActDie.frame - 1;
            frametime := pm.ActDie.ftime;
            starttime := GetTickCount;
            Shift (Dir, 0, 0, 1);
            BoUseEffect := TRUE;
            ApplyDoorState (dsBroken);  //框流老 荐 乐霸
         end;
      SM_STRUCK:
         begin
            startframe := pm.ActStruck.start + Dir * (pm.ActStruck.frame + pm.ActStruck.skip);
            endframe := startframe + pm.ActStruck.frame - 1;
            frametime := pm.ActStand.ftime;
            starttime := GetTickCount;
            Shift (Dir, 0, 0, 1);
         end;
      SM_DIGUP:  //巩 凯覆
         begin
            startframe := pm.ActAttack.start;
            endframe := startframe + pm.ActAttack.frame - 1;
            frametime := pm.ActAttack.ftime;
            starttime := GetTickCount;
            ApplyDoorState (dsOpen);  //框流老 荐 乐霸
         end;
      SM_DIGDOWN:  //巩 摧塞
         begin
            startframe := pm.ActCritical.start;
            endframe := startframe + pm.ActCritical.frame - 1;
            frametime := pm.ActCritical.ftime;
            starttime := GetTickCount;
            BoDoorOpen := FALSE;
            BoHoldPlace := TRUE;
            ApplyDoorState (dsClose);  //给框流烙
         end;
      SM_DEATH:
         begin
            startframe := pm.ActDie.start + pm.ActDie.frame - 1;
            endframe := startframe;
            defframecount := 0;
            ApplyDoorState (dsBroken);  //框流老 荐 乐霸
         end;
      else  //规氢捞 绝澜...
         begin
            if Dir < 3 then begin
               startframe := pm.ActStand.start + Dir * (pm.ActStand.frame + pm.ActStand.skip);
               endframe := startframe; // + pm.ActStand.frame - 1;
               frametime := pm.ActStand.ftime;
               starttime := GetTickCount;
               defframecount := 0; //pm.ActStand.frame;
               Shift (Dir, 0, 0, 1);
               BoDoorOpen := FALSE;
               BoHoldPlace := TRUE;
               ApplyDoorState (dsClose);  //给框流捞霸
            end else begin
               startframe := pm.ActCritical.start;  //凯妨乐绰 惑怕
               endframe := startframe;
               defframecount := 0;

               BoDoorOpen := TRUE;
               BoHoldPlace := FALSE;
               ApplyDoorState (dsOpen);  //吧阑 荐 乐澜
            end;
         end;
   end;
end;

function  TCastleDoor.GetDefaultFrame (wmode: Boolean): integer;
var
   pm: PTMonsterAction;
begin
   BodyOffset := GetOffset (Appearance);
   pm := RaceByPM (Race);
   if pm = nil then exit;
   if Death then begin
      Result := pm.ActDie.start + pm.ActDie.frame - 1;
      DownDrawLevel := 2;
   end else begin
      if BoDoorOpen then begin
         DownDrawLevel := 2;
         Result := pm.ActCritical.start; // + Dir * (pm.ActStand.frame + pm.ActStand.skip);
      end else begin
         DownDrawLevel := 1;
         Result := pm.ActStand.start + Dir * (pm.ActStand.frame + pm.ActStand.skip);
      end;
   end;
end;

procedure  TCastleDoor.ActionEnded;
begin
   if CurrentAction = SM_DIGUP then begin  //巩凯覆
      BoDoorOpen := TRUE;
      BoHoldPlace := FALSE;
   end;
//   if CurrentAction = SM_DIGDOWN then
//      DefaultMotion;
end;

procedure  TCastleDoor.Run;
begin
   if (Map.CurUnitX <> oldunitx) or (Map.CurUnitY <> oldunity) then begin
      if Death then ApplyDoorState (dsBroken)
      else if BoDoorOpen then ApplyDoorState (dsOpen)
      else ApplyDoorState (dsClose);
   end;
   oldunitx := Map.CurUnitX;
   oldunity := Map.CurUnitY;
   inherited Run;
end;

procedure  TCastleDoor.DrawChr (dsurface: TDirectDrawSurface; dx, dy: integer; blend: Boolean);
begin
   inherited DrawChr (dsurface, dx, dy, blend);
   if BoUseEffect and not blend then
      if EffectSurface <> nil then begin
         DrawBlend (dsurface,
                    dx + ax + ShiftX,
                    dy + ay + ShiftY,
                    EffectSurface, 1);
      end;
end;



{----------------------------------------------------------------------}
//己寒


constructor TWallStructure.Create;
begin
   inherited Create;
   Dir := 0;
   EffectSurface := nil;
   BrokenSurface := nil;
   bomarkpos := FALSE;
   //DownDrawLevel := 1;
end;

procedure TWallStructure.CalcActorFrame;
var
   pm: PTMonsterAction;
   haircount: integer;
begin
   BoUseEffect := FALSE;
   currentframe := -1;

   BodyOffset := GetOffset (Appearance);
   pm := RaceByPM (Race);
   if pm = nil then exit;
   UserName := ' ';
   deathframe := 0;
   BoUseEffect := FALSE;

   case CurrentAction of
      SM_NOWDEATH:
         begin
            startframe := pm.ActDie.start;
            endframe := startframe + pm.ActDie.frame - 1;
            frametime := pm.ActDie.ftime;
            starttime := GetTickCount;
            deathframe := pm.ActStand.start + Dir;
            Shift (Dir, 0, 0, 1);
            BoUseEffect := TRUE;
         end;
      SM_DEATH:
         begin
            startframe := pm.ActDie.start + pm.ActDie.frame - 1;
            endframe := startframe;
            defframecount := 0;
         end;
      SM_DIGUP:  //葛嚼捞 函版瞪锭 付促
         begin
            startframe := pm.ActDie.start;
            endframe := startframe + pm.ActDie.frame - 1;
            frametime := pm.ActDie.ftime;
            starttime := GetTickCount;
            deathframe := pm.ActStand.start + Dir;
            BoUseEffect := TRUE;
         end;
      else  //规氢捞 绝澜...
         begin
            startframe := pm.ActStand.start + Dir; // * (pm.ActStand.frame + pm.ActStand.skip);
            endframe := startframe; // + pm.ActStand.frame - 1;
            frametime := pm.ActStand.ftime;
            starttime := GetTickCount;
            defframecount := 0; //pm.ActStand.frame;
            Shift (Dir, 0, 0, 1);
            BoHoldPlace := TRUE;
         end;
   end;
end;

procedure  TWallStructure.LoadSurface;
var
   mimg: TWMImages;
begin
   mimg := GetMonImg (Appearance);
   if deathframe > 0 then begin //(CurrentAction = SM_NOWDEATH) or (CurrentAction = SM_DEATH) then begin
      BodySurface := mimg.GetCachedImage (GetOffset (Appearance) + deathframe, px, py);
   end else begin
      inherited LoadSurface;
   end;
   BrokenSurface := mimg.GetCachedImage (GetOffset (Appearance) + 8 + Dir, bx, by);

   if BoUseEffect then begin
      if Appearance = 901 then
         EffectSurface := mimg.GetCachedImage (WALLLEFTBROKENEFFECTBASE + (currentframe - startframe), ax, ay)
      else
         EffectSurface := mimg.GetCachedImage (WALLRIGHTBROKENEFFECTBASE + (currentframe - startframe), ax, ay);
   end;
end;

function  TWallStructure.GetDefaultFrame (wmode: Boolean): integer;
var
   pm: PTMonsterAction;
begin
   BodyOffset := GetOffset (Appearance);
   pm := RaceByPM (Race);
   if pm = nil then exit;
    Result := pm.ActStand.start + Dir; // * (pm.ActStand.frame + pm.ActStand.skip);
end;

procedure TWallStructure.DrawChr (dsurface: TDirectDrawSurface; dx, dy: integer; blend: Boolean);
begin
   inherited DrawChr (dsurface, dx, dy, blend);
   if (BrokenSurface <> nil) and (not blend) then begin
      dsurface.Draw (dx + bx + ShiftX,
                     dy + by + ShiftY,
                     BrokenSurface.ClientRect,
                     BrokenSurface, TRUE);
   end;
   if BoUseEffect and (not blend) then begin
      if EffectSurface <> nil then begin
         DrawBlend (dsurface,
                    dx + ax + ShiftX,
                    dy + ay + ShiftY,
                    EffectSurface, 1);
      end;
   end;
end;

procedure  TWallStructure.Run;
begin
   if Death then begin
      if bomarkpos then begin
         Map.MarkCanWalk (XX, YY, TRUE);
         bomarkpos := FALSE;
      end;
   end else begin
      if not bomarkpos then begin
         Map.MarkCanWalk (XX, YY, FALSE);
         bomarkpos := TRUE;
      end;
   end;
   PlayScene.SetActorDrawLevel (self, 0);
   inherited Run;
end;


end.

⌨️ 快捷键说明

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