📄 actor.pas
字号:
startframe := pm.ActDie.start + Dir * (pm.ActDie.frame +
pm.ActDie.skip);
endframe := startframe + pm.ActDie.frame - 1;
startframe := endframe; //
frametime := pm.ActDie.ftime;
starttime := GetTickCount;
end;
SM_NOWDEATH:
begin
startframe := pm.ActDie.start + Dir * (pm.ActDie.frame +
pm.ActDie.skip);
endframe := startframe + pm.ActDie.frame - 1;
frametime := pm.ActDie.ftime;
starttime := GetTickCount;
end;
SM_SKELETON:
begin
startframe := pm.ActDeath.start + Dir;
endframe := startframe + pm.ActDeath.frame - 1;
frametime := pm.ActDeath.ftime;
starttime := GetTickCount;
end;
end;
end;
procedure TActor.ReadyAction(msg: TChrMsg);
var
n: Integer;
pmag: PTUseMagicInfo;
begin
actbeforex := XX;
actbeforey := YY;
if msg.ident = SM_ALIVE then
begin
Death := False;
Skeleton := False;
end;
if not Death then
begin
case msg.ident of
SM_TURN, SM_WALK, SM_BACKSTEP, SM_RUSH, SM_RUSHKUNG, SM_RUN, SM_DIGUP,
SM_ALIVE:
begin
Feature := msg.Feature;
State := msg.State;
//某腐磐狼 何啊利牢 惑怕 钎矫
if State and STATE_OPENHEATH <> 0 then
BoOpenHealth := True
else
BoOpenHealth := True;
end;
end;
if msg.ident = SM_LIGHTING then
n := 0;
if MySelf = Self then
begin
if (msg.ident = CM_WALK) then
if not PlayScene.CanWalk(msg.X, msg.Y) then
Exit; //捞悼 阂啊
if (msg.ident = CM_RUN) then
if not PlayScene.CanRun(MySelf.XX, MySelf.YY, msg.X, msg.Y) then
Exit; //捞悼 阂啊
//msg
case msg.ident of
CM_TURN,
CM_WALK,
CM_SITDOWN,
CM_RUN,
CM_HORSERUN,
CM_HIT,
CM_POWERHIT,
CM_LONGHIT,
CM_WIDEHIT,
CM_HEAVYHIT,
CM_40HIT,
CM_41HIT,
CM_42HIT,
CM_43HIT,
CM_BIGHIT:
begin
RealActionMsg := msg;
//泅犁 角青登绊 乐绰 青悼, 辑滚俊 皋技瘤甫 焊晨.
case Msg.ident of
3009:
Msg.ident:=13;
CM_40HIT:
Msg.ident:=SM_40HIT;
CM_41HIT:
Msg.ident:=SM_41HIT;
CM_42HIT:
Msg.ident:=SM_42HIT;
CM_43HIT:
Msg.ident:=SM_43HIT;
else
msg.ident := msg.ident - 3000; //SM_?? 栏肺 函券 窃
End;
end;
CM_THROW:
begin
if Feature <> 0 then
begin
targetx := TActor(msg.Feature).XX; //x 带瘤绰 格钎
targety := TActor(msg.Feature).YY; //y
TargetRecog := TActor(msg.Feature).RecogId;
end;
RealActionMsg := msg;
msg.ident := SM_THROW;
end;
CM_FIREHIT:
begin
RealActionMsg := msg;
msg.ident := SM_FIREHIT;
end;
CM_SPELL:
begin
RealActionMsg := msg;
pmag := PTUseMagicInfo(msg.Feature);
RealActionMsg.Dir := pmag.MagicSerial;
msg.ident := msg.ident - 3000; //SM_?? 栏肺 函券 窃
end;
end;
oldx := XX;
oldy := YY;
olddir := Dir;
end;
case msg.ident of
SM_STRUCK:
begin
//Abil.HP := msg.x; {HP}
//Abil.MaxHP := msg.y; {maxHP}
//msg.dir {damage}
//饭骇捞 臭栏搁 嘎绰 矫埃捞 陋促.
MagicStruckSound := msg.X; //1捞惑, 付过瓤苞
n := Round(200 - Abil.Level * 5);
if n > 80 then
struckframetime := n
else
struckframetime := 80;
LastStruckTime := GetTickCount;
end;
SM_SPELL:
begin
Dir := msg.Dir;
//msg.x :targetx
//msg.y :targety
pmag := PTUseMagicInfo(msg.Feature);
if pmag <> nil then
begin
CurMagic := pmag^;
CurMagic.ServerMagicCode := -1; //FIRE 措扁
//CurMagic.MagicSerial := 0;
CurMagic.targx := msg.X;
CurMagic.targy := msg.Y;
Dispose(pmag);
end;
//DScreen.AddSysMsg ('SM_SPELL');
end;
else
begin
XX := msg.X;
YY := msg.Y;
Dir := msg.Dir;
// aFrmMain.NearActor;
end;
end;
CurrentAction := msg.ident;
CalcActorFrame;
//DScreen.AddSysMsg (IntToStr(msg.Ident) + ' ' + IntToStr(XX) + ' ' + IntToStr(YY) + ' : ' + IntToStr(msg.x) + ' ' + IntToStr(msg.y));
end
else
begin
if msg.ident = SM_SKELETON then
begin
CurrentAction := msg.ident;
CalcActorFrame;
Skeleton := True;
end;
end;
if (msg.ident = SM_DEATH) or (msg.ident = SM_NOWDEATH) then
begin
Death := True;
DeathTime := GetTickCount;
PlayScene.ActorDied(Self);
end;
RunSound;
end;
procedure TActor.ProcMsg;
var
msg: TChrMsg;
meff: TMagicEff;
begin
while True do
begin
if MsgList.Count <= 0 then
Break;
if CurrentAction <> 0 then
Break;
msg := PTChrMsg(MsgList[0])^;
Dispose(PTChrMsg(MsgList[0]));
MsgList.Delete(0);
case msg.ident of
SM_STRUCK:
begin
HiterCode := msg.Sound; //唱甫 锭赴仇
ReadyAction(msg);
end;
SM_DEATH,
SM_NOWDEATH,
SM_SKELETON,
SM_ALIVE,
SM_ACTION_MIN..SM_ACTION_MAX,
SM_ACTION2_MIN..SM_ACTION2_MAX,
3000..3099: //努扼捞攫飘 捞悼 皋技瘤肺 抗距凳
begin
ReadyAction(msg);
end;
SM_SPACEMOVE_HIDE:
begin
meff := TScrollHideEffect.Create(250, 10, XX, YY, Self);
PlayScene.EffectList.Add(meff);
PlaySound(s_spacemove_out);
end;
SM_SPACEMOVE_HIDE2:
begin
meff := TScrollHideEffect.Create(1590, 10, XX, YY, Self);
PlayScene.EffectList.Add(meff);
PlaySound(s_spacemove_out);
end;
SM_SPACEMOVE_SHOW:
begin
meff := TCharEffect.Create(260, 10, Self);
PlayScene.EffectList.Add(meff);
msg.ident := SM_TURN;
ReadyAction(msg);
PlaySound(s_spacemove_in);
end;
SM_SPACEMOVE_SHOW2:
begin
meff := TCharEffect.Create(1600, 10, Self);
PlayScene.EffectList.Add(meff);
msg.ident := SM_TURN;
ReadyAction(msg);
PlaySound(s_spacemove_in);
end;
else
begin
end;
end;
end;
end;
procedure TActor.ProcHurryMsg; //弧府 贸府秦具 登绰 皋技瘤 贸府窃..
var
n: Integer;
msg: TChrMsg;
fin: Boolean;
begin
n := 0;
while True do
begin
if MsgList.Count <= n then
Break;
msg := PTChrMsg(MsgList[n])^;
fin := False;
case msg.ident of
SM_MAGICFIRE:
if CurMagic.ServerMagicCode <> 0 then
begin
CurMagic.ServerMagicCode := 111;
CurMagic.target := msg.X;
if msg.Y in [0..MAXMAGICTYPE - 1] then
CurMagic.EffectType := TMagicType(msg.Y);
CurMagic.EffectNumber := msg.Dir;
CurMagic.targx := msg.Feature;
CurMagic.targy := msg.State;
CurMagic.Recusion := True;
fin := True;
//DScreen.AddSysMsg ('SM_MAGICFIRE GOOD');
end;
SM_MAGICFIRE_FAIL:
if CurMagic.ServerMagicCode <> 0 then
begin
CurMagic.ServerMagicCode := 0;
fin := True;
end;
end;
if fin then
begin
Dispose(PTChrMsg(MsgList[n]));
MsgList.Delete(n);
end
else
Inc(n);
end;
end;
function TActor.IsIdle: Boolean;
var
p: PTChrMsg;
i:Integer;
begin
// for i:=0 to MsgList.Count-1 do
// p:=PTChrMsg(MsgList[i]);
if (CurrentAction = 0) and (MsgList.Count = 0) then
Result := True
else
Result := False;
end;
function TActor.ActionFinished: Boolean;
begin
if (CurrentAction = 0) or (currentframe >= endframe) then
Result := True
else
Result := False;
end;
function TActor.CanWalk: Integer;
begin
//掘绢 嘎篮 促澜俊 吧阑 荐 绝促. or 付过 掉贰捞
// if {(GetTickCount - LastStruckTime < 1300) or}(GetTickCount - LatestSpellTime < MagicPKDelayTime) then
// Result := -1 //掉饭捞
// else
Result := 1;
end;
function TActor.CanRun: Integer;
begin
//刮酶捞 冻绢脸芭唱, 眉仿捞 家葛登菌栏搁 钝 荐 绝澜..
//掘绢 嘎篮 促澜俊 官肺 钝 荐 绝澜..
Result := 1;
if Abil.Hp < RUN_MINHEALTH then
begin
Result := -1;
end;
{ else
if (GetTickCount - LastStruckTime < 3*1000) or (GetTickCount - LatestSpellTime < MagicPKDelayTime) then
Result := -2;
}
end;
function TActor.Strucked: Boolean;
var
i: Integer;
begin
Result := False;
for i := 0 to MsgList.Count - 1 do
begin
if PTChrMsg(MsgList[i]).ident = SM_STRUCK then
begin
Result := True;
Break;
end;
end;
end;
//dir : 规氢
//step : 捞悼 沫
//cur : 泅犁 胶跑
//max : 弥措 胶跑
procedure TActor.Shift(Dir, step, cur, Max: Integer);
var
unx, uny, ss, v: Integer;
begin
if Max=0 then Max:=1;
unx := UNITX * step;
uny := UNITY * step;
if cur > Max then
cur := Max;
rx := XX;
ry := YY;
ss := Round((Max - cur - 1) / Max) * step;
case Dir of
DR_UP:
begin
ss := Round((Max - cur) / Max) * step;
ShiftX := 0;
ry := YY + ss;
if ss = step then
ShiftY := -Round(uny / Max * cur)
else
ShiftY := Round(uny / Max * (Max - cur));
end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -