📄 objmon.pas
字号:
destructor TSpitSpider.Destroy;
begin
inherited;
end;
procedure TSpitSpider.SpitAttack(btDir: Byte); //004A98AC
var
WAbil: pTAbility;
nC, n10, n14, n18, n1C: Integer;
BaseObject: TBaseObject;
begin
m_btDirection := btDir;
WAbil := @m_WAbil;
n1C := (Random(SmallInt(HiWord(WAbil.DC) - LoWord(WAbil.DC)) + 1) + LoWord(WAbil.DC));
if n1C <= 0 then Exit;
SendRefMsg(RM_HIT, m_btDirection, m_nCurrX, m_nCurrY, 0, '');
nC := 0;
while (nC < 5) do begin
n10 := 0;
while (n10 < 5) do begin
if g_Config.SpitMap[btDir, nC, n10] = 1 then begin
{
(0, 0, 0, 0, 0),
(0, 0, 0, 0, 0),
(0, 0, 1, 0, 0),
(0, 0, 1, 0, 0)),
}
n14 := m_nCurrX - 2 + n10;
n18 := m_nCurrY - 2 + nC;
BaseObject := m_PEnvir.GetMovingObject(n14, n18, True);
if (BaseObject <> nil) and
(BaseObject <> Self) and
(IsProperTarget(BaseObject)) and
(Random(BaseObject.m_btSpeedPoint) < m_btHitPoint) then begin
n1C := BaseObject.GetMagStruckDamage(Self, n1C);
if n1C > 0 then begin
BaseObject.StruckDamage(n1C);
BaseObject.SendDelayMsg(TBaseObject(RM_STRUCK), RM_10101, n1C, m_WAbil.HP, m_WAbil.MaxHP, Integer(Self), '', 300);
if m_boUsePoison then begin
if (Random(m_btAntiPoison + 20) = 0) then
BaseObject.MakePosion(POISON_DECHEALTH, 30, 1);
//if Random(2) = 0 then
// BaseObject.MakePosion(POISON_STONE,5,1);
end;
end;
end;
end;
Inc(n10);
{
if n10 >= 5 then break;
}
end;
Inc(nC);
//if nC >= 5 then break;
end; // while
end;
function TSpitSpider.AttackTarget: Boolean;
var
btDir: Byte;
begin
Result := False;
if m_TargetCret = nil then Exit;
if TargetInSpitRange(m_TargetCret, btDir) then begin
if Integer(GetTickCount - m_dwHitTick) > m_nNextHitTime then begin
m_dwHitTick := GetTickCount();
m_dwTargetFocusTick := GetTickCount();
SpitAttack(btDir);
BreakHolySeizeMode();
end;
Result := True;
Exit;
end;
if m_TargetCret.m_PEnvir = m_PEnvir then begin
SetTargetXY(m_TargetCret.m_nCurrX, m_TargetCret.m_nCurrY);
end else begin
DelTargetCreat();
end;
end;
{ THighRiskSpider }
constructor THighRiskSpider.Create; //004A9B64
begin
inherited;
m_boAnimal := False;
m_boUsePoison := False;
end;
destructor THighRiskSpider.Destroy;
begin
inherited;
end;
{ TBigPoisionSpider }
constructor TBigPoisionSpider.Create; //004A9BBC
begin
inherited;
m_boAnimal := False;
m_boUsePoison := True;
end;
destructor TBigPoisionSpider.Destroy;
begin
inherited;
end;
{ TGasAttackMonster }
constructor TGasAttackMonster.Create; //004A9C14
begin
inherited;
m_dwSearchTime := Random(1500) + 1500;
m_boAnimal := True;
end;
destructor TGasAttackMonster.Destroy;
begin
inherited;
end;
function TGasAttackMonster.sub_4A9C78(bt05: Byte): TBaseObject;
var
WAbil: pTAbility;
n10: Integer;
BaseObject: TBaseObject;
begin
Result := nil;
m_btDirection := bt05;
WAbil := @m_WAbil;
n10 := Random(SmallInt(HiWord(WAbil.DC) - LoWord(WAbil.DC)) + 1) + LoWord(WAbil.DC);
if n10 > 0 then begin
SendRefMsg(RM_HIT, m_btDirection, m_nCurrX, m_nCurrY, 0, '');
BaseObject := GetPoseCreate();
if (BaseObject <> nil) and
IsProperTarget(BaseObject) and
(Random(BaseObject.m_btSpeedPoint) < m_btHitPoint) then begin
n10 := BaseObject.GetMagStruckDamage(Self, n10);
if n10 > 0 then begin
BaseObject.StruckDamage(n10);
BaseObject.SendDelayMsg(TBaseObject(RM_STRUCK), RM_10101, n10, BaseObject.m_WAbil.HP, BaseObject.m_WAbil.MaxHP, Integer(Self), '', 300);
if Random(BaseObject.m_btAntiPoison + 20) = 0 then begin
BaseObject.MakePosion(POISON_STONE, 5, 0)
end;
Result := BaseObject;
end;
end;
end;
end;
function TGasAttackMonster.AttackTarget(): Boolean; //004A9DD4
var
btDir: Byte;
begin
Result := False;
if m_TargetCret = nil then Exit;
if GetAttackDir(m_TargetCret, btDir) then begin
if Integer(GetTickCount - m_dwHitTick) > m_nNextHitTime then begin
m_dwHitTick := GetTickCount();
m_dwTargetFocusTick := GetTickCount();
sub_4A9C78(btDir);
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);
end else begin
DelTargetCreat();
end;
end;
end;
{ TCowMonster }
constructor TCowMonster.Create; //004A9EB4
begin
inherited;
m_dwSearchTime := Random(1500) + 1500;
end;
destructor TCowMonster.Destroy;
begin
inherited;
end;
{ TMagCowMonster }
constructor TMagCowMonster.Create; //004A9F10
begin
inherited;
m_dwSearchTime := Random(1500) + 1500;
end;
destructor TMagCowMonster.Destroy;
begin
inherited;
end;
procedure TMagCowMonster.sub_4A9F6C(btDir: Byte);
var
WAbil: pTAbility;
n10: Integer;
BaseObject: TBaseObject;
begin
m_btDirection := btDir;
WAbil := @m_WAbil;
n10 := Random(SmallInt(HiWord(WAbil.DC) - LoWord(WAbil.DC)) + 1) + LoWord(WAbil.DC);
if n10 > 0 then begin
SendRefMsg(RM_HIT, m_btDirection, m_nCurrX, m_nCurrY, 0, '');
BaseObject := GetPoseCreate();
if (BaseObject <> nil) and
IsProperTarget(BaseObject) and
(m_nAntiMagic >= 0) then begin
n10 := BaseObject.GetMagStruckDamage(Self, n10);
if n10 > 0 then begin
BaseObject.StruckDamage(n10);
BaseObject.SendDelayMsg(TBaseObject(RM_STRUCK), RM_10101, n10, BaseObject.m_WAbil.HP, BaseObject.m_WAbil.MaxHP, Integer(Self), '', 300);
end;
end;
end;
end;
function TMagCowMonster.AttackTarget: Boolean;
var
btDir: Byte;
begin
Result := False;
if m_TargetCret = nil then Exit;
if GetAttackDir(m_TargetCret, btDir) then begin
if Integer(GetTickCount - m_dwHitTick) > m_nNextHitTime then begin
m_dwHitTick := GetTickCount();
m_dwTargetFocusTick := GetTickCount();
sub_4A9F6C(btDir);
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);
end else begin
DelTargetCreat();
end;
end;
end;
{ TCowKingMonster }
constructor TCowKingMonster.Create; //004AA160
begin
inherited;
m_dwSearchTime := Random(1500) + 500;
dw558 := GetTickCount();
bo2BF := True;
n560 := 0;
bo55C := False;
bo55D := False;
end;
destructor TCowKingMonster.Destroy;
begin
inherited;
end;
procedure TCowKingMonster.Attack(TargeTBaseObject: TBaseObject; nDir: Integer); //004AA1F0
var
WAbil: pTAbility;
nPower: Integer;
begin
WAbil := @m_WAbil;
nPower := GetAttackPower(LoWord(WAbil.DC), SmallInt(HiWord(WAbil.DC) - LoWord(WAbil.DC)));
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
I: Integer;
n8, nC, n10: Integer;
BaseObject: TBaseObject;
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);
end;
BreakHolySeizeMode();
end;
procedure TLightingZombi.Run; //004AA604
var
n08, nAttackDir: Integer;
begin
n08 := 9999;
if (not m_boDeath) and
(not bo554) and
(not m_boGhost) and
(m_wStatusTimeArr[POISON_STONE {5 0x6A}] = 0) and
((GetTickCount - m_dwSearchEnemyTick) > 8000) then begin
if ((GetTickCount - m_dwSearchEnemyTick) > 1000) and (m_TargetCret = nil) then begin
m_dwSearchEnemyTick := GetTickCount();
SearchTarget();
end;
if (Integer(GetTickCount - m_dwWalkTick) > m_nWalkSpeed) 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
(Integer(GetTickCount - m_dwHitTick) > m_nNextHitTime) then begin
m_dwHitTick := GetTickCount();
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_btRaceServer := 95;
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;
n10: Integer;
BaseObject: TBaseObject;
begin
if (not m_boGhost) and
(not m_boDeath) and
(m_wStatusTimeArr[POISON_STONE {5 0x6A}] = 0) and
(Integer(GetTickCount - m_dwWalkTick) > m_nWalkSpeed) then begin
n10 := 0;
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 = nil then Continue;
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 := GetTickCount + 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();
m_btRaceServer := 96;
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 {5 0x6A}] = 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 := GetTickCount + 1000
end;
inherited;
end;
{ TWhiteSkeleton }
constructor TWhiteSkeleton.Create; //00004AACCC
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -