|
|
楼主 |
发表于 2026-3-27 09:59:51
|
显示全部楼层
发个祖玛教主的吧
祖玛教主类定义
TScultureKingMonster = class (TMonster)
private
DangerLevel: integer;
childlist: TList; //父甸绢 辰 何窍狼 府胶飘
public
BoCallFollower: Boolean;
constructor Create;
destructor Destroy; override;
procedure CallFollower; dynamic;
procedure MeltStone;
procedure Attack (target: TCreature; dir: byte); override;
procedure Run; override;
end;
类中的一些函数实现
constructor TScultureKingMonster.Create;
begin
inherited Create;
SearchRate := 1500 + longword(Random(1500));
ViewRange := 8;
BoStoneMode := TRUE; //贸澜俊绰 倒肺 被绢廉 乐澜...
CharStatusEx := STATE_STONE_MODE;
Dir := 5;
DangerLevel := 5; //5锅狼 困扁..
childlist := TList.Create;
BoCallFollower := TRUE;
end;
destructor TScultureKingMonster.Destroy;
begin
childlist.Free;
inherited Destroy;
end;
procedure TScultureKingMonster.MeltStone;
var
i: integer;
cret: TCreature;
event: TEvent;
begin
event := TEvent.Create (PEnvir, CX, CY, ET_SCULPEICE, 5 * 60 * 1000, TRUE);
if ( event <> nil ) and ( event.IsAddToMap = true ) then
begin
CharStatusEx := 0;
CharStatus := GetCharStatus;
SendRefMsg (RM_DIGUP, Dir, CX, CY, 0, \'\');
BoStoneMode := FALSE;
EventMan.AddEvent (event);
Exit;
end;
if event <> nil then event.Free;
end;
procedure TScultureKingMonster.CallFollower;
const
MAX_FOLLOWERS = 4;
var
i, count, nx, ny: integer;
monname: string;
mon: TCreature;
followers: array[0..MAX_FOLLOWERS-1] of string; // = (林付龋过\', 林付脚厘\', 付泵荤\', 禁扁唱规\');
begin
count := 6 + Random (6);
GetFrontPosition (self, nx, ny);
followers[0] := __ZumaMonster1;
followers[1] := __ZumaMonster2;
followers[2] := __ZumaMonster3;
followers[3] := __ZumaMonster4;
for i:=1 to count do begin
if childlist.Count < 30 then begin
monname := followers[Random(MAX_FOLLOWERS)];
mon := UserEngine.AddCreatureSysop (MapName, nx, ny, monname);
if mon <> nil then
childlist.Add (mon);
end;
end;
end;
procedure TScultureKingMonster.Attack (target: TCreature; dir: byte);
var
pwr: integer;
begin
with WAbil do
pwr := GetAttackPower (Lobyte(DC), ShortInt(Hibyte(DC)-Lobyte(DC)));
{inherited} HitHit2 (target, 0, pwr, TRUE);
end;
procedure TScultureKingMonster.Run;
var
i, dis, d, targdir: integer;
cret, nearcret: TCreature;
begin
// if (not BoGhost) and (not Death) and
// (StatusArr[POISON_STONE] = 0) and (StatusArr[POISON_ICE] = 0) and
// (StatusArr[POISON_STUN] = 0) then begin
if IsMoveAble then begin
if GetCurrentTime - WalkTime > GetNextWalkTime then begin
nearcret := nil;
//WalkTime := GetTickCount; 惑加罐篮 run俊辑 犁汲沥窃
if BoStoneMode then begin //酒流 葛嚼阑 唱鸥郴瘤 臼疽澜.
for i:=0 to VisibleActors.Count-1 do begin
cret := TCreature (PTVisibleActor(VisibleActors).cret);
if (not cret.Death) and (IsProperTarget(cret)) and (not cret.BoHumHideMode or BoViewFixedHide) then begin
if (abs(CX-cret.CX) <= 2) and (abs(CY-cret.CY) <= 2) then begin
MeltStone; //籍惑惑怕俊辑 踌绰促
WalkTime := GetCurrentTime + 2000;
break;
end;
end;
end;
end else begin
if (GetTickCount - SearchEnemyTime > 8000) or ((GetTickCount - SearchEnemyTime > 1000) and (TargetCret = nil)) then begin
SearchEnemyTime := GetTickCount;
MonsterNormalAttack;
end;
if BoCallFollower then begin
//5锅狼 矫访
if ((WAbil.HP / WAbil.MaxHP * 5) < DangerLevel) and (DangerLevel > 0) then begin
Dec (DangerLevel);
CallFollower;
end;
if WAbil.HP = WAbil.MaxHP then DangerLevel := 5; //檬扁拳
end;
end;
for i:=childlist.Count-1 downto 0 do begin
if (TCreature(childlist).Death) or (TCreature(childlist).BoGhost) then begin
childlist.Delete(i);
end;
end;
end;
end;
inherited Run;
end; |
|