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

📄 objmon.pas

📁 传奇源代码的delphi版本
💻 PAS
📖 第 1 页 / 共 4 页
字号:
  HitMagAttackTarget(TargeTBaseObject,nPower div 2,nPower div 2,True);
//  inherited;

end;
procedure TCowKingMonster.Initialize;
begin
  dw56C:=m_nNextHitTime;
  dw570:=m_nWalkSpeed;
  inherited;

end;
procedure TCowKingMonster.Run;//004AA294
var
  n8,nC,n10:Integer;
begin
  if (not m_boDeath) and
     (not bo554) and
     (not m_boGhost) and
     ((GetTickCount - dw558) > 30 * 1000) then begin

    dw558:=GetTickCount();
    if (m_TargetCret <> nil) and (sub_4C3538 >= 5) then begin
      m_TargetCret.GetBackPosition(n8,nC);
      if m_PEnvir.CanWalk(n8,nC,False) then begin
        SpaceMove(m_PEnvir.sMapName,n8,nC,0);
        exit;
      end;
      MapRandomMove(m_PEnvir.sMapName,0);
      exit;
    end;
    n10:=n560;

    n560:=7 - m_WAbil.HP div (m_WAbil.MaxHP div 7);
    if (n560 >= 2) and (n560 <> n10) then begin
      bo55C:=True;
      dw564:=GetTickCount();
    end;
    if bo55C then begin
      if (GetTickCount - dw564) < 8000 then begin
        m_nNextHitTime:=10000;
      end else begin
        bo55C:=False;
        bo55D:=True;
        dw568:=GetTickCount();
      end;
    end;//004AA43D
    if bo55D then begin
      if (GetTickCount - dw568) < 8000 then begin
        m_nNextHitTime:=500;
        m_nWalkSpeed:=400;
      end else begin
        bo55D:=False;
        m_nNextHitTime:=dw56C;
        m_nWalkSpeed:=dw570;
      end;
    end;
  end;
  inherited;
end;

{ TLightingZombi }

constructor TLightingZombi.Create;//004AA4B4
begin
  inherited;
  m_dwSearchTime:=Random(1500) + 1500;
end;

destructor TLightingZombi.Destroy;
begin

  inherited;
end;
procedure TLightingZombi.LightingAttack(nDir:Integer);
var
  nSX,nSY,nTX,nTY,nPwr:Integer;
  WAbil:pTAbility;
begin
  m_btDirection:=nDir;
  SendRefMsg(RM_LIGHTING,1,m_nCurrX,m_nCurrY,Integer(m_TargetCret),'');
  if m_PEnvir.GetNextPosition(m_nCurrX,m_nCurrY,nDir,1,nSX,nSY) then begin
    m_PEnvir.GetNextPosition(m_nCurrX,m_nCurrY,nDir,9,nTX,nTY);
    WAbil:=@m_WAbil;
    nPwr:=(Random(SmallInt(HiWord(WAbil.DC) - LoWord(WAbil.DC)) + 1) + LoWord(WAbil.DC));
    MagPassThroughMagic(nSX,nSY,nTX,nTY,nDir,nPwr,True);
    BreakHolySeizeMode();
  end;
end;
procedure TLightingZombi.Run;//004AA604
var
  nAttackDir:Integer;
begin
  if (not bo554) and CanMove and ((GetTickCount - m_dwSearchEnemyTick) > 8000) then begin

    if ((GetTickCount - m_dwSearchEnemyTick) > 1000) and (m_TargetCret = nil) then begin
      m_dwSearchEnemyTick:=GetTickCount();
      SearchTarget();
    end;
    if (GetCurrentTime - m_dwWalkTick > GetWalkSpeed) and
       (m_TargetCret <> nil) and
       (abs(m_nCurrX - m_TargetCret.m_nCurrX) <= 4) and
       (abs(m_nCurrY - m_TargetCret.m_nCurrY) <= 4) then begin
      if (abs(m_nCurrX - m_TargetCret.m_nCurrX) <= 2) and
         (abs(m_nCurrY - m_TargetCret.m_nCurrY) <= 2) and
         (Random(3) <> 0)then begin
        inherited;
        exit;
      end;
      GetBackPosition(m_nTargetX,m_nTargetY);
    end;
    if (m_TargetCret <> nil) and
       (abs(m_nCurrX - m_TargetCret.m_nCurrX) < 6) and
       (abs(m_nCurrY - m_TargetCret.m_nCurrY) < 6) and
       (GetCurrentTime - m_dwHitTick > GetHitSpeed) then begin

      m_dwHitTick:=GetCurrentTime;
      nAttackDir:=GetNextDirection(m_nCurrX,m_nCurrY,m_TargetCret.m_nCurrX,m_TargetCret.m_nCurrY);
      LightingAttack(nAttackDir);
    end;
  end;
  inherited;
end;

{ TDigOutZombi }

constructor TDigOutZombi.Create;//004AA848
begin
  inherited;
  bo554:=False;
  m_nViewRange:=7;
  m_dwSearchTime:=Random(1500) + 2500;
  m_dwSearchTick:=GetTickCount();
  m_boFixedHideMode:=True;
end;

destructor TDigOutZombi.Destroy;
begin

  inherited;
end;

procedure TDigOutZombi.sub_4AA8DC;
var
  Event:TEvent;
begin
  Event:=TEvent.Create(m_PEnvir,m_nCurrX,m_nCurrY,1,5 * 60 * 1000,True);
  g_EventManager.AddEvent(Event);
  m_boFixedHideMode:=False;
  SendRefMsg(RM_DIGUP,m_btDirection,m_nCurrX,m_nCurrY,Integer(Event),'');
end;
procedure TDigOutZombi.Run;//004AA95C
var
  I: Integer;
  BaseObject:TBaseObject;
begin
  if CanMove and (GetCurrentTime - m_dwWalkTick > GetWalkSpeed) then begin

    if m_boFixedHideMode then begin
      for I := 0 to m_VisibleActors.Count - 1 do begin
        BaseObject:=TBaseObject(pTVisibleBaseObject(m_VisibleActors.Items[I]).BaseObject);
        if BaseObject.m_boDeath then Continue;
        if IsProperTarget(BaseObject) then begin
          if not BaseObject.m_boHideMode or m_boCoolEye then begin
            if (abs(m_nCurrX - BaseObject.m_nCurrX) <= 3) and (abs(m_nCurrY - BaseObject.m_nCurrY) <= 3) then begin
              sub_4AA8DC();
              m_dwWalkTick:=GetCurrentTime + 1000;
              break;
            end;
          end;
        end;
      end;    // for
    end else begin //004AB0C7
      if ((GetTickCount - m_dwSearchEnemyTick) > 8000) or
         (((GetTickCount - m_dwSearchEnemyTick) > 1000) and (m_TargetCret = nil)) then begin
        m_dwSearchEnemyTick:=GetTickCount();
        SearchTarget();
      end;
    end;       
  end;
  inherited;
end;


{ TZilKinZombi }

constructor TZilKinZombi.Create;
begin
  inherited;
  m_nViewRange:=6;
  m_dwSearchTime:=Random(1500) + 2500;
  m_dwSearchTick:=GetTickCount();
  nZilKillCount:=0;
  if Random(3) = 0 then begin
    nZilKillCount:=Random(3) + 1;
  end;
end;

destructor TZilKinZombi.Destroy;
begin
  inherited;


end;

procedure TZilKinZombi.Die;
begin
  inherited;
  if nZilKillCount > 0 then begin
    dw558:=GetTickCount();
    dw560:=(Random(20) + 4) * 1000;
  end;
  Dec(nZilKillCount);
end;

procedure TZilKinZombi.Run;//004AABE4
begin
  if m_boDeath and (not m_boGhost) and (nZilKillCount >= 0) and
    (m_wStatusTimeArr[POISON_STONE] = 0) and
    (m_wStatusTimeArr[POISON_FREEZE] = 0) and
    (m_wStatusTimeArr[POISON_STUN] = 0) and
    (m_wStatusTimeArr[POISON_DONTMOVE] = 0) and 
    (m_VisibleActors.Count > 0) and
    ((GetTickCount - dw558) >= dw560) then begin
    m_Abil.MaxHP:=m_Abil.MaxHP shr 1;
    m_dwFightExp:=m_dwFightExp div 2;
    m_Abil.HP:=m_Abil.MaxHP;
    m_WAbil.HP:=m_Abil.MaxHP;
    ReAlive();
    m_dwWalkTick:=GetCurrentTime + 1000
  end;
  inherited;
end;

{ TWhiteSkeleton }

constructor TWhiteSkeleton.Create;
begin
  inherited;
  m_boIsFirst:=True;
  m_boFixedHideMode:=True;
  m_btRaceServer:=100;
  m_nViewRange:=6;
end;

destructor TWhiteSkeleton.Destroy;
begin

  inherited;
end;

procedure TWhiteSkeleton.RecalcAbilitys;
begin
  inherited;
end;
procedure TWhiteSkeleton.Run;
begin
  if m_boIsFirst then begin
    m_boIsFirst:=False;
    m_btDirection:=5;
    m_boFixedHideMode:=False;
    SendRefMsg(RM_DIGUP,m_btDirection,m_nCurrX,m_nCurrY,0,'');
    Reset;
  end;
  inherited;
end;

procedure TWhiteSkeleton.Reset;
begin
  m_nNextHitTime:=3000 - m_btSlaveMakeLevel * 600;
  m_nWalkSpeed:=1200 - m_btSlaveMakeLevel * 250;
  m_dwWalkTick:=GetCurrentTime + 2000;
end;

{ TScultureMonster }

constructor TScultureMonster.Create;//004AAE20
begin
  inherited;
  m_dwSearchTime:=Random(1500) + 1500;
  m_nViewRange:=7;
  m_boStoneMode:=True;
  m_nCharStatusEx:=STATE_STONE_MODE;
end;

destructor TScultureMonster.Destroy;
begin

  inherited;
end;
procedure TScultureMonster.MeltStone;
begin
  m_nCharStatusEx:=0;
  m_nCharStatus:=GetCharStatus();
  SendRefMsg(RM_DIGUP,m_btDirection,m_nCurrX,m_nCurrY,0,'');
  m_boStoneMode:=False;
end;
procedure TScultureMonster.MeltStoneAll;
var
  I: Integer;
  List10:TList;
  BaseObject:TBaseObject;
begin
  MeltStone();
  List10:=TList.Create;
  GetMapBaseObjects(m_PEnvir,m_nCurrX,m_nCurrY,7,List10);
  for I := 0 to List10.Count - 1 do begin
    BaseObject:=TBaseObject(List10.Items[I]);
    if BaseObject.m_boStoneMode then begin
      if BaseObject is TScultureMonster then begin
        TScultureMonster(BaseObject).MeltStone
      end;
    end;
  end;    // for
  List10.Free;
end;

procedure TScultureMonster.Run;//004AAF98
var
  I: Integer;
  BaseObject:TBaseObject;
begin
  if CanMove and
     (GetCurrentTime - m_dwWalkTick > GetWalkSpeed) then begin

    if m_boStoneMode then begin
      for I := 0 to m_VisibleActors.Count - 1 do begin
        BaseObject:=TBaseObject(pTVisibleBaseObject(m_VisibleActors.Items[I]).BaseObject);
        if BaseObject.m_boDeath then Continue;
        if IsProperTarget(BaseObject) then begin
          if not BaseObject.m_boHideMode or m_boCoolEye then begin
            if (abs(m_nCurrX - BaseObject.m_nCurrX) <= 2) and (abs(m_nCurrY - BaseObject.m_nCurrY) <= 2) then begin
              MeltStoneAll();
              break;
            end;
          end;
        end;
      end;    // for
    end else begin //004AB0C7
      if ((GetTickCount - m_dwSearchEnemyTick) > 8000) or
         (((GetTickCount - m_dwSearchEnemyTick) > 1000) and (m_TargetCret = nil)) then begin
        m_dwSearchEnemyTick:=GetTickCount();
        SearchTarget();
      end;
    end;
  end;
  inherited;
end;

{ TScultureKingMonster }

constructor TScultureKingMonster.Create;//004AB120
begin
  inherited;
  m_dwSearchTime:=Random(1500) + 1500;
  m_nViewRange:=8;
  m_boStoneMode:=True;
  m_nCharStatusEx:=STATE_STONE_MODE;
  m_btDirection:=5;
  m_nDangerLevel:=5;
  m_SlaveObjectList:=TList.Create;
end;

destructor TScultureKingMonster.Destroy;//004AB1C8
begin
  m_SlaveObjectList.Free;
  inherited;
end;
procedure TScultureKingMonster.MeltStone; //004AB208
var
  Event:TEvent;
begin
  m_nCharStatusEx:=0;
  m_nCharStatus:=GetCharStatus();
  SendRefMsg(RM_DIGUP,m_btDirection,m_nCurrX,m_nCurrY,0,'');
  m_boStoneMode:=False;
  Event:=TEvent.Create(m_PEnvir,m_nCurrX,m_nCurrY,6,5 * 60 * 1000,True);
  g_EventManager.AddEvent(Event);
end;
procedure TScultureKingMonster.CallSlave; //004AB29C
var
  I: Integer;
  nCount:Integer;
  nX,nY:Integer;
  //sMonName:array[0..3] of String;
  BaseObject:TBaseObject;
begin
  nCount:=Random(6) + 6;
  GetFrontPosition(nX,nY);
  {
  sMonName[0]:=sZuma1;
  sMonName[1]:=sZuma2;
  sMonName[2]:=sZuma3;
  sMonName[3]:=sZuma4;
  }
  for I := 1 to nCount do begin
    if m_SlaveObjectList.Count >= 30 then break;
    BaseObject:=UserEngine.RegenMonsterByName(m_sMapName,nX,nY,g_Config.sZuma[Random(4)]);
    if BaseObject <> nil then begin
      //BaseObject.m_Master:=Self;
      //BaseObject.m_dwMasterRoyaltyTick:=GetTickCount + 24 * 60 * 60 * 1000;
      m_SlaveObjectList.Add(BaseObject);
    end;
  end;    // for
end;
procedure TScultureKingMonster.Attack(TargeTBaseObject: TBaseObject;nDir: Integer);//004AB3E8
var
  WAbil:pTAbility;
  nPower:Integer;
begin
  WAbil:=@m_WAbil;
  nPower:=GetAttackPower(LoWord(WAbil.DC),SmallInt(HiWord(WAbil.DC) - LoWord(WAbil.DC)));
  HitMagAttackTarget(TargeTBaseObject,0,nPower,True);
end;
procedure TScultureKingMonster.Run;//004AB444
var
  I: Integer;
  BaseObject:TBaseObject;
begin
  if CanMove and
     (GetCurrentTime - m_dwWalkTick > GetWalkSpeed) then begin

    if m_boStoneMode then begin
      //MeltStone();//
      for I := 0 to m_VisibleActors.Count - 1 do begin
        BaseObject:=TBaseObject(pTVisibleBaseObject(m_VisibleActors.Items[I]).BaseObject);
        if BaseObject.m_boDeath then Continue;
        if IsProperTarget(BaseObject) then begin
          if not BaseObject.m_boHideMode or m_boCoolEye then begin
            if (abs(m_nCurrX - BaseObject.m_nCurrX) <= 2) and (abs(m_nCurrY - BaseObject.m_nCurrY) <= 2) then begin
              MeltStone();
              break;
            end;
          end;
        end;
      end;    // for
    end else begin
      if ((GetTickCount - m_dwSearchEnemyTick) > 8000) or
         (((GetTickCount - m_dwSearchEnemyTick) > 1000) and (m_TargetCret = nil)) then begin
        m_dwSearchEnemyTick:=GetTickCount();
        SearchTarget();
        //CallSlave(); //
        if (m_nDangerLevel > m_WAbil.HP / m_WAbil.MaxHP * 5) and (m_nDangerLevel > 0) then begin
          Dec(m_nDangerLevel);
          CallSlave();
        end;
        if m_WAbil.HP = m_WAbil.MaxHP then
          m_nDangerLevel:=5;
      end;
    end;
    for I := m_SlaveObjectList.Count - 1 downto 0 do begin
      BaseObject:=TBaseObject(m_SlaveObjectList.Items[I]);
      if BaseObject.m_boDeath or BaseObject.m_boGhost then
        m_SlaveObjectList.Delete(I);
    end;    // for
  end;
  inherited;
end;
{ TGasMothMonster }

constructor TGasMothMonster.Create;//004AB6B8
begin
  inherited;
  m_nViewRange:=7;
end;

destructor TGasMothMonster.Destroy;
begin

  inherited;
end;

function TGasMothMonster.sub_4A9C78(bt05: Byte): TBaseObject;//004AB708
var
  BaseObject:TBaseObject;
begin
  BaseObject:=inherited sub_4A9C78(bt05);
  if (BaseObject <> nil) and (Random(3) = 0) and (BaseObject.m_boHideMode) then begin
    BaseObject.m_wStatusTimeArr[STATE_TRANSPARENT{8 0x70}]:=1;
  end;
  Result:=BaseObject;
end;
procedure TGasMothMonster.Run;//004AB758
begin
  if (not bo554) and CanMove and
     (GetCurrentTime - m_dwWalkTick > GetWalkSpeed) then begin

    if ((GetTickCount - m_dwSearchEnemyTick) > 8000) or
       (((GetTickCount - m_dwSearchEnemyTick) > 1000) and (m_TargetCret = nil)) then begin
      m_dwSearchEnemyTick:=GetTickCount();
      sub_4C959C();
    end;
  end;
  inherited;
end;
{ TGasDungMonster }

constructor TGasDungMonster.Create;//004AB7F4
begin
  inherited;
  m_nViewRange:=7;
end;

destructor TGasDungMonster.Destroy;
begin

  inherited;
end;





⌨️ 快捷键说明

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