📄 objmon3.pas
字号:
{ TRedMonster }
constructor TRedMonster.Create; //004A9690
begin
inherited;
m_dwSearchTime := Random(1500) + 1500;
end;
destructor TRedMonster.Destroy;
begin
inherited;
end;
procedure TRedMonster.Run; //004A9720
begin
if not m_boDeath and
not bo554 and
not m_boGhost and
(m_wStatusTimeArr[POISON_STONE {5 0x6A}] = 0) then
begin
if m_TargetCret <> nil then
begin
m_nTargetX := m_TargetCret.m_nCurrX;
m_nTargetY := m_TargetCret.m_nCurrY;
if (abs(m_nTargetX - m_nCurrX) = 1) and (abs(m_nTargetY - m_nCurrY) = 1) then
begin
if (Random(m_TargetCret.m_btAntiPoison + 7) <= 6) and (m_TargetCret.m_wStatusTimeArr[POISON_DECHEALTH] = 0) then
begin
m_TargetCret.MakePosion(POISON_DAMAGEARMOR, 30, 1);
end;
end;
end;
if ((GetTickCount - m_dwSearchEnemyTick) > 8000) or
(((GetTickCount - m_dwSearchEnemyTick) > 1000) and (m_TargetCret = nil)) then
begin
m_dwSearchEnemyTick := GetTickCount();
SearchTarget();
end;
end;
inherited;
end;
{ khazard }
constructor TKhazard.Create; //004A9690
begin
inherited;
m_dwSearchTime := Random(1500) + 1500;
end;
destructor TKhazard.Destroy;
begin
inherited;
end;
procedure TKhazard.Run; //004A9720
var
time1, nX, nY: Integer;
begin
time1 := -1;
if not m_boDeath and
not bo554 and
not m_boGhost and
(m_wStatusTimeArr[POISON_STONE {5 0x6A}] = 0) then
begin
time1 := Random(2);
if m_TargetCret <> nil then
begin
m_nTargetX := m_TargetCret.m_nCurrX;
m_nTargetY := m_TargetCret.m_nCurrY;
if (abs(m_nTargetX - m_nCurrX) = 2) and (abs(m_nTargetY - m_nCurrY) = 2) then
begin
if time1 = 0 then
begin //do drag back on random
GetFrontPosition(nX, nY);
m_TargetCret.SendRefMsg(RM_SPACEMOVE_FIRE, 0, 0, 0, 0, '');
m_TargetCret.SpaceMove(m_sMapName, nX, nY, 0);
if (Random(1) = 0) and (Random(m_TargetCret.m_btAntiPoison + 7) <= 6) then
begin
m_TargetCret.MakePosion(POISON_DECHEALTH, 35, 2);
Exit;
end;
end else
begin
if m_TargetCret.m_WAbil.HP <= m_TargetCret.m_WAbil.MaxHP div 2 then //if target below half hp
GetFrontPosition(nX, nY);
m_TargetCret.SendRefMsg(RM_SPACEMOVE_FIRE, 0, 0, 0, 0, '');
m_TargetCret.SpaceMove(m_sMapName, nX, nY, 0);
if (Random(1) = 0) and (Random(m_TargetCret.m_btAntiPoison + 7) <= 6) then
begin
m_TargetCret.MakePosion(POISON_DECHEALTH, 35, 2);
Exit;
end;
end;
end;
end;
if ((GetTickCount - m_dwSearchEnemyTick) > 8000) or
(((GetTickCount - m_dwSearchEnemyTick) > 1000) and (m_TargetCret = nil)) then
begin
m_dwSearchEnemyTick := GetTickCount();
SearchTarget();
end;
end;
inherited;
end;
{ end }
{ runaway }
constructor TRunAway.Create; //004A9690
begin
inherited;
m_dwSearchTime := Random(1500) + 1500;
end;
destructor TRunAway.Destroy;
begin
inherited;
end;
procedure TRunAway.Run; //004A9720
var
time1, nX, nY: Integer;
borunaway: Boolean;
begin
if not m_boDeath and
not bo554 and
not m_boGhost then
begin
if m_TargetCret <> nil then
begin
m_nTargetX := m_TargetCret.m_nCurrX;
m_nTargetY := m_TargetCret.m_nCurrY;
if (m_WAbil.HP <= Round(m_WAbil.MaxHP div 2)) and (borunaway = False) then
begin //if health less then 1/2
GetFrontPosition(nX, nY);
SendRefMsg(RM_SPACEMOVE_FIRE, 0, 0, 0, 0, '');
SpaceMove(m_sMapName, nX - 2, nY - 2, 0); //move backwards 3 spaces
borunaway := True;
end else
begin
if m_WAbil.HP >= Round(m_WAbil.MaxHP div 2) then
begin
borunaway := False;
end;
end;
if borunaway then
begin
if Integer(GetTickCount - time1) > 5000 then
begin
if (abs(m_nTargetX - m_nCurrX) = 1) and (abs(m_nTargetY - m_nCurrY) = 1) then
begin
WalkTo(Random(4), True);
end else
begin
WalkTo(Random(7), True);
end;
end else
begin
time1 := GetTickCount();
end;
end;
end;
if ((GetTickCount - m_dwSearchEnemyTick) > 8000) or
(((GetTickCount - m_dwSearchEnemyTick) > 1000) and (m_TargetCret = nil)) then
begin
m_dwSearchEnemyTick := GetTickCount();
SearchTarget();
end;
end;
inherited;
end;
{ end }
{ Tele mob }
constructor TTeleMonster.Create; //004A9690
begin
inherited;
m_dwSearchTime := Random(1500) + 1500;
end;
destructor TTeleMonster.Destroy;
begin
inherited;
end;
procedure TTeleMonster.Run; //004A9720
begin
if not m_boDeath and
not bo554 and
not m_boGhost and
(m_wStatusTimeArr[POISON_STONE {5 0x6A}] = 0) then
begin
//if it finds a target tele to him!
if m_TargetCret <> nil then
begin
if (abs(m_nCurrX - m_nTargetX) > 5) or
(abs(m_nCurrY - m_nTargetY) > 5) then
begin
// if 5 spaces away teleport to the enemy!
SendRefMsg(RM_SPACEMOVE_FIRE, 0, 0, 0, 0, '');
SpaceMove(m_TargetCret.m_sMapName, m_TargetCret.m_nCurrX, m_TargetCret.m_nCurrY, 0);
end;
end;
//end
if ((GetTickCount - m_dwSearchEnemyTick) > 8000) or
(((GetTickCount - m_dwSearchEnemyTick) > 1000) and (m_TargetCret = nil)) then
begin
m_dwSearchEnemyTick := GetTickCount();
SearchTarget();
end;
end;
inherited;
end;
{ end }
{ Defend Monster }
constructor TDefendMonster.Create; //004A9690
begin
inherited;
m_dwSearchTime := Random(1500) + 1500;
end;
destructor TDefendMonster.Destroy;
begin
inherited;
end;
procedure TDefendMonster.Run; //004A9720
begin
{if not m_boDeath and
not bo554 and
not m_boGhost then begin
//if it finds a target 15 spaces away start sequence
if (m_TargetCret <> nil) and (callguardrun=false) then begin
// call guards!
mainoutmessage('CALL GUARD' + inttostr(m_nCurrX) + ' ' + inttostr(m_nCurrY));
callguard(m_sMapName,m_nCurrX,m_nCurrY);
end;
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 TDefendMonster.CallGuard(mapmap: string; xx, yy: Integer);
var
i: Integer;
nC: Integer;
nX, nY: Integer;
sMonName: array[0..3] of string;
BaseObject: TBaseObject;
begin
nC := 7; //how many areas around the boss
// GetFrontPosition(nx,ny);
sMonName[0] := 'Hen';
// sMonName[1]:=sZuma2;
// sMonName[2]:=sZuma3;
// sMonName[3]:=sZuma4;
nX := xx;
nY := yy;
for i := 0 to nC do
begin
{ case i of
0: begin
Dec(nY);
end;
1: begin
Inc(nX);
Dec(nY);
end;
2: begin
Inc(nX)
end;
3: begin
Inc(nX);
Inc(nY);
end;
4: begin
Inc(nY);
end;
5: begin
Dec(nX);
Inc(nY);
end;
6: begin
Dec(nX);
end;
7: begin
Dec(nX);
Dec(nY);
end;
end;}
// if m_GuardObjects.Count >= 5 then break;
BaseObject := UserEngine.RegenMonsterByName(mapmap, nX, nY, sMonName[0]);
if BaseObject <> nil then
begin
m_GuardObjects.Add(BaseObject);
end;
end; // for
callguardrun := True; //tell it its already been run!
end;
constructor TClone.Create; //004AA4B4
begin
inherited;
m_dwSearchTime := Random(1500) + 1500;
end;
destructor TClone.Destroy;
begin
inherited;
end;
function TClone.Operate(ProcessMsg: pTProcessMessage): Boolean;
begin
if (ProcessMsg.wIdent = RM_STRUCK) or (ProcessMsg.wIdent = RM_MAGSTRUCK) or (ProcessMsg.wIdent = RM_SPELL) then
begin
if m_Master <> nil then
begin
if m_Master.m_WAbil.MP <= 0 then m_WAbil.HP := 0; //kill slave if your mp is 0
if (ProcessMsg.wIdent = RM_SPELL) then
begin
MainOutMessage('rmSpell: ' + IntToStr(ProcessMsg.nParam3));
Dec(m_Master.m_WAbil.MP, ProcessMsg.nParam3);
end else
begin
MainOutMessage('rmHit: ' + IntToStr(ProcessMsg.wParam));
Dec(m_Master.m_WAbil.MP, ProcessMsg.wParam);
end;
end;
end;
end;
procedure TClone.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 TClone.Struck(hiter: TBaseObject);
begin
if hiter = nil then Exit;
{m_btDirection:=hiter.m_btDirection;
n550:=Random(4) + (n550 + 4);
n550:=_MIN(20,n550);
m_PEnvir.GetNextPosition(m_nCurrX,m_nCurrY,m_btDirection,n550,m_nTargetX,m_nTargetY);}
end;
procedure TClone.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();
//nicky
//SearchMobF;
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;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -