📄 objmon3.pas
字号:
end;
procedure TMinorNumaObject.Run;
begin
if CanMove then begin
if ((GetTickCount - m_dwSearchEnemyTick) > 8000) or
(((GetTickCount - m_dwSearchEnemyTick) > 1000) and (m_TargetCret = nil)) then begin
m_dwSearchEnemyTick:=GetTickCount();
SearchTarget();
end;
end;
inherited;
end;
constructor TSandMobObject.Create;
begin
inherited;
//m_boHideMode := TRUE;
nComeOutValue := 8;
end;
destructor TSandMobObject.Destroy;
begin
inherited;
end;
procedure TSandMobObject.Run;
begin
if CanMove then begin
if (GetCurrentTime - m_dwWalkTick > GetWalkSpeed) then begin
m_dwWalkTick := GetCurrentTime;
if (m_boFixedHideMode) then begin
if (((m_WAbil.HP > (m_WAbil.MaxHP / 20)) and CheckComeOut())) then
m_dwAppearStart := GetTickCount;
end else begin
if ((m_WAbil.HP > 0) and (m_WAbil.HP < (m_WAbil.MaxHP / 20)) and (GetTickCount - m_dwAppearStart > 3000)) then
ComeDown
else if (m_TargetCret<>nil) then begin
if (abs(m_nCurrX - m_TargetCret.m_nCurrX) > 15) and (abs(m_nCurrY - m_TargetCret.m_nCurrY) > 15) then begin
ComeDown;
exit;
end;
end;
if GetCurrentTime - m_dwHitTick > GetHitSpeed then
SearchTarget();
if (not m_boFixedHideMode) then begin
if (AttackTarget) then
inherited;
end;
end;
end;
end;
inherited;
end;
constructor TRockManObject.Create;
begin
inherited;
//m_dwSearchTick := 2500 + Random(1500);
//m_dwSearchTime := GetTickCount();
m_boHideMode := TRUE;
end;
destructor TRockManObject.Destroy;
begin
inherited;
end;
procedure TRockManObject.Run;
begin
{if CanMove then begin
if (m_fHideMode) then begin
if (CheckComeOut(8)) then
ComeOut;
m_dwWalkTime := GetTickCount + 1000;
end else begin
if ((GetTickCount - m_dwSearchEnemyTime > 8000) or ((GetTickCount - m_dwSearchEnemyTime > 1000) and (m_pTargetObject=nil))) then begin
m_dwSearchEnemyTime := GetTickCount;
MonsterNormalAttack;
if (m_pTargetObject=nil) then
ComeDown;
end;
end;
end;}
inherited;
end;
{ TMagicMonObject }
constructor TMagicMonObject.Create;
begin
inherited;
m_dwSearchTime:=Random(1500) + 1500;
m_boUseMagic:=False;
end;
destructor TMagicMonObject.Destroy;
begin
inherited;
end;
procedure TMagicMonObject.LightingAttack(nDir: Integer);
begin
end;
procedure TMagicMonObject.Run;
var
nAttackDir:Integer;
nX,nY:Integer;
begin
if (not bo554) and CanMove then begin
//血量低于一半时开始用魔法攻击
if m_WAbil.HP < m_WAbil.MaxHP div 2 then m_boUseMagic:=True
else m_boUseMagic:=False;
if ((GetTickCount - m_dwSearchEnemyTick) > 1000) and (m_TargetCret = nil) then begin
m_dwSearchEnemyTick:=GetTickCount();
SearchTarget();
end;
if m_Master = nil then exit;
nX:=abs(m_nCurrX - m_Master.m_nCurrX);
nY:=abs(m_nCurrY - m_Master.m_nCurrY);
if (nX <= 5) and (nY <= 5) then begin
if m_boUseMagic or ((nX = 5) or (nY = 5)) then begin
if GetCurrentTime - m_dwHitTick > GetHitSpeed then begin
m_dwHitTick:=GetCurrentTime;
nAttackDir:=GetNextDirection(m_nCurrX,m_nCurrY,m_Master.m_nCurrX,m_Master.m_nCurrY);
LightingAttack(nAttackDir);
end;
end;
end;
end;
inherited Run;
end;
{ TBoneKingMonster }
constructor TBoneKingMonster.Create;
begin
inherited;
m_dwSearchTime:=Random(1500) + 1500;
m_nViewRange:=8;
m_btDirection:=5;
m_nDangerLevel:=5;
m_SlaveObjectList:=TList.Create;
end;
destructor TBoneKingMonster.Destroy;
begin
m_SlaveObjectList.Free;
inherited;
end;
procedure TBoneKingMonster.MagicAttack(nDir:Integer);
var
Target:TBaseObject;
magpwr:Integer;
WAbil:pTAbility;
begin
if m_TargetCret = nil then exit;
Target:=m_TargetCret;
sendrefmsg(RM_FLYAXE,nDir,m_nCurrx,m_nCurry,Integer(Target),'');
{hit first target}
if IsProperTarget(Target) then begin
if Random(50) >= Target.m_nantiMagic then begin
WAbil:=@m_WAbil;
magpwr:=(Random(SmallInt(HiWord(WAbil.MC) - LoWord(WAbil.MC)) + 1) + LoWord(WAbil.MC));
Target.SendDelayMsg(self, RM_MAGSTRUCK, 0, magpwr, 0, 0, '', 600);
end;
end;
end;
procedure TBoneKingMonster.CallSlave;
const
sMonName:array[0..2] of String = ('BoneCaptain', 'BoneArcher', 'BoneSpearman');
var
I: Integer;
nC:Integer;
n10,n14:Integer;
BaseObject:TBaseObject;
begin
nC:=Random(6) + 6;
GetFrontPosition(n10,n14);
if m_SlaveObjectList.Count <= 30 then //gotta make sure he has room for extra slaves before he raises his staff lol
sendrefmsg(RM_LIGHTING,1,m_nCurrx,m_nCurry,integer(self),''); //make him raise his staff
for I := 1 to nC do begin
if m_SlaveObjectList.Count >= 30 then break;
BaseObject:=UserEngine.RegenMonsterByName(m_sMapName,n10,n14,sMonName[Random(3)]);
if BaseObject <> nil then begin
m_SlaveObjectList.Add(BaseObject);
end;
end; // for
end;
procedure TBoneKingMonster.Attack(TargeTBaseObject: TBaseObject;nDir: Integer);
var
WAbil:pTAbility;
nPower:Integer;
begin
WAbil:=@m_WAbil;
nPower:=GetAttackPower(LoWord(WAbil.DC),SmallInt(HiWord(WAbil.DC) - LoWord(WAbil.DC)));
HitMagAttackTarget(TargeTBaseObject,0,nPower,True);
end;
procedure TBoneKingMonster.Run;
var
I: Integer;
BaseObject:TBaseObject;
nAttackDir:Integer;
begin
if CanMove and (GetCurrentTime - m_dwWalkTick > GetWalkSpeed) then begin
if (m_TargetCret <> nil) and
(abs(m_nCurrX - m_TargetCret.m_nCurrx) >= 2) and (abs(m_nCurry - m_TargetCret.m_nCurry) >= 2) and
(Integer(GetTickCount - m_dwHitTick) > 2200) then begin
if MagCanHitTarget(m_nCurrX,m_nCurrY,m_targetCret) then begin //make sure the 'line' in wich magic will go isnt blocked
m_dwHitTick:=GetCurrentTime;
nAttackDir:=GetNextDirection(m_nCurrx,m_nCurry,m_TargetCret.m_nCurrx,m_TargetCret.m_nCurry);
MagicAttack(nAttackDir);
end;
end;
if ((GetTickCount - m_dwSearchEnemyTick) > 8000) or
(((GetTickCount - m_dwSearchEnemyTick) > 1000) and (m_TargetCret = nil)) then begin
m_dwSearchEnemyTick:=GetTickCount();
SearchTarget();
if (m_nDangerLevel > m_WAbil.HP / m_WAbil.MaxHP * 5) and (m_nDangerLevel > 0) then begin
Dec(m_nDangerLevel);
CallSlave();
end;
if m_WAbil.HP = m_WAbil.MaxHP then
m_nDangerLevel:=5;
end;
for I := m_SlaveObjectList.Count - 1 downto 0 do begin
BaseObject:=TBaseObject(m_SlaveObjectList.Items[I]);
if BaseObject.m_boDeath or BaseObject.m_boGhost then
m_SlaveObjectList.Delete(I);
end; // for
end;
inherited;
end;
constructor TPercentMonster.Create;
begin
inherited;
m_boDupMode:=False;
bo554:=False;
m_dwThinkTick:=GetTickCount();
m_nViewRange:=5;
m_nRunTime:=250;
m_dwSearchTime:=3000 + Random(2000);
m_dwSearchTick:=GetTickCount();
m_btRaceServer:=80;
end;
destructor TPercentMonster.Destroy;
begin
inherited;
end;
{
function TPercentMonster.MakeClone(sMonName: String;OldMon:TBaseObject): TBaseObject; //004A8C58
var
ElfMon:TBaseObject;
begin
Result:=nil;
ElfMon:=UserEngine.RegenMonsterByName(m_PEnvir.sMapName,m_nCurrX,m_nCurrY,sMonName);
if ElfMon <> nil then begin
ElfMon.m_Master:=OldMon.m_Master;
ElfMon.m_dwMasterRoyaltyTick:=OldMon.m_dwMasterRoyaltyTick;
ElfMon.m_btSlaveMakeLevel:=OldMon.m_btSlaveMakeLevel;
ElfMon.m_btSlaveExpLevel:=OldMon.m_btSlaveExpLevel;
ElfMon.RecalcAbilitys;
ElfMon.RefNameColor;
if OldMon.m_Master <> nil then
OldMon.m_Master.m_SlaveList.Add(ElfMon);
ElfMon.m_WAbil:=OldMon.m_WAbil;
ElfMon.m_wStatusTimeArr:=OldMon.m_wStatusTimeArr;
ElfMon.m_TargetCret:=OldMon.m_TargetCret;
ElfMon.m_dwTargetFocusTick:=OldMon.m_dwTargetFocusTick;
ElfMon.m_LastHiter:=OldMon.m_LastHiter;
ElfMon.m_LastHiterTick:=OldMon.m_LastHiterTick;
ElfMon.m_btDirection:=OldMon.m_btDirection;
Result:=ElfMon;
end;
end;
}
function TPercentMonster.Operate(ProcessMsg: pTProcessMessage):Boolean;
begin
Result:=inherited Operate(ProcessMsg);
end;
function TPercentMonster.Think():Boolean; //004A8E54
var
nOldX,nOldY:integer;
begin
Result:=False;
if (GetTickCount - m_dwThinkTick) > 3 * 1000 then begin
m_dwThinkTick:=GetTickCount();
if m_PEnvir.GetXYObjCount(m_nCurrX,m_nCurrY) >= 2 then m_boDupMode:=True;
if not IsProperTarget{FFFF4}(m_TargetCret) then m_TargetCret:=nil;
end; //004A8ED2
if m_boDupMode then begin
nOldX:=m_nCurrX;
nOldY:=m_nCurrY;
WalkTo(Random(8),False);
if (nOldX <> m_nCurrX) or (nOldY <> m_nCurrY) then begin
m_boDupMode:=False;
Result:=True;
end;
end;
end;
function TPercentMonster.AttackTarget():Boolean; //004A8F34
var
btDir:Byte;
begin
Result:=False;
if m_TargetCret <> nil then begin
if GetAttackDir(m_TargetCret,btDir) then begin
if GetCurrentTime - m_dwHitTick > GetHitSpeed then begin
m_dwHitTick:=GetCurrentTime;
m_dwTargetFocusTick:=GetTickCount();
Attack(m_TargetCret,btDir); //FFED
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); {0FFF0h}
//004A8FE3
end else begin
DelTargetCreat();{0FFF1h}
//004A9009
end;
end;
end;
end;
procedure TPercentMonster.Run; //004A9020
var
nX,nY:Integer;
begin
if not m_boFixedHideMode and
not m_boStoneMode and
CanMove then begin
if Think then begin
inherited;
exit;
end;
if m_boWalkWaitLocked then begin
if (GetTickCount - m_dwWalkWaitTick) > m_dwWalkWait then begin
m_boWalkWaitLocked:=False;
end;
end;
if not m_boWalkWaitLocked and (GetCurrentTime - m_dwWalkTick > GetWalkSpeed) then begin
m_dwWalkTick:=GetCurrentTime;
Inc(m_nWalkCount);
if m_nWalkCount > m_nWalkStep then begin
m_nWalkCount:=0;
m_boWalkWaitLocked:=True;
m_dwWalkWaitTick:=GetTickCount();
end; //004A9151
if not m_boRunAwayMode then begin
if not m_boNoAttackMode then begin
if m_TargetCret <> nil then begin
if AttackTarget{FFEB} then begin
inherited;
exit;
end;
end else begin
m_nTargetX:=-1;
if m_boMission then begin
m_nTargetX:=m_nMissionX;
m_nTargetY:=m_nMissionY;
end; //004A91D3
end;
end; //004A91D3 if not bo2C0 then begin
if m_Master <> nil then begin
if m_TargetCret = nil then begin
m_Master.GetBackPosition(nX,nY);
if (abs(m_nTargetX - nX) > 1) or (abs(m_nTargetY - nY{nX}) > 1) then begin //004A922D
m_nTargetX:=nX;
m_nTargetY:=nY;
if (abs(m_nCurrX - nX) <= 2) and (abs(m_nCurrY - nY) <= 2) then begin
if m_PEnvir.GetMovingObject(nX,nY,True) <> nil then begin
m_nTargetX:=m_nCurrX;
m_nTargetY:=m_nCurrY;
end //004A92A5
end;
end; //004A92A5
end; //004A92A5 if m_TargetCret = nil then begin
if (not m_Master.m_boSlaveRelax) and
((m_PEnvir <> m_Master.m_PEnvir) or
(abs(m_nCurrX-m_Master.m_nCurrX) > 20) or
(abs(m_nCurrY-m_Master.m_nCurrY) > 20)) then begin
// sysmsg('recalling to my master',c_red,t_hint);
SpaceMove(m_Master.m_PEnvir.sMapName, m_nTargetX, m_nTargetY, 1);
end; // 004A937E
end;// 004A937E if m_Master <> nil then begin
end else begin //004A9344
if (m_dwRunAwayTime > 0) and ((GetTickCount - m_dwRunAwayStart) > m_dwRunAwayTime) then begin
m_boRunAwayMode:=False;
m_dwRunAwayTime:=0;
end;
end; //004A937E
if (m_Master <> nil) and m_Master.m_boSlaveRelax then begin
inherited ;
exit;
end; //004A93A6
if m_nTargetX <> -1 then begin
GotoTargetXY(); //004A93B5 0FFEF
end else begin
if m_TargetCret = nil then Wondering();// FFEE //Jacky
end; //004A93D8
end;
end; //004A93D8
inherited;
end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -