|
沙发
楼主 |
发表于 2012-4-21 00:45:02
|
只看该作者
以下是我一位朋友修改的版本,增加了可擴充性的同時也盡可能保持源碼的易讀性:- procedure start;
- #include "sfall.h"
- #include "DEFINE.H"
- #define reload_with(PID) ((type == hit_left_weapon_reload) or (type == hit_right_weapon_reload)) and ((obj_pid(critter_inven_obj(critter, INVEN_TYPE_RIGHT_HAND)) == PID) or (obj_pid(critter_inven_obj(critter, INVEN_TYPE_LEFT_HAND)) == PID))
- procedure start begin
- variable critter, type, aimed, i;
- if not init_hook then begin
- critter:=get_sfall_arg;
- type:=get_sfall_arg;
- aimed:=get_sfall_arg;
- i:=-1;
- if (type == ATKTYPE_PALMSTRIKE) or (type == ATKTYPE_PIERCINGSTRIKE) or (type == ATKTYPE_JAB) then begin
- i:=4 - (has_trait(TRAIT_PERK, dude_obj, PERK_bonus_hth_attacks) > 0);
- end
- if (type == ATKTYPE_HIPKICK) or (type == ATKTYPE_HOOKKICK) or (type == ATKTYPE_PIERCINGKICK) then begin
- i:=5 - (has_trait(TRAIT_PERK, dude_obj, PERK_bonus_hth_attacks) > 0);
- end
- if reload_with(PID_44_MAGNUM_REVOLVER) then begin
- i:=3;
- end
- if reload_with(PID_ASSAULT_RIFLE) then begin
- i:=1;
- end
- if reload_with(PID_BOZAR) then begin
- i:=4;
- end
- if i != -1 then begin
- if aimed then i++;
- set_sfall_return(i);
- end
- end
- end
复制代码 這個例子是除了普通版.44左輪之外,還加上了突擊步槍與Bozar的判斷,以此類推你可以很容易把多種武器設定它們各自的裝填AP。 |
|