objmon2.pas
来自「2009最新 传奇汉化0599代码 传奇汉化」· PAS 代码 · 共 1,321 行 · 第 1/3 页
PAS
1,321 行
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;
end;
inherited;
end;
procedure TEvilMir.CallSlaves();
const
sMonName:array[0..2] of String = ('1', '2', '3');//basicaly by adding to this you can make new 'slaves' that drop better
var
I: Integer;
BaseObject:TBaseObject;
begin
for i := 0 to High(g_DragonSearchPath) do begin
if (g_DragonSearchPath[i,0] = 0) and (g_DragonSearchPath[i,1] = 0) then Continue;
BaseObject := UserEngine.RegenMonsterByName(m_PEnvir.sMapName, m_nCurrX+g_DragonSearchPath[i,0], m_nCurrY+g_DragonSearchPath[i,1], sMonName[_Min(nEMKills,Length(sMonName))]);
{if BaseObject <> nil then begin
m_xSlaveList.Add(BaseObject);
end;}
end;
end;
procedure TEvilMir.FlameCircle(nDir:Integer);
var
nSX,nSY,nTX,nTY,nPwr:Integer;
I:Integer;
magpwr:Integer;
TargetNum:Integer;
WAbil:pTAbility;
BaseObject:TBaseObject;
Target:TBaseObject;
begin
//target selected
Target := m_TargetCret;
{do spell effect}
if nDir <= 4 then
SendRefMsg(RM_81,nDir,m_nCurrX,m_nCurrY,Integer(Target),'');
if nDir = 5 then
SendRefMsg(RM_82,nDir,m_nCurrX,m_nCurrY,Integer(Target),'');
if nDir >= 6 then
SendRefMsg(RM_83,nDir,m_nCurrX,m_nCurrY,Integer(Target),'');
//if (nDir <> 4) and (nDir <> 5) and (nDir <> 6) then
//Target.SendMsg(self,RM_SYSMESSAGE,0,g_Config.btGreenMsgFColor,g_Config.btGreenMsgBColor,0,'Evilmir hits in unknown direction debug required, dir:');
for i:=0 to Target.m_VisibleActors.Count-1 do begin
BaseObject:= TBaseObject (pTVisibleBaseObject(Target.m_VisibleActors[i]).BaseObject);
if (abs(Target.m_nCurrX-BaseObject.m_nCurrX) <= 2) and (abs(Target.m_nCurrY-BaseObject.m_nCurrY) <= 2) then begin
if BaseObject <> nil then begin
if IsProperTarget (BaseObject) then begin
if Random(50) >= BaseObject.m_nAntiMagic then begin
WAbil:=@m_WAbil;
magpwr:=Random(nEMKills * 5) + (Random(SmallInt(HiWord(WAbil.MC) - LoWord(WAbil.MC)) + 1) + LoWord(WAbil.MC));
BaseObject.SendDelayMsg (self, RM_MAGSTRUCK, 0, magpwr, 1, 0, '', 600);
end;
end;
end;
end;
end;
end;
procedure TEvilMir.MassThunder();
var
xTargetList:TList;
BaseObject:TBaseObject;
WAbil:pTAbility;
magpwr:Integer;
i:Integer;
begin
m_dwSpellTick:=GetTickCount();
SendAttackMsg(RM_hit,0,m_nCurrX,m_nCurrY);//make client show random tbolting;
xTargetList := TList.Create;
GetMapBaseObjects(m_PEnvir,m_nCurrX,m_nCurrY,14,xTargetList);
if (xTargetList.Count>0) then begin
for i:=xTargetList.Count-1 downto 0 do begin
BaseObject := TBaseObject(xTargetList.Items[i]);
if (BaseObject<>nil) then begin
if IsProperTarget(BaseObject) then begin
WAbil:=@m_WAbil;
magpwr:=Random(nEMKills * 12) + (Random(SmallInt(HiWord(WAbil.SC) - LoWord(WAbil.SC)) + 1) + LoWord(WAbil.SC));
BaseObject.SendDelayMsg (self, RM_MAGSTRUCK, 0, magpwr, 1, 0, '', 600);
end;
xTargetList.Delete(i);
end;
end;
end;
xTargetList.Free;
end;
function TEvilMir.Operate(ProcessMsg:pTProcessMessage):boolean;
begin
if (ProcessMsg.wIdent = RM_POISON) then begin
massthunder();
end;
Result:=inherited Operate(ProcessMsg);
end;
procedure TEvilMir.Die;
begin
inherited;
m_dwDeathTick := GetTickCount + 5*60*1000;
end;
{---- Adjust global SVN revision ----}
initialization
SVNRevision('$Id: ObjMon2.pas 594 2007-03-09 15:00:12Z damian $');
end.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?