|
小火炬源码 2005传奇3台湾Delphi引擎代码
小火炬源码 2005传奇3台湾Delphi引擎代码 - //dis: 倔付唱 钢府 第肺..
- function GetBackPosition (cret: TCreature; var newx, newy: integer): Boolean;
- var
- penv: TEnvirnoment;
- begin
- penv := cret.PEnvir;
- newx := cret.CX;
- newy := cret.CY;
- case cret.Dir of
- DR_UP: if newy < penv.MapHeight-1 then newy := newy+1;
- DR_DOWN: if newy > 0 then newy := newy-1;
- DR_LEFT: if newx < penv.MapWidth-1 then newx := newx+1;
- DR_RIGHT: if newx > 0 then newx := newx-1;
- DR_UPLEFT:
- begin
- if (newx < penv.MapWidth-1) and (newy < penv.MapHeight-1) then begin
- newx := newx + 1;
- newy := newy + 1;
- end;
- end;
- DR_UPRIGHT:
- begin
- if (newx < penv.MapWidth-1) and (newy > 0) then begin
- newx := newx - 1;
- newy := newy + 1;
- end;
- end;
- DR_DOWNLEFT:
- begin
- if (newx > 0) and (newy < penv.MapHeight-1) then begin
- newx := newx + 1;
- newy := newy - 1;
- end;
- end;
- DR_DOWNRIGHT:
- begin
- if (newx > 0) and (newy > 0) then begin
- newx := newx - 1;
- newy := newy - 1;
- end;
- end;
- end;
- Result := TRUE;
- end;
- //dis: 倔付唱 钢府 第肺..
- function GetNextPosition (penv: TEnvirnoment; sx, sy, dir, dis: integer; var newx, newy: integer): Boolean;
- begin
- newx := sx;
- newy := sy;
- case dir of
- DR_UP: if newy > (dis-1) then newy := newy-dis;
- DR_DOWN: if newy < penv.MapHeight-dis then newy := newy+dis;
- DR_LEFT: if newx > (dis-1) then newx := newx-dis;
- DR_RIGHT: if newx < penv.MapWidth-dis then newx := newx+dis;
- DR_UPLEFT:
- begin
- if (newx > dis-1) and (newy > dis-1) then begin
- newx := newx - dis;
- newy := newy - dis;
- end;
- end;
- DR_UPRIGHT:
- begin
- if (newx > dis-1) and (newy < penv.MapHeight-dis) then begin
- newx := newx + dis;
- newy := newy - dis;
- end;
- end;
- DR_DOWNLEFT:
- begin
- if (newx < penv.MapWidth-dis) and (newy > dis-1) then begin
- newx := newx - dis;
- newy := newy + dis;
- end;
- end;
- DR_DOWNRIGHT:
- begin
- if (newx < penv.MapWidth-dis) and (newy < penv.MapHeight-dis) then begin
- newx := newx + dis;
- newy := newy + dis;
- end;
- end;
- end;
- if (sx = newx) and (sy = newy) then Result := FALSE
- else Result := TRUE;
- end;
- function GetNextDirection (sx, sy, dx, dy: Integer): byte;
- var
- flagx, flagy: integer;
- begin
- Result := DR_DOWN;
- if sx < dx then flagx := 1
- else if sx = dx then flagx := 0
- else flagx := -1;
- if abs(sy-dy) > 2
- then if (sx >= dx-1) and (sx <= dx+1) then flagx := 0;
- if sy < dy then flagy := 1
- else if sy = dy then flagy := 0
- else flagy := -1;
- if abs(sx-dx) > 2 then if (sy > dy-1) and (sy <= dy+1) then flagy := 0;
- if (flagx = 0) and (flagy = -1) then Result := DR_UP;
- if (flagx = 1) and (flagy = -1) then Result := DR_UPRIGHT;
- if (flagx = 1) and (flagy = 0) then Result := DR_RIGHT;
- if (flagx = 1) and (flagy = 1) then Result := DR_DOWNRIGHT;
- if (flagx = 0) and (flagy = 1) then Result := DR_DOWN;
- if (flagx = -1) and (flagy = 1) then Result := DR_DOWNLEFT;
- if (flagx = -1) and (flagy = 0) then Result := DR_LEFT;
- if (flagx = -1) and (flagy = -1) then Result := DR_UPLEFT;
- end;
- function GetHpMpRate (cret: TCreature): word;
- var
- hrate, srate: byte;
- begin
- if (cret.Abil.MaxHP <> 0) and (cret.Abil.MaxMP <> 0) then begin
- Result := MakeWord (Round (cret.Abil.HP / cret.Abil.MaxHP * 100),
- Round (cret.Abil.MP / cret.Abil.MaxMP * 100));
- end else begin
- if (cret.Abil.MaxHP = 0) then hrate := 0
- else hrate := Round (cret.Abil.HP / cret.Abil.MaxHP * 100);
- if (cret.Abil.MaxMP = 0) then srate := 0
- else srate := Round (cret.Abil.MP / cret.Abil.MaxMP * 100);
- Result := MakeWord (hrate, srate);
- end;
- end;
- function IsTakeOnAvailable (useindex: integer; pstd: PTStdItem): Boolean;
- begin
- Result := FALSE;
- if pstd = nil then exit;
- case useindex of
- U_DRESS:
- if pstd.StdMode in [10..11] then //巢磊 咯磊渴..
- Result := TRUE;
- U_WEAPON:
- if (pstd.StdMode = 5) or (pstd.StdMode = 6) then
- Result := TRUE;
- U_RIGHTHAND:
- if pstd.StdMode = 30 then begin //眯阂, 颇沸伐橇
- Result := TRUE;
- end;
- U_NECKLACE:
- if (pstd.StdMode = 19) or (pstd.StdMode = 20) or (pstd.StdMode = 21) then begin
- Result := TRUE;
- end;
- U_HELMET:
- if pstd.StdMode = 15 then begin
- Result := TRUE;
- end;
- U_RINGL,
- U_RINGR:
- if (pstd.StdMode = 22) or (pstd.StdMode = 23) then begin
- Result := TRUE;
- end;
- U_ARMRINGR: //迫骂父..
- if (pstd.StdMode = 24) or (pstd.StdMode = 26) then begin
- Result := TRUE;
- end;
- U_ARMRINGL: //迫骂, 何利/刀啊风..
- if (pstd.StdMode = 24) or (pstd.StdMode = 25) or (pstd.StdMode = 26) then begin
- Result := TRUE;
- end;
- // 2003/03/15 酒捞袍 牢亥配府 犬厘
- U_BUJUK:
- if (pstd.StdMode = 25) then begin
- Result := TRUE;
- end;
- U_BELT:
- if (pstd.StdMode = 54) then begin
- Result := TRUE;
- end;
- U_BOOTS:
- if (pstd.StdMode = 52) then begin
- Result := TRUE;
- end;
- U_CHARM:
- if (pstd.StdMode = 53) then begin
- Result := TRUE;
- end;
- end;
- end;
- function IsDCItem (uindex: integer): Boolean;
- var
- pstd: PTStdItem;
- begin
- pstd := UserEngine.GetStdItem (uindex);
- if pstd.StdMode in [5, 6, 10, 11, 15, 19, 20, 21, 22, 23, 24, 26,52,53,54] then
- Result := TRUE
- else
- Result := FALSE;
- end;
- function IsUpgradeWeaponStuff (uindex: integer): Boolean;
- var
- pstd: PTStdItem;
- begin
- pstd := UserEngine.GetStdItem (uindex);
- if pstd.StdMode in [19, 20, 21, 22, 23, 24, 26,52,53,54] then
- Result := TRUE
- else
- Result := FALSE;
- end;
- function GetMakeItemCondition (itemname: string): TStringList;
- var
- i: integer;
- begin
- Result := nil;
- for i:=0 to MakeItemList.Count-1 do begin
- if MakeItemList = itemname then begin
- Result := TStringList (MakeItemList.Objects);
- break;
- end;
- end;
- end;
- function GetTurnDir (dir, rotatecount: integer): byte;
- begin
- Result := (dir + rotatecount) mod 8;
- end;
- function IsCheapStuff (stdmode: integer): Boolean;
- begin
- if stdmode in [0..2] then Result := TRUE
- else Result := FALSE;
- end;
- end.
复制代码
分享名称:台湾引擎小火炬源码.zip
分享链接:http://pan.zxdll.cn:88/#s/9bcaSMHg
访问密码:
|
上一篇:传奇3官方1.45引擎源代码 - 小火炬源码下一篇:C3Mir3全套delphi代码+控件包 光通刺客4职业
|