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

📄 actor.pas

📁 Mir2 Actor.pas if (IsFace) and (FaceIndex > -1) then begin d := aFrmMain.WFaceimg.Images
💻 PAS
📖 第 1 页 / 共 5 页
字号:
    1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1,
    0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1,
    //静矾咙
    0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
    1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1,
    0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1
    ),

    (
    //沥瘤
    0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
    1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1,
    0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1,
    //叭扁
    0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
    1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
    0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1,
    //顿扁
    0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
    1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0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1, 1, 1, 1, 1, 1, 1, 1,
    1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1,
    0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1,
    //静矾咙
    0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
    1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1,
    0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1
    )
    );

  EffDir: array[0..7] of Byte = (0, 0, 1, 1, 1, 1, 1, 0);


type
  TActor = class
    RecogId: Integer;
    XX: Word;
    YY: Word;
    XX1: Word;
    YY1: Word;
    Dir: Byte;
    sex: Byte;
    Race: Byte;
    hair: Byte;
    dress: Byte;
    weapon: Byte;
    Job: Byte; //流诀 0:傈荤  1:贱荤  2:档荤
    Appearance: Word;
    DeathState: Byte;
    Feature: Integer;
    HorseState:Word;
    Horse,Wing:Byte;
    State: Integer;
    AttackState:Integer;
    AttackStateTime:Integer;
    Death: Boolean;
    DeathTime: DWord;
    Skeleton: Boolean;
    BoDelActor: Boolean;
    BoDelActionAfterFinished: Boolean;
    DescUserNameColor   :Tcolor;
    DescUserName: string;
    UserName: string;
    WorkName:String;
    NameColor: Integer;
    Abil: TAbility;
    gold: Integer;
    HitSpeed: shortint; //傍拜加档 0: 扁夯, (-)蠢覆 (+)狐抚
    Visible: Boolean;
    BoHoldPlace: Boolean;

    saying: array[0..MAXSAY - 1] of string;
    SayWidths: array[0..MAXSAY - 1] of Integer;
    SayTime: longword;
    SayX, SayY: Integer;
    SayLineCount: Integer;

    IsFace: Boolean;
    FaceIndex: Integer;
    FaceFram: Integer;
    FaceTime: Integer;
    FaceStartTime: Integer;
    EffectLightStarttime:Integer;
    IsAddBlood: Boolean;
    AddBloodNum: Integer;
    AddBloodFram: Integer;
    AddBloodTime: Integer;
    AddBloodStartTime: Integer;

    ShiftX: Integer;
    ShiftY: Integer;

    px, hpx, wpx, epx, horsex: Integer;
    py, hpy, wpy, epy, horsey: Integer;
    rx, ry: Integer;
    DownDrawLevel: Integer; //割 伎 捞傈俊 弊府霸 窃...
    targetx, targety: Integer;

    TargetRecog: Integer; //
    HiterCode: Integer;
    MagicNum: Integer;
    CurrentEvent: Integer; //辑滚狼 捞亥飘 酒捞叼
    BoDigFragment: Boolean; //捞锅 邦豹捞 龙捞 某脸绰瘤..
    BoThrow: Boolean;

    BodyOffset, HairOffset, WeaponOffset: Integer;
    BoUseMagic: Boolean;
    BoHitEffect: Boolean;
    BoUseEffect: Boolean; //瓤苞甫 荤侩窍绰瘤..
    HitEffectNumber: Integer;
    WaitMagicRequest: longword;
    WaitForRecogId: Integer; //磊脚捞 荤扼瘤搁 WaitFor狼 actor甫 visible 矫挪促.
    WaitForFeature: Integer;
    WaitForStatus: Integer;


    CurEffFrame: Integer;
    CurLightEffFram:Integer;
    SpellFrame: Integer; //付过狼 矫傈 橇贰烙
    CurMagic: TUseMagicInfo;
    //GlimmingMode: Boolean;
    //CurGlimmer: integer;
    //MaxGlimmer: integer;
    //GlimmerTime: longword;
    GenAniCount: Integer;
    BoOpenHealth: Boolean;
    BoInstanceOpenHealth: Boolean;
    OpenHealthStart: longword;
    OpenHealthTime: Integer;


    BodySurface: TDirectDrawSurface;

    Grouped: Boolean;
    CurrentAction: Integer;
    ReverseFrame: Boolean;
    WarMode: Boolean;
    WarModeTime: longword;
    ChrLight: Integer;
    MagLight: Integer;
    RushDir: Integer;

    LockEndFrame: Boolean;
    LastStruckTime: longword;
    SendQueryUserNameTime: longword;
    DeleteTime: longword;


    MagicStruckSound: Integer;
    borunsound: Boolean;
    footstepsound: Integer;
    strucksound: Integer;
    struckweaponsound: Integer;

    appearsound: Integer; //殿厘家府 0
    normalsound: Integer; //老馆家府 1
    attacksound: Integer; //         2
    weaponsound: Integer; //         3
    screamsound: Integer; //         4
    diesound: Integer;
    die2sound: Integer;

    magicstartsound: Integer;
    magicfiresound: Integer;
    magicexplosionsound: Integer;
  private
  protected
    startframe: Integer;
    endframe: Integer;
    currentframe: Integer;
    currentwingframe,PreWingFrame:integer;
    EffectLightFram:Integer;
    effectstart: Integer;
    EFFECTFRAME: Integer;
    effectend: Integer;
    effectstarttime: longword;
    effectframetime: longword;
    frametime: longword;
    starttime: longword;

    maxtick: Integer;
    curtick: Integer;
    movestep: Integer;
    msgmuch: Boolean;
    struckframetime: longword;
    currentdefframe: Integer;
    defframetime: longword;
    defframecount: Integer;
    SkipTick: Integer;
    smoothmovetime: longword;
    genanicounttime: longword;
    loadsurfacetime: longword;

    oldx, oldy, olddir: Integer;
    actbeforex, actbeforey: Integer; 
    wpord: Integer;

    procedure CalcActorFrame; dynamic;
    procedure DefaultMotion; dynamic;
    function GetDefaultFrame(wmode: Boolean): Integer; dynamic;
    procedure DrawEffSurface(dsurface, Source: TDirectDrawSurface; ddx, ddy:
      Integer; blend: Boolean; ceff: TColorEffect);
    procedure DrawWeaponGlimmer(dsurface: TDirectDrawSurface; ddx, ddy:
      Integer);
  public
    MsgList: TList; //list of PTChrMsg
    RealActionMsg: TChrMsg; //FrmMain俊辑 荤侩窃

    constructor Create; dynamic;
    destructor Destroy; override;
    procedure SendMsg(ident: Word; X, Y, cdir, Feature, State: Integer; Str:
      string; Sound: Integer);
    procedure UpdateMsg(ident: Word; X, Y, cdir, Feature, State: Integer; Str:
      string; Sound: Integer);
    procedure CleanUserMsgs;
    procedure ProcMsg;
    procedure ProcHurryMsg;
    function IsIdle: Boolean;
    function ActionFinished: Boolean;
    function CanWalk: Integer;
    function CanRun: Integer;
    function Strucked: Boolean;
    procedure Shift(Dir, step, cur, Max: Integer);
    procedure ReadyAction(msg: TChrMsg);
    function CharWidth: Integer;
    function CharHeight: Integer;
    function CheckSelect(dx, dy: Integer): Boolean;
    procedure CleanCharMapSetting(X, Y: Integer);
    procedure Say(Str: string);
    procedure SetSound; dynamic;
    procedure Run; dynamic;
    procedure RunSound; dynamic;
    procedure RunActSound(frame: Integer); dynamic;
    procedure RunFrameAction(frame: Integer); dynamic;
    //橇贰烙付促 刀漂窍霸 秦具且老
    procedure ActionEnded; dynamic;
    function Move(step: Integer): Boolean;
    procedure MoveFail;
    function CanCancelAction: Boolean;
    procedure CancelAction;
    procedure FeatureChanged; dynamic;
    function light: Integer; dynamic;
    procedure LoadSurface; dynamic;
    function GetDrawEffectValue: TColorEffect;
    procedure DrawAddBlood(dsurface: TDirectDrawSurface;dx, dy: Integer);
    procedure DrawChr(dsurface: TDirectDrawSurface; dx, dy: Integer; blend:
      Boolean); dynamic;
    procedure DrawEff(dsurface: TDirectDrawSurface; dx, dy: Integer); dynamic;
  end;

  TNpcActor = class(TActor)
  private
  public
    procedure Run; override;
    procedure CalcActorFrame; override;
    function GetDefaultFrame(wmode: Boolean): Integer; override;
    procedure LoadSurface; override;
  end;

  THumActor = class(TActor)
  private
    HairSurface: TDirectDrawSurface;
    WeaponSurface: TDirectDrawSurface;
    EffectSurface: TDirectDrawSurface;
    HorseSurface: TDirectDrawSurface;
    BoWeaponEffect: Boolean; //公扁 力访己傍,柄咙 瓤苞
    CurWpEffect: Integer;
    CurBubbleStruck: Integer;
    wpeffecttime: longword;
    BoHideWeapon: Boolean;

  protected
    procedure CalcActorFrame; override;
    procedure DefaultMotion; override;
    function GetDefaultFrame(wmode: Boolean): Integer; override;
  public
    constructor Create; override;
    destructor Destroy; override;
    procedure Run; override;
    procedure RunFrameAction(frame: Integer); override;
    function light: Integer; override;
    procedure LoadSurface; override;
    procedure DoWeaponBreakEffect;
    procedure DrawChr(dsurface: TDirectDrawSurface; dx, dy: Integer; blend:
      Boolean); override;

  end;

function RaceByPM(Race: Integer): PTMonsterAction;
function GetMonImg(appr: Integer): TWMImages;
function GetOffset(appr: Integer): Integer;



implementation

uses
  ClMain, SoundUtil, clEvent;


function RaceByPM(Race: Integer): PTMonsterAction;
begin
  Result := nil;
  case Race of
    9: Result := @MA9;
    10: Result := @MA10;
    11: Result := @MA11;
    12: Result := @MA12;
    13: Result := @MA13;
    14, 17, 18, 23: Result := @MA14;
    15, 22: Result := @MA15;
    24: Result := @MA30; //2004-03-05 带刀护卫
    16: Result := @MA16;
    31: Result := @MA17;
    19, 20, 21, 40, 45, 52, 25, 26, 27, 28, 29, 30, 56, 58, 62, 63, 64: Result
      := @MA19;
    41, 42: Result := @MA20;
    43: Result := @MA21;
    47: Result := @MA22;
    48, 49: Result := @MA23;
    32: Result := @MA24; //傈哎, 傍拜捞 2啊瘤 规侥
    33: Result := @MA25;
    34: Result := @MA34;
    35: Result := @MA35;
    36: Result := @MA36;
    37: Result := @MA37;
    53, 57: Result := @MA53;
    54: Result := @MA28;
    55: Result := @MA29;
    60: Result := @MA60;
    61: Result := @MA61;
    98: Result := @MA27;
    99: Result := @MA26;
    50: Result := @MA50;
  end;
end;

function GetMonImg(appr: Integer): TWMImages;
begin
  Result := aFrmMain.WMonImg; //Default
  case (appr div 10) of
    0: Result := aFrmMain.WMonImg; //
    1: Result := aFrmMain.WMon2Img; //侥牢檬
    2: Result := aFrmMain.WMon3Img;
    3: Result := aFrmMain.WMon4Img;
    4: Result := aFrmMain.WMon5Img;
    5: Result := aFrmMain.WMon6Img;
    6: Result := aFrmMain.WMon7Img;
    7: Result := aFrmMain.WMon8Img;
    8: Result := aFrmMain.WMon9Img;
    9: Result := aFrmMain.WMon10Img;
    10: Result := aFrmMain.WMon11Img;
    11: Result := aFrmMain.WMon12Img;
    12: Result := aFrmMain.WMon13Img;
    13: Result := aFrmMain.WMon14Img;
    14: Result := aFrmMain.WMon15Img;
    15: Result := aFrmMain.WMon16Img;
    16: Result := aFrmMain.WMon17Img;
    17: Result := aFrmMain.WMon18Img;
    18: Result := aFrmMain.WMon19Img;
    19: Result := aFrmMain.WMon20Img;
    20: Result := aFrmMain.WMon21Img;
    21: Result := aFrmMain.WMon22Img;
    22: Result := aFrmMain.WMon23Img;

   { 23: Result := aFrmMain.WMon24Img;
    24: Result := aFrmMain.WMon25Img;
    25: Result := aFrmMain.WMon26Img;
    26: Result := aFrmMain.WMon27Img;
    27: Result := aFrmMain.WMon28Img;
    28: Result := aFrmMain.WMon29Img;
    }
    30: Result := aFrmMain.WMon30Img;
    31: Result := aFrmMain.WMon31Img;
    32: Result := aFrmMain.WMon32Img;
    33: Result := aFrmMain.WMon33Img;
    34: Result := aFrmMain.WMon34Img;
    35: Result := aFrmMain.WMon35Img;
    36: Result := aFrmMain.WMon36Img;
    37: Result := aFrmMain.WMon37Img;
    90: Result := aFrmMain.WEffectImg; //己巩, 己寒
  end;
end;
{function GetOffset(appr: Integer): Integer;

⌨️ 快捷键说明

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