📄 objmon2.pas
字号:
//004A9009
end;
end;
end;
procedure TExplosionSpider.Run;
begin
if not m_boDeath and not m_boGhost then
if (GetTickCount - dw558) > 60 * 1000 then begin
dw558:=GetTickcount();
sub_4A65C4();
end;
inherited;
end;
{ TGuardUnit }
procedure TGuardUnit.Struck(hiter: TBaseObject);
begin
inherited;
if m_Castle <> nil then begin
bo2B0:=True;
m_dw2B4Tick:=GetTickCount();
end;
end;
function TGuardUnit.IsProperTarget(BaseObject: TBaseObject): boolean; //004A6890
begin
Result:=False;
if m_Castle <> nil then begin
if m_LastHiter = BaseObject then Result:=True;
if BaseObject.bo2B0 then begin
if (GetTickCount - BaseObject.m_dw2B4Tick) < 2 * 60 * 1000 then begin
Result:=True;
end else BaseObject.bo2B0:=False;
if BaseObject.m_Castle <> nil then begin
BaseObject.bo2B0:=False;
Result:=False;
end;
end; //004A690D
if TUserCastle(m_Castle).m_boUnderWar then Result:=True;
if TUserCastle(m_Castle).m_MasterGuild <> nil then begin
if BaseObject.m_Master = nil then begin
if (TUserCastle(m_Castle).m_MasterGuild = BaseObject.m_MyGuild) or
(TUserCastle(m_Castle).m_MasterGuild.IsAllyGuild(TGuild(BaseObject.m_MyGuild))) then begin
if m_LastHiter <> BaseObject then Result:=False;
end;
end else begin//004A6988
if (TUserCastle(m_Castle).m_MasterGuild = BaseObject.m_Master.m_MyGuild) or
(TUserCastle(m_Castle).m_MasterGuild.IsAllyGuild(TGuild(BaseObject.m_Master.m_MyGuild))) then begin
if (m_LastHiter <> BaseObject.m_Master) and (m_LastHiter <> BaseObject) then Result:=False;
end;
end;
end; //004A69EF
if BaseObject.m_boAdminMode or
BaseObject.m_boStoneMode or
((BaseObject.m_btRaceServer >= RC_NPC{10}) and
(BaseObject.m_btRaceServer < RC_ANIMAL{50})) or
(BaseObject = Self) or (BaseObject.m_Castle = Self.m_Castle) then begin
Result:=False;
end;
exit;
end; //004A6A41
if m_LastHiter = BaseObject then Result:=True;
if (BaseObject.m_TargetCret <> nil) and (BaseObject.m_TargetCret.m_btRaceServer = 112)then
Result:=True;
if BaseObject.PKLevel >= 2 then Result:=True;
if BaseObject.m_boAdminMode or
BaseObject.m_boStoneMode or
(BaseObject = Self) then Result:=False;
end;
{ TArcherGuard }
constructor TArcherGuard.Create;//004A6AB4
begin
inherited;
m_nViewRange := 12;
m_boWantRefMsg := True;
m_Castle := nil;
m_nDirection := -1;
end;
destructor TArcherGuard.Destroy;
begin
inherited;
end;
procedure TArcherGuard.sub_4A6B30(TargeTBaseObject:TBaseObject);//004A6B30
var
nPower:Integer;
WAbil:pTAbility;
begin
m_btDirection:=GetNextDirection(m_nCurrX,m_nCurrY,TargeTBaseObject.m_nCurrX,TargeTBaseObject.m_nCurrY);
WAbil:=@m_WAbil;
nPower:=(Random(SmallInt(HiWord(WAbil.DC) - LoWord(WAbil.DC)) +1) + LoWord(WAbil.DC));
if nPower > 0 then
nPower:=TargeTBaseObject.GetHitStruckDamage(Self,nPower);
if nPower > 0 then begin
TargeTBaseObject.SetLastHiter(Self);
TargeTBaseObject.m_ExpHitter:=nil;
TargeTBaseObject.StruckDamage(nPower);
TargeTBaseObject.SendDelayMsg(TBaseObject(RM_STRUCK),RM_10101,nPower,TargeTBaseObject.m_WAbil.HP,TargeTBaseObject.m_WAbil.MaxHP,Integer(Self),'',
_MAX(abs(m_nCurrX - TargeTBaseObject.m_nCurrX),abs(m_nCurrY - TargeTBaseObject.m_nCurrY)) * 50 + 600);
end;
SendRefMsg(RM_FLYAXE,m_btDirection,m_nCurrX,m_nCurrY,Integer(TargeTBaseObject),'');
end;
procedure TArcherGuard.Run;//004A6C64
var
I :Integer;
nAbs :Integer;
nRage :Integer;
BaseObject :TBaseObject;
TargetBaseObject :TBaseObject;
begin
nRage := 9999;
TargetBaseObject := nil;
if CanMove then begin
if (GetCurrentTime - m_dwWalkTick > GetWalkSpeed) then begin
m_dwWalkTick:=GetCurrentTime;
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
nAbs:=abs(m_nCurrX - BaseObject.m_nCurrX) + abs(m_nCurrY - BaseObject.m_nCurrY);
if nAbs < nRage then begin
nRage:=nAbs;
TargetBaseObject:=BaseObject;
end;
end;
end;
if TargetBaseObject <> nil then begin
SetTargetCreat(TargetBaseObject);
end else begin
DelTargetCreat();
end;
end;
if m_TargetCret <> nil then begin
if GetCurrentTime - m_dwHitTick > GetHitSpeed then begin
m_dwHitTick:=GetCurrentTime;
sub_4A6B30(m_TargetCret);
end;
end else begin
if (m_nDirection >= 0) and (m_btDirection <> m_nDirection) then begin
TurnTo(m_nDirection);
end;
end;
end;
inherited;
end;
{ TArcherPolice }
constructor TArcherPolice.Create;//004A6E14
begin
inherited;
m_btRaceServer:=20;
end;
destructor TArcherPolice.Destroy;
begin
inherited;
end;
{ TCastleDoor }
constructor TCastleDoor.Create;//004A6E60
begin
inherited;
m_boAnimal:=False;
m_boStickMode:=True;
m_boOpened:=False;
m_btAntiPoison:=200;
end;
destructor TCastleDoor.Destroy;
begin
inherited;
end;
procedure TCastleDoor.SetMapXYFlag(nFlag:Integer);//004A6FB4
var
bo06:Boolean;
begin
m_PEnvir.SetMapXYFlag(m_nCurrX,m_nCurrY - 2,True);
m_PEnvir.SetMapXYFlag(m_nCurrX + 1,m_nCurrY - 1,True);
m_PEnvir.SetMapXYFlag(m_nCurrX + 1,m_nCurrY - 2,True);
if nFlag = 1 then bo06:=False
else bo06:=True;
m_PEnvir.SetMapXYFlag(m_nCurrX,m_nCurrY,bo06);
m_PEnvir.SetMapXYFlag(m_nCurrX,m_nCurrY - 1,bo06);
m_PEnvir.SetMapXYFlag(m_nCurrX,m_nCurrY - 2,bo06);
m_PEnvir.SetMapXYFlag(m_nCurrX + 1,m_nCurrY - 1,bo06);
m_PEnvir.SetMapXYFlag(m_nCurrX + 1,m_nCurrY - 2,bo06);
m_PEnvir.SetMapXYFlag(m_nCurrX - 1,m_nCurrY,bo06);
m_PEnvir.SetMapXYFlag(m_nCurrX - 2,m_nCurrY,bo06);
m_PEnvir.SetMapXYFlag(m_nCurrX - 1,m_nCurrY - 1,bo06);
m_PEnvir.SetMapXYFlag(m_nCurrX - 1,m_nCurrY + 1,bo06);
if nFlag = 0 then begin
m_PEnvir.SetMapXYFlag(m_nCurrX,m_nCurrY - 2,False);
m_PEnvir.SetMapXYFlag(m_nCurrX + 1,m_nCurrY - 1,False);
m_PEnvir.SetMapXYFlag(m_nCurrX + 1,m_nCurrY - 2,False);
end;
end;
procedure TCastleDoor.Open;//004A71B4
begin
if m_boDeath then exit;
m_btDirection:=7;
SendRefMsg(RM_DIGUP,m_btDirection,m_nCurrX,m_nCurrY,0,'');
m_boOpened:=True;
m_boStoneMode:=True;
SetMapXYFlag(0);
bo2B9:=False;
end;
procedure TCastleDoor.Close;//004A7220
begin
if m_boDeath then exit;
m_btDirection:=3 - ROUND(m_WAbil.HP/m_WAbil.MaxHP * 3.0);
if (m_btDirection - 3) >= 0 then m_btDirection:=0;
SendRefMsg(RM_DIGDOWN,m_btDirection,m_nCurrX,m_nCurrY,0,'');
m_boOpened:=False;
m_boStoneMode:=False;
SetMapXYFlag(1);
bo2B9:=True;
end;
procedure TCastleDoor.Die;
begin
inherited;
dw560:=GetTickCount();
SetMapXYFlag(2);
end;
procedure TCastleDoor.Run;//004A7304
var
n08:Integer;
begin
if m_boDeath and (m_Castle <> nil) then
m_dwDeathTick:=GetTickCount()
else m_nHealthTick:=0;
if not m_boOpened then begin
n08:=3 - ROUND(m_WAbil.HP/m_WAbil.MaxHP * 3.0);
if (m_btDirection <> n08) and (n08 < 3) then begin
m_btDirection:=n08;
SendRefMsg(RM_TURN,m_btDirection,m_nCurrX,m_nCurrY,0,'');
end;
end;
inherited;
end;
procedure TCastleDoor.RefStatus;//004A6F24
var
n08:Integer;
begin
n08:=3 - ROUND(m_WAbil.HP/m_WAbil.MaxHP * 3.0);
if (n08 - 3) >= 0 then n08:=0;
m_btDirection:=n08;
SendRefMsg(RM_ALIVE,m_btDirection,m_nCurrX,m_nCurrY,0,'');
end;
procedure TCastleDoor.Initialize; //0x004A6ECC
begin
// m_btDirection:=0;
inherited;
{
if m_WAbil.HP > 0 then begin
if m_boOpened then begin
SetMapXYFlag(0);
exit;
end;
SetMapXYFlag(1);
exit;
end;
SetMapXYFlag(2);
}
end;
{ TWallStructure }
constructor TWallStructure.Create;//004A73D4
begin
inherited;
m_boAnimal:=False;
m_boStickMode:=True;
boSetMapFlaged:=False;
m_btAntiPoison:=200;
end;
destructor TWallStructure.Destroy;
begin
inherited;
end;
procedure TWallStructure.Initialize;//004A7440
begin
m_btDirection:=0;
inherited;
end;
procedure TWallStructure.RefStatus;//004A745C
var
n08:Integer;
begin
if m_WAbil.HP > 0 then begin
n08:=3 - ROUND(m_WAbil.HP/m_WAbil.MaxHP * 3.0);
end else begin
n08:=4;
end;
if n08 >= 5 then n08:=0;
m_btDirection:=n08;
SendRefMsg(RM_ALIVE,m_btDirection,m_nCurrX,m_nCurrY,0,'');
end;
procedure TWallStructure.Die;//004A74F8
begin
inherited;
dw560:=GetTickCount();
end;
procedure TWallStructure.Run;//004A7518
var
n08:Integer;
begin
if m_boDeath then begin
m_dwDeathTick:=GetTickCount();
if boSetMapFlaged then begin
m_PEnvir.SetMapXYFlag(m_nCurrX,m_nCurrY,True);
boSetMapFlaged:=False;
end;
end else begin
m_nHealthTick:=0;
if not boSetMapFlaged then begin
m_PEnvir.SetMapXYFlag(m_nCurrX,m_nCurrY,False);
boSetMapFlaged:=True;
end;
end;
if m_WAbil.HP > 0 then begin
n08:=3 - ROUND(m_WAbil.HP/m_WAbil.MaxHP * 3.0);
end else begin
n08:=4;
end;
if (m_btDirection <> n08) and (n08 < 5) then begin
m_btDirection:=n08;
SendRefMsg(RM_DIGUP,m_btDirection,m_nCurrX,m_nCurrY,0,'');
end;
inherited;
end;
{evilmir}
constructor TEvilMir.Create;
begin
inherited;
m_dwSpellTick:=GetTickCount();
m_boAnimal:=False;
//m_SlaveObjectList:=TList.Create;
boSlaves:=False;
dwEMDied:=0; //this tells former pets that they should go :p
m_nViewRange:=20;
end;
destructor TEvilMir.Destroy;
begin
// m_SlaveObjectList.Free;
inherited;
end;
procedure TEvilMir.Run;//004A617C
var
nDir:Byte;
begin
if (m_boDeath) and (boslaves = true) then begin
boslaves:= false;
nEMDrops:=0;//reset all the drops/hitcount on parts
nEMHitCount:=0;
dwEMDied:=GetTickCount();//tell our slaves that their master has passed away
inc(nEMKills)
end;
if not m_boFixedHideMode and
not m_boStoneMode and
CanMove then begin
if boSlaves = FALSE then begin //if we dont have slaves already make them
boSlaves:= TRUE;
callslaves();
end;
//basicaly casting his normal fireball/firebang spell every 3.5seconds
if (m_TargetCret <> nil) and (Integer(GetTickCount - m_dwHitTick) > 3500) and (abs(m_nCurrX - m_TargetCret.m_nCurrX) <= 10) and (abs(m_nCurrY - m_TargetCret.m_nCurrY) <= 10) then begin
m_dwHitTick:=GetCurrentTime;
nDir:= GetNextDirection (m_nCurrX, m_nCurrY, m_TargetCret.m_nCurrX, m_TargetCret.m_nCurrY);
FlameCircle(nDir);
end;
if (m_TargetCret <> nil) and (Integer(GetTickCount - m_dwSpellTick) > 30000) and (abs(m_nCurrX - m_TargetCret.m_nCurrX) <= 10) and (abs(m_nCurrY - m_TargetCret.m_nCurrY) <= 10) then begin
MassThunder;
end;
//search for targets nearby
if ((GetTickCount - m_dwSearchEnemyTick) > 8000) or
(((GetTickCount - m_dwSearchEnemyTick) > 1000) and (m_TargetCret = nil)) then begin
m_dwSearchEnemyTick:=GetTickCount();
SearchTarget();
end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -