📄 objmon2.pas
字号:
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 >= 10) and
(BaseObject.m_btRaceServer < 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;
m_btRaceServer := 10; //112
m_boBOSS:=true;
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 not m_boDeath and
not m_boGhost and
(m_wStatusTimeArr[POISON_STONE{5 0x6A}] = 0) then begin
if Integer(GetTickCount - m_dwWalkTick) >= m_nWalkSpeed then begin
m_dwWalkTick:=GetTickCount();
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 Integer(GetTickCount - m_dwHitTick) >= m_nNextHitTime then begin
m_dwHitTick:=GetTickCount();
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.SetMapXYFlag(nFlag:Integer);//004A6FB4
var
bo06:integer;
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:=3
else bo06:=0;
m_PEnvir.SetMapXYFlagx(m_nCurrX,m_nCurrY,bo06);
m_PEnvir.SetMapXYFlagx(m_nCurrX,m_nCurrY - 1,bo06);
m_PEnvir.SetMapXYFlagx(m_nCurrX,m_nCurrY - 2,bo06);
m_PEnvir.SetMapXYFlagx(m_nCurrX + 1,m_nCurrY - 1,bo06);
m_PEnvir.SetMapXYFlagx(m_nCurrX + 1,m_nCurrY - 2,bo06);
m_PEnvir.SetMapXYFlagx(m_nCurrX - 1,m_nCurrY,bo06);
m_PEnvir.SetMapXYFlagx(m_nCurrX - 2,m_nCurrY,bo06);
m_PEnvir.SetMapXYFlagx(m_nCurrX - 1,m_nCurrY - 1,bo06);
m_PEnvir.SetMapXYFlagx(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);
m_PEnvir.SetMapXYFlagx(m_nCurrX,m_nCurrY,3);
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;
{ Tmontishen }
constructor Tmontishen.Create;
begin
inherited;
m_btRaceServer:=211; //替身
end;
destructor Tmontishen.Destroy;
begin
inherited;
end;
procedure Tmontishen.Run;
var i:integer;
begin
(* if not m_boGhost and
not m_boDeath and
(m_wStatusTimeArr[POISON_STONE{5 0x6A}] = 0) then begin
if Integer(GetTickCount - m_dwWalkTick) >= m_nWalkSpeed then begin
m_dwWalkTick:=GetTickCount();
if Integer(GetTickCount - m_dwHitTick) >= m_nNextHitTime then begin
m_dwHitTick:=GetTickCount();
SearchTarget();
// if m_TargetCret <> nil then MakeChildBee();
end;
end;
end;
*)
if ( GetTickCount- m_dwtishenGhostTick > m_nghosttime) or m_boDeath then begin
makeghost;
if m_Master<>nil then begin
m_Master.m_bohastishen :=false;
for i:=m_Master.m_SlaveList.Count -1 downto 0 do begin
if TBaseObject(m_Master.m_SlaveList.Items[i]).m_boTishen then begin
// TBaseObject(m_Master.m_SlaveList.Items[i]).MakeGhost;
m_Master.m_SlaveList.Delete(i);
break;
end;
end; //for
end;
end;
inherited;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -