📄 magiceff.pas
字号:
if mag >= 5 then wimg := g_WMagic2Images;
end;
end;
end;
constructor TMagicEff.Create (id, effnum, sx, sy, tx, ty: integer; mtype: TMagicType; Recusion: Boolean; anitime: integer);
var
tax, tay: integer;
begin
ImgLib := g_WMagicImages; //扁夯
case mtype of
mtFly,mtBujaukGroundEffect,mtExploBujauk: begin
start:=0;
frame:=6;
curframe:=start;
FixedEffect:=False;
Repetition:=Recusion;
ExplosionFrame:=10;
if id = 38 then frame:=10;
if id = 39 then begin
frame:=4;
ExplosionFrame:=8;
end;
if (id - 81 - 3) < 0 then begin
bt80:=1;
Repetition:=True;
if id = 81 then begin
if g_MySelf.m_nCurrX >= 84 then begin
EffectBase:=130;
end else begin
EffectBase:=140;
end;
bt81:=1;
end;
if id = 82 then begin
if (g_MySelf.m_nCurrX >= 78) and (g_MySelf.m_nCurrY >= 48) then begin
EffectBase:=150;
end else begin
EffectBase:=160;
end;
bt81:=2;
end;
if id = 83 then begin
EffectBase:=180;
bt81:=3;
end;
start:=0;
frame:=10;
MagExplosionBase:=190;
ExplosionFrame:=10;
end;
end;
mt12: begin
start:=0;
frame:=6;
curframe:=start;
FixedEffect:=False;
Repetition:=Recusion;
ExplosionFrame:=1;
end;
mt13: begin
start:=0;
frame:=20;
curframe:=start;
FixedEffect:=True;
Repetition:=False;
ExplosionFrame:=20;
ImgLib:=FrmMain.WMon21Img;
end;
mtExplosion,mtThunder,mtLightingThunder: begin
start := 0;
frame := -1;
ExplosionFrame := 10;
curframe := start;
FixedEffect := TRUE;
Repetition := FALSE;
if id = 80 then begin
bt80:=2;
case Random(6) of
0:begin
EffectBase:=230;
end;
1:begin
EffectBase:=240;
end;
2:begin
EffectBase:=250;
end;
3:begin
EffectBase:=230;
end;
4:begin
EffectBase:=240;
end;
5:begin
EffectBase:=250;
end;
end;
Light:=4;
ExplosionFrame:=5;
end;
if id = 70 then begin
bt80:=3;
case Random(3) of
0:begin
EffectBase:=400;
end;
1:begin
EffectBase:=410;
end;
2:begin
EffectBase:=420;
end;
end;
Light:=4;
ExplosionFrame:=5;
end;
if id = 71 then begin
bt80:=3;
ExplosionFrame:=20;
end;
if id = 72 then begin
bt80:=3;
Light:=3;
ExplosionFrame:=10;
end;
if id = 73 then begin
bt80:=3;
Light:=5;
ExplosionFrame:=20;
end;
if id = 74 then begin
bt80:=3;
Light:=4;
ExplosionFrame:=35;
end;
if id = 90 then begin
EffectBase:=350;
MagExplosionBase:=350;
ExplosionFrame:=30;
end;
end;
mt14: begin
start:=0;
frame:=-1;
curframe:=start;
FixedEffect:=True;
Repetition:=False;
ImgLib:=g_WMagic2Images;
end;
mtFlyAxe: begin
start := 0;
frame := 3;
curframe := start;
FixedEffect := FALSE;
Repetition := Recusion;
ExplosionFrame := 3;
end;
mtFlyArrow: begin
start := 0;
frame := 1;
curframe := start;
FixedEffect := FALSE;
Repetition := Recusion;
ExplosionFrame := 1;
end;
mt15: begin
start := 0;
frame := 6;
curframe := start;
FixedEffect := FALSE;
Repetition := Recusion;
ExplosionFrame := 2;
end;
mt16: begin
start := 0;
frame := 1;
curframe := start;
FixedEffect := FALSE;
Repetition := Recusion;
ExplosionFrame := 1;
end;
end;
n7C:=0;
{
case mtype of
mtReady:
begin
end;
mtFly, ;
mtBujaukGroundEffect,
mtExploBujauk:
begin
start := 0;
frame := 6;
curframe := start;
FixedEffect := FALSE;
Repetition := Recusion;
ExplosionFrame := 10;
end;
mtExplosion,
mtThunder,
mtLightingThunder:
begin
start := 0;
frame := -1;
ExplosionFrame := 10;
curframe := start;
FixedEffect := TRUE;
Repetition := FALSE;
end;
mtFlyAxe:
begin
start := 0;
frame := 3;
curframe := start;
FixedEffect := FALSE;
Repetition := Recusion;
ExplosionFrame := 3;
end;
mtFlyArrow:
begin
start := 0;
frame := 1;
curframe := start;
FixedEffect := FALSE;
Repetition := Recusion;
ExplosionFrame := 1;
end;
end;
}
ServerMagicId := id; //辑滚狼 ID
EffectBase := effnum; //MagicDB - Effect
TargetX := tx; // " target x
TargetY := ty; // " target y
if bt80 =1 then begin
if id = 81 then begin
dec(sx,14);
inc(sy,20);
end;
if id = 81 then begin
dec(sx,70);
dec(sy,10);
end;
if id = 83 then begin
dec(sx,60);
dec(sy,70);
end;
PlaySound(8208);
end;
fireX := sx; //
fireY := sy; //
FlyX := sx; //
FlyY := sy;
OldFlyX := sx;
OldFlyY := sy;
FlyXf := sx;
FlyYf := sy;
FireMyselfX := g_MySelf.m_nRx * UNITX + g_MySelf.m_nShiftX;
FireMyselfY := g_MySelf.m_nRy * UNITY + g_MySelf.m_nShiftY;
if bt80 = 0 then begin
MagExplosionBase := EffectBase + EXPLOSIONBASE;
end;
light := 1;
if fireX <> TargetX then tax := abs(TargetX-fireX)
else tax := 1;
if fireY <> TargetY then tay := abs(TargetY-fireY)
else tay := 1;
if abs(fireX-TargetX) > abs(fireY-TargetY) then begin
firedisX := Round((TargetX-fireX) * (500 / tax));
firedisY := Round((TargetY-fireY) * (500 / tax));
end else begin
firedisX := Round((TargetX-fireX) * (500 / tay));
firedisY := Round((TargetY-fireY) * (500 / tay));
end;
NextFrameTime := 50;
m_dwFrameTime := GetTickCount;
m_dwStartTime := GetTickCount;
steptime := GetTickCount;
RepeatTime := anitime;
Dir16 := GetFlyDirection16 (sx, sy, tx, ty);
OldDir16 := Dir16;
NextEffect := nil;
m_boActive := TRUE;
prevdisx := 99999;
prevdisy := 99999;
end;
destructor TMagicEff.Destroy;
begin
inherited Destroy;
end;
function TMagicEff.Shift: Boolean;
function OverThrough (olddir, newdir: integer): Boolean;
begin
Result := FALSE;
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 - m_dwFrameTime; //捞傈 瓤苞甫 弊赴饶 倔付唱 矫埃捞 汝范绰瘤?
m_dwFrameTime := GetTickCount;
//TargetX, TargetY 犁汲沥
PlayScene.ScreenXYfromMCXY (TActor(TargetActor).m_nRx,
TActor(TargetActor).m_nRy,
TargetX,
TargetY);
shx := (g_MySelf.m_nRx * UNITX + g_MySelf.m_nShiftX) - FireMyselfX;
shy := (g_MySelf.m_nRy * UNITY + g_MySelf.m_nShiftY) - 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;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -