?? magiceff.pas
字號:
if abs(olddir-newdir) >= 2 then begin
Result := TRUE;
if ((olddir=0) and (newdir=15)) or ((olddir=15) and (newdir=0)) then
Result := FALSE;
end;
end;
var
i, rrx, rry, ms, stepx, stepy, newstepx, newstepy, nn: integer;
tax, tay, shx, shy, passdir16: integer;
crash: Boolean;
stepxf, stepyf: Real;
begin
Result := TRUE;
if Repetition then begin
if GetTickCount - steptime > longword(NextFrameTime) then begin
steptime := GetTickCount;
Inc (curframe);
if curframe > start+frame-1 then
curframe := start;
end;
end else begin
if (frame > 0) and (GetTickCount - steptime > longword(NextFrameTime)) then begin
steptime := GetTickCount;
Inc (curframe);
if curframe > start+frame-1 then begin
curframe := start+frame-1;
Result := FALSE;
end;
end;
end;
if (not FixedEffect) then begin
crash := FALSE;
if TargetActor <> nil then begin
ms := GetTickCount - frametime; //撈傈 瓤苞甫 弊赴饒 倔付唱 矯埃撈 汝范綽瘤?
frametime := GetTickCount;
//TargetX, TargetY 犁汲瀝
PlayScene.ScreenXYfromMCXY (TActor(TargetActor).RX,
TActor(TargetActor).RY,
TargetX,
TargetY);
shx := (Myself.RX*UNITX + Myself.ShiftX) - FireMyselfX;
shy := (Myself.RY*UNITY + Myself.ShiftY) - FireMyselfY;
TargetX := TargetX + shx;
TargetY := TargetY + shy;
//貨肺款 鷗百闌 諒釬甫 貨肺 汲瀝茄促.
if FlyX <> TargetX then tax := abs(TargetX-FlyX)
else tax := 1;
if FlyY <> TargetY then tay := abs(TargetY-FlyY)
else tay := 1;
if abs(FlyX-TargetX) > abs(FlyY-TargetY) then begin
newfiredisX := Round((TargetX-FlyX) * (500 / tax));
newfiredisY := Round((TargetY-FlyY) * (500 / tax));
end else begin
newfiredisX := Round((TargetX-FlyX) * (500 / tay));
newfiredisY := Round((TargetY-FlyY) * (500 / tay));
end;
if firedisX < newfiredisX then firedisX := firedisX + _MAX(1, (newfiredisX - firedisX) div 10);
if firedisX > newfiredisX then firedisX := firedisX - _MAX(1, (firedisX - newfiredisX) div 10);
if firedisY < newfiredisY then firedisY := firedisY + _MAX(1, (newfiredisY - firedisY) div 10);
if firedisY > newfiredisY then firedisY := firedisY - _MAX(1, (firedisY - newfiredisY) div 10);
stepxf := (firedisX/700) * ms;
stepyf := (firedisY/700) * ms;
FlyXf := FlyXf + stepxf;
FlyYf := FlyYf + stepyf;
FlyX := Round (FlyXf);
FlyY := Round (FlyYf);
//規氫 犁汲瀝
// Dir16 := GetFlyDirection16 (OldFlyX, OldFlyY, FlyX, FlyY);
OldFlyX := FlyX;
OldFlyY := FlyY;
//烹苞咯何甫 犬牢竅扁 困竅咯
passdir16 := GetFlyDirection16 (FlyX, FlyY, TargetX, TargetY);
//DebugOutStr (IntToStr(prevdisx) + ' ' + IntToStr(prevdisy) + ' / ' + IntToStr(abs(TargetX-FlyX)) + ' ' + IntToStr(abs(TargetY-FlyY)) + ' ' +
// IntToStr(firedisX) + '.' + IntToStr(firedisY) + ' ' +
// IntToStr(FlyX) + '.' + IntToStr(FlyY) + ' ' +
// IntToStr(TargetX) + '.' + IntToStr(TargetY));
if ((abs(TargetX-FlyX) <= 15) and (abs(TargetY-FlyY) <= 15)) or
((abs(TargetX-FlyX) >= prevdisx) and (abs(TargetY-FlyY) >= prevdisy)) or
OverThrough(OldDir16, passdir16) then begin
crash := TRUE;
end else begin
prevdisx := abs(TargetX-FlyX);
prevdisy := abs(TargetY-FlyY);
//if (prevdisx <= 5) and (prevdisy <= 5) then crash := TRUE;
end;
OldDir16 := passdir16;
end else begin
ms := GetTickCount - frametime; //瓤苞狼 矯累饒 倔付唱 矯埃撈 汝范綽瘤?
rrx := TargetX - fireX;
rry := TargetY - fireY;
stepx := Round ((firedisX/900) * ms);
stepy := Round ((firedisY/900) * ms);
FlyX := fireX + stepx;
FlyY := fireY + stepy;
end;
PlayScene.CXYfromMouseXY (FlyX, FlyY, Rx, Ry);
if crash and (TargetActor <> nil) then begin
FixedEffect := TRUE; //氣慣
start := 0;
frame := ExplosionFrame;
curframe := start;
Repetition := FALSE;
//磐瘤綽 葷款靛
PlaySound (TActor(MagOwner).magicexplosionsound);
end;
//if not Map.CanFly (Rx, Ry) then
// Result := FALSE;
end;
if FixedEffect then begin
if frame = -1 then frame := ExplosionFrame;
if TargetActor = nil then begin
FlyX := TargetX - ((Myself.RX*UNITX + Myself.ShiftX) - FireMyselfX);
FlyY := TargetY - ((Myself.RY*UNITY + Myself.ShiftY) - FireMyselfY);
PlayScene.CXYfromMouseXY (FlyX, FlyY, Rx, Ry);
end else begin
Rx := TActor(TargetActor).Rx;
Ry := TActor(TargetActor).Ry;
PlayScene.ScreenXYfromMCXY (Rx, Ry, FlyX, FlyY);
FlyX := FlyX + TActor(TargetActor).ShiftX;
FlyY := FlyY + TActor(TargetActor).ShiftY;
end;
end;
end;
procedure TMagicEff.GetFlyXY (ms: integer; var fx, fy: integer);
var
rrx, rry, stepx, stepy: integer;
begin
rrx := TargetX - fireX;
rry := TargetY - fireY;
stepx := Round ((firedisX/900) * ms);
stepy := Round ((firedisY/900) * ms);
fx := fireX + stepx;
fy := fireY + stepy;
end;
function TMagicEff.Run: Boolean;
begin
Result := Shift;
if Result then
if GetTickCount - starttime > 10000 then //2000 then
Result := FALSE
else Result := TRUE;
end;
procedure TMagicEff.DrawEff (surface: TDirectDrawSurface);
var
img: integer;
d: TDirectDrawSurface;
shx, shy: integer;
begin
if Active and ((Abs(FlyX-fireX) > 15) or (Abs(FlyY-fireY) > 15) or FixedEffect) then begin
shx := (Myself.RX*UNITX + Myself.ShiftX) - FireMyselfX;
shy := (Myself.RY*UNITY + Myself.ShiftY) - FireMyselfY;
if not FixedEffect then begin
//朝酒啊綽芭
img := EffectBase + FLYBASE + Dir16 * 10;
d := ImgLib.GetCachedImage (img + curframe, px, py);
if d <> nil then begin
DrawBlend (surface,
FlyX + px - UNITX div 2 - shx,
FlyY + py - UNITY div 2 - shy,
d, 1);
end;
end else begin
//磐瘤綽芭
img := MagExplosionBase + curframe; //EXPLOSIONBASE;
d := ImgLib.GetCachedImage (img, px, py);
if d <> nil then begin
DrawBlend (surface,
FlyX + px - UNITX div 2,
FlyY + py - UNITY div 2,
d, 1);
end;
end;
end;
end;
{------------------------------------------------------------}
// TFlyingAxe : 朝酒啊綽 檔嘗
{------------------------------------------------------------}
constructor TFlyingAxe.Create (id, effnum, sx, sy, tx, ty: integer; mtype: TMagicType; Recusion: Boolean; anitime: integer);
begin
inherited Create (id, effnum, sx, sy, tx, ty, mtype, Recusion, anitime);
FlyImageBase := FLYOMAAXEBASE;
ReadyFrame := 65;
end;
procedure TFlyingAxe.DrawEff (surface: TDirectDrawSurface);
var
img: integer;
d: TDirectDrawSurface;
shx, shy: integer;
begin
if Active and ((Abs(FlyX-fireX) > ReadyFrame) or (Abs(FlyY-fireY) > ReadyFrame)) then begin
shx := (Myself.RX*UNITX + Myself.ShiftX) - FireMyselfX;
shy := (Myself.RY*UNITY + Myself.ShiftY) - FireMyselfY;
if not FixedEffect then begin
//朝酒啊綽芭
img := FlyImageBase + Dir16 * 10;
d := ImgLib.GetCachedImage (img + curframe, px, py);
if d <> nil then begin
//舅頗喉琺爹竅瘤 臼瀾
surface.Draw (FlyX + px - UNITX div 2 - shx,
FlyY + py - UNITY div 2 - shy,
d.ClientRect, d, TRUE);
end;
end else begin
{//瀝瘤, 檔嘗俊 嘛腮 葛嚼.
img := FlyImageBase + Dir16 * 10;
d := ImgLib.GetCachedImage (img, px, py);
if d <> nil then begin
//舅頗喉琺爹竅瘤 臼瀾
surface.Draw (FlyX + px - UNITX div 2,
FlyY + py - UNITY div 2,
d.ClientRect, d, TRUE);
end; }
end;
end;
end;
{------------------------------------------------------------}
// TFlyingArrow : 朝酒啊綽 拳混
{------------------------------------------------------------}
procedure TFlyingArrow.DrawEff (surface: TDirectDrawSurface);
var
img: integer;
d: TDirectDrawSurface;
shx, shy: integer;
begin
//(**6巋菩摹
if Active and ((Abs(FlyX-fireX) > 40) or (Abs(FlyY-fireY) > 40)) then begin
//*)
(**撈傈
if Active then begin //and ((Abs(FlyX-fireX) > 65) or (Abs(FlyY-fireY) > 65)) then begin
//*)
shx := (Myself.RX*UNITX + Myself.ShiftX) - FireMyselfX;
shy := (Myself.RY*UNITY + Myself.ShiftY) - FireMyselfY;
if not FixedEffect then begin
//朝酒啊綽芭
img := FlyImageBase + Dir16; // * 10;
d := ImgLib.GetCachedImage (img + curframe, px, py);
//(**6巋菩摹
if d <> nil then begin
//舅頗喉琺爹竅瘤 臼瀾
surface.Draw (FlyX + px - UNITX div 2 - shx,
FlyY + py - UNITY div 2 - shy - 46,
d.ClientRect, d, TRUE);
end;
//**)
(***撈傈
if d <> nil then begin
//舅頗喉琺爹竅瘤 臼瀾
surface.Draw (FlyX + px - UNITX div 2 - shx,
FlyY + py - UNITY div 2 - shy,
d.ClientRect, d, TRUE);
end;
//**)
end;
end;
end;
{--------------------------------------------------------}
constructor TCharEffect.Create (effbase, effframe: integer; target: TObject);
begin
inherited Create (111, effbase,
TActor(target).XX, TActor(target).YY,
TActor(target).XX, TActor(target).YY,
mtExplosion,
FALSE,
0);
TargetActor := target;
frame := effframe;
NextFrameTime := 30;
end;
function TCharEffect.Run: Boolean;
begin
Result := TRUE;
if GetTickCount - steptime > longword(NextFrameTime) then begin
steptime := GetTickCount;
Inc (curframe);
if curframe > start+frame-1 then begin
curframe := start+frame-1;
Result := FALSE;
end;
end;
end;
procedure TCharEffect.DrawEff (surface: TDirectDrawSurface);
var
d: TDirectDrawSurface;
begin
if TargetActor <> nil then begin
Rx := TActor(TargetActor).Rx;
Ry := TActor(TargetActor).Ry;
PlayScene.ScreenXYfromMCXY (Rx, Ry, FlyX, FlyY);
FlyX := FlyX + TActor(TargetActor).ShiftX;
FlyY := FlyY + TActor(TargetActor).ShiftY;
d := ImgLib.GetCachedImage (EffectBase + curframe, px, py);
if d <> nil then begin
DrawBlend (surface,
FlyX + px - UNITX div 2,
FlyY + py - UNITY div 2,
d, 1);
end;
end;
end;
{--------------------------------------------------------}
constructor TMapEffect.Create (effbase, effframe: integer; x, y: integer);
begin
inherited Create (111, effbase,
x, y,
x, y,
mtExplosion,
FALSE,
0);
TargetActor := nil;
frame := effframe;
NextFrameTime := 30;
RepeatCount := 0;
end;
function TMapEffect.Run: Boolean;
begin
Result := TRUE;
if GetTickCount - steptime > longword(NextFrameTime) then begin
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -