|
楼主 |
发表于 2012-8-8 16:32
|
显示全部楼层
本帖最后由 ivansz 于 2012-8-8 16:35 编辑
回复 苍天泰坦 的帖子
- --判断合击
- local ZHEN_ID = -1
- local x0, y0 = WAR.Person[WAR.CurID]["坐标X"], WAR.Person[WAR.CurID]["坐标Y"]
- for i = 0, WAR.PersonNum - 1 do
- if WAR.Person[WAR.CurID]["我方"] == WAR.Person[i]["我方"] and i ~= WAR.CurID and WAR.Person[i]["死亡"] == false and WAR.SQFJ ~= 1 then
- local nx = WAR.Person[i]["坐标X"]
- local ny = WAR.Person[i]["坐标Y"]
- local fid = WAR.Person[i]["人物编号"]
- for j = 1, 10 do
- if JY.Person[fid]["武功" .. j] == wugong then
- if math.abs(nx-x0)+math.abs(ny-y0)<9 then
- local flagx, flagy = 0, 0
- if math.abs(nx - x0) <= 1 then
- flagx = 1
- end
- if math.abs(ny - y0) <= 1 then
- flagy = 1
- end
- if x0 == nx then
- flagy = 1
- end
- if y0 == ny then
- flagx = 1
- end
- if between(x, x0, nx, flagx) and between(y, y0, ny, flagy) then
- ZHEN_ID = i
- WAR.Person[i]["人方向"] = 3 - War_Direct(x0, y0, x, y)
- break;
- end
- end
- end
- end
- if ZHEN_ID >= 0 then
- break;
- end
- end
- end
复制代码
- --
- 这两段代码应该就是showfight里确认攻击范围的
- m1, m2, a1, a2, a3, a4, a5 = refw(wugong, level) --获取武功的范围
- movefanwei = {m1, m2} --可移动的范围
- atkfanwei = {a1, a2, a3, a4, a5} --攻击范围
-
- WarDrawAtt(x, y, atkfanwei, 3)
- if ZHEN_ID >= 0 then
- local tmp_id = WAR.CurID
- WAR.CurID = ZHEN_ID
- WarDrawAtt(WAR.Person[ZHEN_ID]["坐标X"] + x0 - x, WAR.Person[ZHEN_ID]["坐标Y"] + y0 - y, atkfanwei, 3)
- WAR.CurID = tmp_id
- end
复制代码
- --计算武功范围
- refw = function(wugong, level)
- local m1, m2, a1, a2, a3, a4, a5 = nil, nil, nil, nil, nil, nil, nil
- if JY.Wugong[wugong]["攻击范围"] == -1 then
- return JY.Wugong[wugong]["加内力1"], JY.Wugong[wugong]["加内力2"], JY.Wugong[wugong]["未知1"], JY.Wugong[wugong]["未知2"], JY.Wugong[wugong]["未知3"], JY.Wugong[wugong]["未知4"], JY.Wugong[wugong]["未知5"]
- end
- local fightscope = JY.Wugong[wugong]["攻击范围"]
- local kfkind = JY.Wugong[wugong]["武功类型"]
- local pid = WAR.Person[WAR.CurID]["人物编号"]
- if fightscope == 0 then
- if level > 10 then
- m1 = 1
- m2 = JY.Wugong[wugong]["移动范围" .. 10]
- a1 = 1
- a2 = 3
- a3 = 3
- else
- m1 = 0
- m2 = JY.Wugong[wugong]["移动范围" .. level]
- a1 = 1
- a2 = math.modf(level / 5)
- a3 = math.modf(level / 8)
- end
- elseif fightscope == 1 then
- if kfkind == 1 then
- a1 = 12
- if level > 10 then
- m1 = 3
- m2 = 1
- a2 = JY.Wugong[wugong]["移动范围" .. 10] - 1
- else
- m1 = 2
- m2 = 1
- a2 = JY.Wugong[wugong]["移动范围" .. level] - 1
- end
- elseif kfkind == 2 then
- a1 = 10
- if level > 10 then
- m1 = 3
- m2 = 1
- a2 = JY.Wugong[wugong]["移动范围" .. 10]
- a3 = a2 - 1
- a4 = a3 - 1
- else
- m1 = 2
- m2 = 1
- a2 = JY.Wugong[wugong]["移动范围" .. level]
- end
- if level > 7 then
- a3 = a2 - 1
- end
- elseif kfkind == 3 then
- a1 = 11
- if level > 10 then
- m1 = 3
- m2 = 1
- a2 = JY.Wugong[wugong]["移动范围" .. 10] - 1
- else
- m1 = 2
- m2 = 1
- a2 = JY.Wugong[wugong]["移动范围" .. level] - 1
- end
- elseif kfkind == 4 then
- m1 = 2
- if level > 10 then
- m2 = JY.Wugong[wugong]["移动范围" .. 10] - 1
- a1 = 7
- a2 = 1 + math.modf(level / 3)
- a3 = a2
- else
- m2 = JY.Wugong[wugong]["移动范围" .. level] - 1
- a1 = 1
- a2 = 1 + math.modf(level / 3)
- end
- end
- elseif fightscope == 2 then
- m1 = 0
- m2 = 0
- if kfkind == 3 then
- if level > 10 then
- a1 = 6
- a2 = JY.Wugong[wugong]["移动范围" .. 10]
- else
- a1 = 8
- a2 = JY.Wugong[wugong]["移动范围" .. level]
- end
- elseif level > 10 then
- if kfkind == 1 then
- a1 = 5
- a2 = JY.Wugong[wugong]["移动范围" .. 10] - 1
- a3 = a2 - 3
- elseif kfkind == 2 then
- a1 = 1
- a2 = JY.Wugong[wugong]["移动范围" .. 10] - 1
- a3 = a2
- else
- a1 = 2
- a2 = 1 + math.modf(JY.Wugong[wugong]["移动范围" .. 10] / 2)
- end
- else
- a1 = 1
- a2 = JY.Wugong[wugong]["移动范围" .. level]
- a3 = 0
- end
- elseif fightscope == 3 then
- m1 = 0
- a1 = 3
- if level > 10 then
- m2 = JY.Wugong[wugong]["移动范围" .. 10] + 1
- a2 = JY.Wugong[wugong]["杀伤范围" .. 10]
- a3 = a2
- else
- m2 = JY.Wugong[wugong]["移动范围" .. level]
- a2 = JY.Wugong[wugong]["杀伤范围" .. level]
- end
-
- end
- return m1, m2, a1, a2, a3, a4, a5
- end
复制代码 这个函数就是新的计算函数
你加到你的代码里试试
|
|