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

📄 objys.pas

📁 继续更新AFT源代码 现在解决了无法登陆游戏的问题 用0504的dbserver就可以登陆了 去掉了绿字广告 降低内存占用HOO 去掉了大量的验证问题
💻 PAS
字号:
unit Objys;

interface
uses
   Windows,Classes,Grobal2,ObjBase,sysutils,HUtil32;
type
  TMonsteys = class(Tplayobject)
    n54C           :Integer;     //0x54C
    m_dwThinkTick  :LongWord;    //0x550
    m_dwuseskilltick: LongWord;
    m_nNextSkillTime:Integer;
    bo554          :Boolean;     //0x554
    m_boDupMode    :Boolean; //0x555
    m_btUsePoison    :integer;
    toonear:boolean;
    ADDHPMODE:BOOLEAN;
  private
    function Think: Boolean;
  public

    constructor Create();override;
    destructor Destroy; override;
    function  Operate(ProcessMsg:pTProcessMessage):Boolean; override;//FFFC
    function magAttackTarget():Boolean; virtual; //FFEB
    function AttackTarget():Boolean; virtual; //FFEB
    procedure Run; override;

  end;


implementation
uses UsrEngn, M2Share;
{ TMonsteys }

function TMonsteys.magAttackTarget: Boolean;
var
  bt06:Byte;
  nX,nY:INTEGER;
  UserMagic:pTUserMagic;
  doskill:boolean;
begin
  Result:=False;
  toonear:=false;
  if m_TargetCret <> nil then begin
    if (abs(m_nCurrX - m_TargetCret.m_nCurrX) <= 5) and (abs(m_nCurry - m_TargetCret.m_nCurry) <= 5) then   begin  // GetAttackDir(m_TargetCret,bt06)
      if Integer(GetTickCount - m_dwHitTick) > m_nNextHitTime  then begin
         m_dwHitTick:=GetTickCount();
         m_dwTargetFocusTick:=GetTickCount();



      if not toonear then begin      //距离够了
         doskill:=false;




         UserMagic:=GetMagicInfo(nskill); // 狂龙紫电
         if (UserMagic<>nil) and (not doskill) then
        //   if  MagicManager.DoSpell(Self,UserMagic,m_TargetCret.m_nCurrX,m_TargetCret.m_nCurrY,m_TargetCret) then
        if  DoSpell( UserMagic,m_TargetCret.m_nCurrX,m_TargetCret.m_nCurrY,m_TargetCret) then
            Result:=True;

        BreakHolySeizeMode();
     end;    //距离够了

     //  ClientSpellXY(wIdent:Word;nKey:Integer;nTargetX, nTargetY:Integer;TargeTBaseObject: TBaseObject;boLateDelivery:Boolean;var dwDelayTime:LongWord)
       // Attack1(m_TargetCret,bt06);  //FFED
      {   if m_btUsePoison>=0 then begin
           if random(5)<2 then  m_TargetCret.MakePosion(m_btUsePoison,_max(5,loword( m_WAbil.sC)),_max(5,loword( m_WAbil.mC))) ;
        end;  }
      {  if m_btusefire >=0 then begin
          GetFrontPosition(nX,nY);
          Makefire(nX,nY,BT06);

        end;
     }



      end;

    end else begin
      if m_TargetCret.m_PEnvir = m_PEnvir then begin
        if  (abs(m_nCurrX - m_TargetCret.m_nCurrX) >= 5) and (abs(m_nCurry - m_TargetCret.m_nCurry) >= 5)  then
        SetTargetXY(m_TargetCret.m_nCurrX,m_TargetCret.m_nCurrY); {0FFF0h}
        //004A8FE3
      end else begin
        DelTargetCreat();{0FFF1h}
        //004A9009
      end;
    end;
  end;
end;

constructor TMonsteys.Create;
begin
  inherited;
  m_boDupMode:=False;
  m_boFixedHideMode:=false;
  bo554:=False;
  m_dwThinkTick:=GetTickCount();
  m_dwuseskilltick:= GetTickCount();
  m_nViewRange:=5;
  m_nRunTime:=250;
  m_dwSearchTime:=3000 + Random(2000);
  m_dwSearchTick:=GetTickCount();
  m_nWalkSpeed:=700;
  m_nNextHitTime:=1200;
   m_nNextSkillTime  :=  1200;
  m_btRaceServer:=RC_YSBJECT;
  //UserEngine.makenewplay(,self);
  nskill:=0;
end;

destructor TMonsteys.Destroy;
begin

  inherited;
end;

function TMonsteys.Operate(ProcessMsg: pTProcessMessage): Boolean;
begin
    Result:=inherited Operate(ProcessMsg);
end;

procedure TMonsteys.Run;
var
  nX,nY,i,count,nDir:Integer;
  VisibleMapItem:pTVisibleMapItem;
  doskill:boolean;
   UserMagic:pTUserMagic;
begin
   toonear:=false;
   if not m_boDeath and
     not bo554 and
     not m_boGhost and
     (m_wStatusTimeArr[POISON_STONE{5 0x6A}] = 0) then begin

    if ((GetTickCount - m_dwSearchEnemyTick) > 8000) or
       (((GetTickCount - m_dwSearchEnemyTick) > 1000) and (m_TargetCret = nil)) then begin
      m_dwSearchEnemyTick:=GetTickCount();

      SearchTarget();
    end;

  end;


  if not m_boGhost and
     not m_boDeath and
     not m_boFixedHideMode and
     not m_boStoneMode and
     (m_wStatusTimeArr[POISON_STONE{5 0x6A}] = 0) then begin
    if Think then begin
      inherited;
      exit;
    end;
    if m_boWalkWaitLocked then begin
      if (GetTickCount - m_dwWalkWaitTick) > m_dwWalkWait then begin
        m_boWalkWaitLocked:=False;
      end;
    end;
    if not m_boWalkWaitLocked and (Integer(GetTickCount - m_dwWalkTick) > m_nWalkSpeed) then begin
      m_dwWalkTick:=GetTickCount();
      Inc(m_nWalkCount);
      if m_nWalkCount > m_nWalkStep then begin
        m_nWalkCount:=0;
        m_boWalkWaitLocked:=True;
        m_dwWalkWaitTick:=GetTickCount();
      end; //004A9151
////////////
    if (m_TargetCret <> nil) and (abs(m_nCurrX - m_TargetCret.m_nCurrX) <= 2) and (abs(m_nCurry- m_TargetCret.m_nCurry) <= 2) then
      toonear:=true
    else
      toonear:=false;

    if  m_WAbil.HP*3 < m_WAbil.MaxHP  then addhpmode:=true;

    if (m_btJob>0) or addhpmode then begin  //如果是法师
     if  m_TargetCret <> nil then begin   //先跑命
      // if (abs(m_nCurrX - m_TargetCret.m_nCurrX) <= 2) and (abs(m_nCurry- m_TargetCret.m_nCurry) <= 2) then begin

          if toonear  then begin
           // m_btDirection:=GetNextDirection(m_nCurrX,m_nCurrY,m_TargetCret.m_nCurrx,m_TargetCret.m_nCurry);

           nDir:=GetNextDirection(m_nCurrX,m_nCurrY,m_TargetCret.m_nCurrX,m_TargetCret.m_nCurrY);
           nDir:= GetBackDir(nDir);
           m_PEnvir.GetNextPosition(m_TargetCret.m_nCurrX,m_TargetCret.m_nCurrY,nDir,5,m_nTargetX,m_nTargetY);

           //  GetBackPosition(m_nTargetX,m_nTargetY);
          //  m_Master.SysMsg(Format('%d/(%d/%d)', [m_btDirection,m_nTargetX,m_nTargetY]),c_Red,t_Hint);



          end ;
      end;
    end; //job>0

   if Integer(GetTickCount - m_dwuseskilltick) > m_nNextSkillTime  then begin
         m_dwuseskilltick:=GetTickCount();
     if not toonear then begin  //够远了  或者没有怪物危险
         doskill:=false;

        UserMagic:=GetMagicInfo(2);   // //如果治疗术
        if (not doskill) and  (UserMagic<>nil) then  begin
          if  (m_WAbil.HP*2 < m_WAbil.MaxHP) or addhpmode then
           //  if  MagicManager.DoSpell(Self,UserMagic,m_nCurrX,m_nCurrY,self) then
          if  DoSpell( UserMagic,m_nCurrX,m_nCurrY,self) then
          doskill:=true;
          if m_WAbil.HP= m_WAbil.MaxHP then  addhpmode:=false;

          if not doskill then begin
           if (m_Master<>nil) and  (m_Master.m_WAbil.HP*2< m_Master.m_WAbil.MaxHP ) then
                 // if  MagicManager.DoSpell(Self,UserMagic,m_Master.m_nCurrX,m_Master.m_nCurrY,m_Master) then
               if  DoSpell( UserMagic,m_Master.m_nCurrX,m_Master.m_nCurrY,m_Master) then
                      doskill:=true;
           end;
        end;


        UserMagic:=GetMagicInfo(31);     //如果有魔法盾且魔法盾没有开
        if (not doskill) and  (UserMagic<>nil) and (not m_boAbilMagBubbleDefence) then  begin // m_wStatusTimeArr[STATE_BUBBLEDEFENCEUP]=0
        //  if  MagicManager.DoSpell(Self,UserMagic,m_nCurrX,m_nCurrY,self) then
          if  DoSpell( UserMagic,m_nCurrX,m_nCurrY,self) then
          doskill:=true;
        end;

        UserMagic:=GetMagicInfo(61);   // //如果有金刚且金刚没有开
        if (not doskill) and (UserMagic<>nil) and (not m_boAbilMagPowerDefence) then  begin  //(m_wStatusArrValue[6]=0)
         // if  MagicManager.DoSpell(Self,UserMagic,m_nCurrX,m_nCurrY,self) then
         if  DoSpell( UserMagic,m_nCurrX,m_nCurrY,self) then
          doskill:=true;
        end;

       UserMagic:=GetMagicInfo(42);   // //如果有护身真气且护身真气没有开
        if (not m_boAbilMagPowerDefence)and (not doskill) and (UserMagic<>nil) and  (not m_boAbilMagzqDefence) then  begin // (m_wStatusTimeArr[STATE_14]=0)
       //  if  MagicManager.DoSpell(Self,UserMagic,m_nCurrX,m_nCurrY,self) then
         if  DoSpell( UserMagic,m_nCurrX,m_nCurrY,self) then
          doskill:=true;
        end;


        UserMagic:=GetMagicInfo(70);   // //如果有风影且风影没有开
        if  (not doskill) and (UserMagic<>nil) and (not m_boAbilMagfyDefence) then  begin    // m_wStatusArrValue[7]=0
         // if  MagicManager.DoSpell(Self,UserMagic,m_nCurrX,m_nCurrY,self) then
         if  DoSpell( UserMagic,m_nCurrX,m_nCurrY,self) then
          doskill:=true;
        end;

     end;   // if not toonear then begin
  end;    //    if Integer(GetTickCount - m_dwuseskilltick) > m_nNextSkillTime 

//////////////
      if (not m_boRunAwayMode) and (not doskill) and (not addhpmode) then begin //  and (not toonear)如果没有使用魔法,就去攻击怪物
        if not m_boNoAttackMode then begin
          if m_TargetCret <> nil then begin
            if m_btJob>0 then begin
                if magAttackTarget{FFEB} then begin
                   inherited;
                  exit;
                end;
            end else begin
                 if  AttackTarget{FFEB} then begin
                   inherited;
                  exit;
                end;
            end;

          end else begin
            m_nTargetX:=-1;
            if m_boMission then begin
              m_nTargetX:=m_nMissionX;
              m_nTargetY:=m_nMissionY;
            end; //004A91D3
          end;
        end; //004A91D3  if not bo2C0 then begin
        if m_Master <> nil then begin
          if m_TargetCret = nil then begin
            m_Master.GetBackPosition(nX,nY);
            if (abs(m_nTargetX - nX) > 1) or (abs(m_nTargetY - nY{nX}) > 1) then begin //004A922D
              m_nTargetX:=nX;
              m_nTargetY:=nY;
              if (abs(m_nCurrX - nX) <= 2) and (abs(m_nCurrY - nY) <= 2) then begin
                if m_PEnvir.GetMovingObject(nX,nY,True) <> nil then begin
                  m_nTargetX:=m_nCurrX;
                  m_nTargetY:=m_nCurrY;
                end //004A92A5
              end;
            end; //004A92A5
          end; //004A92A5 if m_TargetCret = nil then begin
          if (not m_Master.m_boSlaveRelax) and
             ((m_PEnvir <> m_Master.m_PEnvir) or
             (abs(m_nCurrX-m_Master.m_nCurrX) > 20) or
             (abs(m_nCurrY-m_Master.m_nCurrY) > 20)) and (not m_bohorserelax) then begin
            SpaceMove(m_Master.m_PEnvir.sMapName, m_nTargetX, m_nTargetY, 1);
          end; // 004A937E
        end;// 004A937E if m_Master <> nil then begin
      end else begin //004A9344
        if (m_dwRunAwayTime > 0) and ((GetTickCount - m_dwRunAwayStart) > m_dwRunAwayTime) then begin
          m_boRunAwayMode:=False;
          m_dwRunAwayTime:=0;
        end;
      end; //004A937E
      if ((m_Master <> nil) and m_Master.m_boSlaveRelax) or m_bohorserelax  then begin
        inherited ;
        exit;
      end;  //004A93A6


     if m_nTargetX <> -1 then begin
        if (abs(m_nTargetX- m_nCurrX)> 2) or (abs(m_nTargety- m_nCurry)> 2) or  toonear then begin
         nDir:=GetNextDirection(m_nCurrX,m_nCurrY,m_nTargetX,m_nTargety);
          if not RunTo(nDir,False,m_nTargetX,m_nTargety) then    GotoTargetXY(); //004A93B5 0FFEF
        end else  GotoTargetXY();
      end else begin
        if m_TargetCret = nil then Wondering();// FFEE   //Jacky
      end; //004A93D8
    end; //004A93D8  if not bo510 and ((GetTickCount - m_dwWalkTick) > n4FC) then begin
  end; //004A93D8






  inherited;

end;

function TMonsteys.Think: Boolean;
var
  nOldX,nOldY:integer;
begin
  Result:=False;
  if (GetTickCount - m_dwThinkTick) > 3 * 1000 then begin
    m_dwThinkTick:=GetTickCount();
    if m_PEnvir.GetXYObjCount(m_nCurrX,m_nCurrY) >= 2 then m_boDupMode:=True;
    if not IsProperTarget{FFFF4}(m_TargetCret) then m_TargetCret:=nil;
  end; //004A8ED2
  if m_boDupMode then begin     //人物重叠了
    nOldX:=m_nCurrX;
    nOldY:=m_nCurrY;
    WalkTo(Random(8),False);
    if (nOldX <> m_nCurrX) or (nOldY <> m_nCurrY) then begin
      m_boDupMode:=False;
      Result:=True;
    end;
  end;
end;

function TMonsteys.AttackTarget: Boolean;
var
  bt06:Byte;
  nX,nY:INTEGER;
   doskill:boolean;
  UserMagic:pTUserMagic;
  skilltype:integer;
begin
  Result:=False;
  doskill:=false;
  if m_TargetCret <> nil then begin
    if GetAttackDir(m_TargetCret,bt06) then begin
      if Integer(GetTickCount - m_dwHitTick) > m_nNextHitTime  then begin
        m_dwHitTick:=GetTickCount();
        m_dwTargetFocusTick:=GetTickCount();
           skilltype:=0;
         case nskill of
             7:skilltype:=1;	//攻杀剑法
            12:skilltype:=4;  //刺杀剑术
            25:skilltype:=5;	//半月弯刀
            26:skilltype:=7;	//烈火剑法
            59:skilltype:=10;	//破击剑法
            60:skilltype:=11;  //	破盾斩
            62:skilltype:=62; //突斩
            27:skilltype:=27; //野蛮冲撞
          end;
          if (not doskill) and (skilltype  in[1,4,5,7,10,11])   then
          Attack1(m_TargetCret,skilltype,bt06);  //FFED  //技能烈火

          if (not doskill) and (skilltype  in[62])   then   begin
             UserMagic:=GetMagicInfo(62);
            if  UserMagic<>nil then
                useDoMotaebo( UserMagic,m_TargetCret.m_nCurrX,m_TargetCret.m_nCurrY,m_TargetCret);
          end;
        //   Attack1(m_TargetCret,skilltype,bt06);  //FFED  //技能烈火
      //   if m_btUsePoison>=0 then begin
      //     if random(5)<2 then  m_TargetCret.MakePosion(m_btUsePoison,_max(5,loword( m_WAbil.sC)),_max(5,loword( m_WAbil.mC))) ;
     //   end;
      {  if m_btusefire >=0 then begin
          GetFrontPosition(nX,nY);
          Makefire(nX,nY,BT06);

        end;
     }
        BreakHolySeizeMode();
      end;
      Result:=True;
    end else begin
      if m_TargetCret.m_PEnvir = m_PEnvir then begin
        SetTargetXY(m_TargetCret.m_nCurrX,m_TargetCret.m_nCurrY); {0FFF0h}
        //004A8FE3
      end else begin
        DelTargetCreat();{0FFF1h}
        //004A9009
      end;
    end;
  end;
end;

end.

⌨️ 快捷键说明

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