技能模块第一版

来源:互联网 发布:网络快车的新政策 编辑:程序博客网 时间:2024/05/16 06:01
--[[ file name : 技能模块第一版 author  :  Clark/陈泽丹 created :  2012-11-07 purpose : --]]module("系统接口", package.seeall)--获得有效值function get_valid_t( _t )local t = {}local len = table.getn(_t)for i=1, len doif nil ~= _t[i] thent[ table.getn(t) + 1] = _t[i]endendreturn tend--索引管理function new_index_manager()local t_index = {}local public = {}--创建索引function public.create_index()for i=1, 9999999 doif nil == t_index[i] thent_index[i] = 1return iendendmyPrint("索引资源用尽", 1)return nilend--索引是否有效function public.is_valid_index( _index )if nil ~= t_index[_index] thenreturn trueendreturn falseend--删除索引function public.delete_index( _index )t_index[_index] = nilendreturn publicend--1:N绑定器function new_map_for_1_and_N()local left_set = {}local right_set = {}local public = {}--绑定索引和UID( 1:N )function public.bind_left_and_right( _left, _right )if nil == left_set[_left] thenleft_set[_left] = {}endlocal len = table.getn(left_set[_left])for i=1, len doif left_set[_left][i] == _right thenreturnendendleft_set[_left][table.getn(left_set[_left])+1] = _rightright_set[_right] = _leftend--清除绑定function public.clear_left_and_right( _left )local t_right = public.get_t_map_by_fb_buf_index( _left )local len = table.getn( t_right )for i=1, len doright_set[ t_right[i] ] = nilendleft_set[_left] = nilend--清除绑定function public.clear_right( _left, _right )right_set[_right] = nillocal t_right = left_set[_left]local len = table.getn( t_right )for i=1, len doif t_right[i] == _right thent_right[i] = nilendendend--通过left获得rigth表function public.get_t_right_by_left( _left )return get_valid_t( left_set[_left] )end--通过right获得leftfunction public.get_left_by_right( _right )return right_set[ _right ]endreturn publicend--buf绑定器(用于把类的实现内容弱耦合的分拆成多个模块独立完成)function new_map_for_index_to_buf( _sign )local index_set = {}local public = {}--获得绑定者标识function public.get_sign()return _signend--绑定buffunction public.bind_index_to_buf( _index, _buf )index_set[ _index ] = _bufend--清除绑定function public.clear_index_to_buf( _index )index_set[_index] = nilend--通过left获得rigth表function public.get_buf( _index )return index_set[ _index ]endreturn publicend--常用绑定者g_type_binder = new_map_for_index_to_buf( "type" )function new_binder(_uid, _buf_type_binder, _buf_obj)--绑定操作类型g_type_binder.bind_index_to_buf(_uid, _buf_type_binder.get_uid() )--绑定操作对象_buf_type_binder.bind_index_to_buf(_uid, _buf_obj)return _uidendfunction find_t_buf_by_type( _container, _index, _buf_type )local t_right = _container.get_t_right_by_left( _index )local ret = {}local len = table.getn( t_right )for i=1, len doif g_type_binder.get_buf( t_right[i] ) == _buf_type thenret[ table.getn(ret) + 1] = t_right[i]endendreturn retend--table转字符串function sz_T2S(_table)local szLua = ""local t = type(_table)if t == "number" thenszLua = szLua .. _tableelseif t == "boolean" thenszLua = szLua .. tostring(_table)elseif t == "string" thenszLua = szLua .. string.format("%q", _table)elseif t == "table" thenszLua = szLua .. "{"for k, v in pairs(_table) doszLua = szLua .. "[" .. sz_T2S(k) .. "]=" .. sz_T2S(v) .. ","endlocal metatable = getmetatable(_table)if metatable ~= nil and type(metatable.__index) == "table" thenfor k, v in pairs(metatable.__index) doszLua = szLua .. "[" .. sz_T2S(k) .. "]=" .. sz_T2S(v) .. ","endendszLua = szLua .. "}"elseif t == "nil" thenreturn {}endreturn szLuaend--提供绑定数据的函数function clk_bind_data( t_par )local function do_clk_bind_data()if nil == t_par thenreturn nilendlocal len = table.getn( t_par )if 0 == len thenreturn nilelseif 1 == len thenreturn t_par[1]elseif 2 == len thenreturn t_par[1], t_par[2]elseif 3 == len thenreturn t_par[1], t_par[2], t_par[3]elseif 4 == len thenreturn t_par[1], t_par[2], t_par[3], t_par[4]elseif 5 == len thenreturn t_par[1], t_par[2], t_par[3], t_par[4], t_par[5]elseif 6 == len thenreturn t_par[1], t_par[2], t_par[3], t_par[4], t_par[5], t_par[6]elseif 7 == len thenreturn t_par[1], t_par[2], t_par[3], t_par[4], t_par[5], t_par[6], t_par[7]elseif 8 == len thenreturn t_par[1], t_par[2], t_par[3], t_par[4], t_par[5], t_par[6], t_par[7], t_par[8]elseif 9 == len thenreturn t_par[1], t_par[2], t_par[3], t_par[4], t_par[5], t_par[6], t_par[7], t_par[8], t_par[9]elseif 10 == len thenreturn t_par[1], t_par[2], t_par[3], t_par[4], t_par[5], t_par[6], t_par[7], t_par[8], t_par[9], t_par[10]elseif 11 == len thenreturn t_par[1], t_par[2], t_par[3], t_par[4], t_par[5], t_par[6], t_par[7], t_par[8], t_par[9], t_par[10], t_par[11]elseif 12 == len thenreturn t_par[1], t_par[2], t_par[3], t_par[4], t_par[5], t_par[6], t_par[7], t_par[8], t_par[9], t_par[10], t_par[11], t_par[12]elseif 13 == len thenreturn t_par[1], t_par[2], t_par[3], t_par[4], t_par[5], t_par[6], t_par[7], t_par[8], t_par[9], t_par[10], t_par[11], t_par[12], t_par[13]elsemyPrint("clk_bind_data",1)--------------------------------------------------------return nilendendreturn do_clk_bind_dataend--提供绑定函数和相关参数的function clk_bind_fun_data( _fun, t_par )local function do_clk_bind_fun_data()if nil == _fun thenmyPrint("clk_bind_fun_data fun is nil", 1)return trueendif nil == t_par thenreturn _fun()endlocal len = table.getn( t_par )if 0 == len thenreturn _fun()elseif 1 == len thenreturn _fun(t_par[1])elseif 2 == len thenreturn _fun(t_par[1], t_par[2])elseif 3 == len thenreturn _fun(t_par[1], t_par[2], t_par[3])elseif 4 == len thenreturn _fun(t_par[1], t_par[2], t_par[3], t_par[4])elseif 5 == len thenreturn _fun(t_par[1], t_par[2], t_par[3], t_par[4], t_par[5])elseif 6 == len thenreturn _fun(t_par[1], t_par[2], t_par[3], t_par[4], t_par[5], t_par[6])elseif 7 == len thenreturn _fun(t_par[1], t_par[2], t_par[3], t_par[4], t_par[5], t_par[6], t_par[7])elseif 8 == len thenreturn _fun(t_par[1], t_par[2], t_par[3], t_par[4], t_par[5], t_par[6], t_par[7], t_par[8])elseif 9 == len thenreturn _fun(t_par[1], t_par[2], t_par[3], t_par[4], t_par[5], t_par[6], t_par[7], t_par[8], t_par[9])elseif 10 == len thenreturn _fun(t_par[1], t_par[2], t_par[3], t_par[4], t_par[5], t_par[6], t_par[7], t_par[8], t_par[9], t_par[10])elseif 11 == len thenreturn _fun(t_par[1], t_par[2], t_par[3], t_par[4], t_par[5], t_par[6], t_par[7], t_par[8], t_par[9], t_par[10], t_par[11])elseif 12 == len thenreturn _fun(t_par[1], t_par[2], t_par[3], t_par[4], t_par[5], t_par[6], t_par[7], t_par[8], t_par[9], t_par[10], t_par[11], t_par[12])elseif 13 == len thenreturn _fun(t_par[1], t_par[2], t_par[3], t_par[4], t_par[5], t_par[6], t_par[7], t_par[8], t_par[9], t_par[10], t_par[11], t_par[12], t_par[13])elsemyPrint("clk_bind_fun_data实现",1)--------------------------------------------------------return trueendendreturn do_clk_bind_fun_dataend


 

--[[ file name : 技能模块第一版 author  :  Clark/陈泽丹 created :  2012-11-07 purpose : --]]module("事件机", package.seeall)--查找obj位置function find_obj_pos(_t, _p)local len = table.getn( _t )for i=1, len doif _t[i] == _p thenreturn iendendreturn nilend--否决事件监听function new_vote_evt_listener()local public = {}function public.on_vote( _t_evt )myPrint("未实现 new_vote_evt_listener", 1)return falseendreturn publicend--执行消息监听function new_action_evt_listener()local public = {}function public.on_action( _t_evt )myPrint("未实现 new_action_evt_listener", 1)endreturn publicend--完毕消息监听function new_response_evt_listener()local public = {}function public.on_response( _t_evt )myPrint("未实现 new_response_evt_listener", 1)endreturn publicend--消息处理机function new_evt_server()local function new_event_map()local this_public = {}this_public.map = {}function this_public.add_listener(_evt_iid, _p_recv)if nil == this_public.map[_evt_iid] thenthis_public.map[_evt_iid] = {}endlocal t = this_public.map[_evt_iid]if nil == find_obj_pos(t, _p_recv) thent[ table.getn(t) + 1 ] = _p_recvendendfunction this_public.remove_listener(_evt_iid, _p_recv)if nil ~= this_public.map[_evt_iid] thenlocal t = this_public.map[_evt_iid]local id = find_obj_pos(t, _p_recv)if nil ~= id thenlocal len = table.getn(t)t[id] = t[len]t[len] = nilendif table.getn(t) <= 0 thenthis_public.map[_evt_iid] = nilendendendfunction this_public.clear()this_public.map = {}endreturn this_publicendlocal public = {}public.vote_map = new_event_map()public.action_map = new_event_map()public.response_map = new_event_map()function public.clear()public.vote_map.clear()public.action_map.clear()public.response_map.clear()endfunction public.dispatch_evt( _evt_iid, _t_evt )--记录当前服,用于回复消息_t_evt.from_evt_svr = public--否决if nil ~= public.vote_map.map[ _evt_iid ] thenlocal t = public.vote_map.map[ _evt_iid ]local len = table.getn( t )for i=1, len doif t[i].on_vote( _t_evt ) thenreturnendendend--触发if nil ~= public.action_map.map[ _evt_iid ] thenlocal t = public.action_map.map[ _evt_iid ]local len = table.getn( t )for i=1, len dot[i].on_action( _t_evt )endend--完毕if nil ~= public.response_map.map[ _evt_iid ] thenlocal t = public.response_map.map[ _evt_iid ]local len = table.getn( t )for i=1, len dot[i].on_response( _t_evt )endendendreturn publicend


 

--[[ file name : 技能模块第一版 author  :  Clark/陈泽丹 created :  2012-11-07 purpose : --]]module("角色数据", package.seeall)PACK_GameAPI = require"系统接口"function new_skill( _iid, _uid, _skill_lvl, _x, _y )local public ={iid = _iid,--IIDuid = _uid,--UIDskill_lvl = _skill_lvl,--技能等级}return publicendg_skill_binder = PACK_GameAPI.new_map_for_index_to_buf("skill")--玩家实体function new_role( _iid, _uid, _x, _y )local public ={iid = _iid,--IIDuid = _uid,--UIDlife_max = 100,--最大生命值life_cur = 100,--当前生命值is_dizzy = false,--眩晕状态dodge_pro = 20,--闪避率ATK= 50,--攻击力DFD= 10,--防守力pos_x = _x,--坐标xpos_y = _y,--坐标ySTATE_SIGN = {},--状态标示}return publicendg_role_binder = PACK_GameAPI.new_map_for_index_to_buf("role")


 

--[[ file name : 技能模块第一版 author  :  Clark/陈泽丹 created :  2012-11-07 purpose : --]]module("技能定义", package.seeall)PACK_ROLE_DATA = require"角色数据"--技能声明G_User_Skill_define = {}G_User_Skill_define["普通攻击"] = "普通攻击"G_User_Skill_define["魔法箭"] = "魔法箭"G_User_Skill_define["命令光环"] = "命令光环"G_User_Skill_define["恐怖"] = "恐怖"G_User_Skill_define["移形换位"] = "移形换位"--常用辅助参数生成器function fun_get_lvl_val( _lvl1_val, _lvl2_val, _lvl3_val, _lvl4_val )local function do_fun_get_lvl_val( _skill_entity )local buf = PACK_ROLE_DATA.g_skill_binder.get_buf( _skill_entity.skill_uid )if 1 == buf.skill_lvl thenreturn _lvl1_valelseif 2 == buf.skill_lvl thenreturn _lvl2_valelseif 3 == buf.skill_lvl thenreturn _lvl3_valelseif 4 == buf.skill_lvl thenreturn _lvl4_valendreturn 0endreturn do_fun_get_lvl_valend


 

--[[ file name : 技能模块第一版 author  :  Clark/陈泽丹 created :  2012-11-07 purpose : --]]module("技能", package.seeall)PACK_EvtSvr = require"事件机"PACK_GameAPI = require"系统接口"PACK_ROLE_DATA = require"角色数据"PACK_Skill_Define = require"技能定义"--距离触发器function new_distance_tgr(_from_role_uid, _to_role_uid, _distance, _is_hit, _fun_callback)local is_hit = truelocal from_buf = PACK_ROLE_DATA.g_role_binder.get_buf( _from_role_uid )if nil == from_buf thenis_hit = falseendlocal to_buf = PACK_ROLE_DATA.g_role_binder.get_buf( _to_role_uid )if nil == to_buf thenis_hit = falseendlocal dx = (from_buf.pos_x - to_buf.pos_x) * (from_buf.pos_x - to_buf.pos_x)local dy = (from_buf.pos_y - to_buf.pos_y) * (from_buf.pos_y - to_buf.pos_y)if dx + dy > _distance*_distance thenis_hit = falseendif is_hit == _is_hit then_fun_callback(_from_role_uid, _to_role_uid)print("删除触发器")endend--技能服skill_svr = PACK_EvtSvr.new_evt_server()--技能实体function new_skill_entity( _skill_uid, _from_role_uid, _to_t_role_uid )local public = { skill_uid = _skill_uid, from_role_uid = _from_role_uid, to_t_role_uid = _to_t_role_uid }return publicend--执行function do_module( _evt_iid )local public = PACK_EvtSvr.new_action_evt_listener()function public.on_action( _skill_entity )print("执行指令[" .. _evt_iid .. "]" )return trueendskill_svr.action_map.add_listener(_evt_iid, public)return publicend--是否闪避function is_dest_dodge_module( _evt_iid )local public = PACK_EvtSvr.new_vote_evt_listener()function public.on_vote( _skill_entity )local buf = PACK_ROLE_DATA.g_role_binder.get_buf( _skill_entity.to_t_role_uid )local pro = math.random(1,100)if pro <= buf.dodge_pro thenprint("实体[" .. _skill_entity.to_t_role_uid .. "]闪避" )return trueendreturn falseendskill_svr.vote_map.add_listener(_evt_iid, public)return publicend--执行眩晕function do_dest_dizzy_module( _evt_iid, _fun_get_dizzy_time )local public = PACK_EvtSvr.new_action_evt_listener()function public.on_action( _skill_entity )local buf = PACK_ROLE_DATA.g_role_binder.get_buf( _skill_entity.to_t_role_uid )buf.is_dizzy = true--这里会用单例模式开启一个倒时间以关掉眩晕,同时实际晕的时间会取调用时间参数的并集。--不然先打一个4S的晕,再打一个1.5s的晕,结果只算晕1.5s,那是好奇怪的--计时器暂时先不实现print("实体[" .. _skill_entity.to_t_role_uid .. "]眩晕" .. _fun_get_dizzy_time( _skill_entity ) .. "s" )return trueendskill_svr.action_map.add_listener(_evt_iid, public)return publicend--执行伤害function do_dest_hurt_module( _evt_iid, _fun_get_hurt_val )local public = PACK_EvtSvr.new_action_evt_listener()function public.on_action( _skill_entity )local buf = PACK_ROLE_DATA.g_role_binder.get_buf( _skill_entity.to_t_role_uid )local val =  _fun_get_hurt_val( _skill_entity )print("实体[" .. _skill_entity.to_t_role_uid .. "]受伤" .. val )buf.life_cur = buf.life_cur - _fun_get_hurt_val( _skill_entity )if buf.life_cur < 0 thenbuf.life_cur = 0endendskill_svr.action_map.add_listener(_evt_iid, public)return publicend--攻击力加成function do_dest_ATK_module( _evt_iid, _fun_get_ATK_val, _distance )--增加攻击力local function fun_add_ATK_by_times(_skill_entity, _val)local role_buf = PACK_ROLE_DATA.g_role_binder.get_buf( _skill_entity.to_t_role_uid )role_buf.ATK = role_buf.ATK + _valend--减少攻击力local function fun_del_ATK_by_times(_skill_entity, _val)local role_buf = PACK_ROLE_DATA.g_role_binder.get_buf( _skill_entity.to_t_role_uid )role_buf.ATK = role_buf.ATK - _valendlocal public = PACK_EvtSvr.new_action_evt_listener()function public.on_action( _skill_entity )local buf = PACK_ROLE_DATA.g_role_binder.get_buf( _skill_entity.to_t_role_uid )local val =  buf.ATK*_fun_get_ATK_val( _skill_entity )print("实体[" .. _skill_entity.to_t_role_uid .. "]攻击加成" .. val )fun_add_ATK_by_times(_skill_entity, val)new_distance_tgr(_skill_entity.from_role_uid, _skill_entity.to_t_role_uid, _distance, false,PACK_GameAPI.clk_bind_fun_data(fun_del_ATK_by_times, {_skill_entity, val}))endskill_svr.action_map.add_listener(_evt_iid, public)return publicend--攻击力加成function do_dest_ATK_limit_time_module( _evt_iid, _fun_get_ATK_val, _time )--增加攻击力local function fun_add_ATK_by_times(_skill_entity, _val)local role_buf = PACK_ROLE_DATA.g_role_binder.get_buf( _skill_entity.to_t_role_uid )role_buf.ATK = role_buf.ATK + _valend--减少攻击力local function fun_del_ATK_by_times(_skill_entity, _val)local role_buf = PACK_ROLE_DATA.g_role_binder.get_buf( _skill_entity.to_t_role_uid )role_buf.ATK = role_buf.ATK - _valendlocal public = PACK_EvtSvr.new_action_evt_listener()function public.on_action( _skill_entity )local buf = PACK_ROLE_DATA.g_role_binder.get_buf( _skill_entity.to_t_role_uid )local val =  buf.ATK*_fun_get_ATK_val( _skill_entity )print("实体[" .. _skill_entity.to_t_role_uid .. "]攻击加成" .. val )fun_add_ATK_by_times(_skill_entity, val)--计时器暂时先不实现endskill_svr.action_map.add_listener(_evt_iid, public)return publicend--防守力加成function do_dest_DFD_limit_time_module( _evt_iid, _fun_get_DFD_val, _time )--增加防守力local function fun_add_DFD_by_times(_skill_entity, _val)local role_buf = PACK_ROLE_DATA.g_role_binder.get_buf( _skill_entity.to_t_role_uid )role_buf.DFD = role_buf.DFD + _valend--减少防守力local function fun_del_DFD_by_times(_skill_entity, _val)local role_buf = PACK_ROLE_DATA.g_role_binder.get_buf( _skill_entity.to_t_role_uid )role_buf.DFD = role_buf.DFD - _valendlocal public = PACK_EvtSvr.new_action_evt_listener()function public.on_action( _skill_entity )local buf = PACK_ROLE_DATA.g_role_binder.get_buf( _skill_entity.to_t_role_uid )local val =  _fun_get_DFD_val( _skill_entity )print("实体[" .. _skill_entity.to_t_role_uid .. "]防守加成" .. val )fun_add_DFD_by_times(_skill_entity, val)--计时器暂时先不实现endskill_svr.action_map.add_listener(_evt_iid, public)return publicend--换位置function do_src_dest_swap_pos_module( _evt_iid, _fun_get_distance )local public_vote = PACK_EvtSvr.new_vote_evt_listener()function public_vote.on_vote( _skill_entity )local from_buf = PACK_ROLE_DATA.g_role_binder.get_buf( _skill_entity.from_role_uid )local to_buf = PACK_ROLE_DATA.g_role_binder.get_buf( _skill_entity.to_t_role_uid )local dx = (from_buf.pos_x - to_buf.pos_x) * (from_buf.pos_x - to_buf.pos_x)local dy = (from_buf.pos_y - to_buf.pos_y) * (from_buf.pos_y - to_buf.pos_y)local distance = _fun_get_distance(_skill_entity)if dx + dy > distance*distance thenprint("交换位置失败" )return trueendreturn falseendlocal public_act = PACK_EvtSvr.new_action_evt_listener()function public_act.on_action( _skill_entity )local from_buf = PACK_ROLE_DATA.g_role_binder.get_buf( _skill_entity.from_role_uid )local to_buf = PACK_ROLE_DATA.g_role_binder.get_buf( _skill_entity.to_t_role_uid )print("实体[" .. _skill_entity.to_t_role_uid .. "]交换位置" )local temp_x = from_buf.pos_xlocal temp_y = from_buf.pos_yfrom_buf.pos_x = to_buf.pos_xfrom_buf.pos_y = to_buf.pos_yto_buf.pos_x = temp_xto_buf.pos_y = temp_yendskill_svr.vote_map.add_listener(_evt_iid, public_vote)skill_svr.action_map.add_listener(_evt_iid, public_act)return public_actend--获得攻击力function fun_get_role_ATK( _skill_entity )local buf = PACK_ROLE_DATA.g_role_binder.get_buf( _skill_entity.from_role_uid )return buf.ATKend--通用技能G_General_SKILL ={{is_dest_dodge_module( PACK_Skill_Define.G_User_Skill_define["普通攻击"] ),do_module( PACK_Skill_Define.G_User_Skill_define["普通攻击"] ),do_dest_hurt_module( PACK_Skill_Define.G_User_Skill_define["普通攻击"], fun_get_role_ATK ),},}


 

--[[ file name : 技能模块第一版 author  :  Clark/陈泽丹 created :  2012-11-07 purpose : --]]module("复仇之魂", package.seeall)PACK_ROLE_DATA = require"角色数据"PACK_GameAPI = require"系统接口"PACK_Skill = require"技能"PACK_Skill_Define = require"技能定义"--复仇之魂VS_Skill_NPC ={--[[魔法箭快捷键:C向一个敌方单位发射魔法箭,造成伤害,并晕眩1.75秒。施法距离:500冷却时间:10秒魔法消耗:95/110/125/140点等级 1 - 造成100点的伤害。等级 2 - 造成175点的伤害。等级 3 - 造成250点的伤害。等级 4 - 造成325点的伤害。--]]{PACK_Skill.do_module( PACK_Skill_Define.G_User_Skill_define["魔法箭"] ),PACK_Skill.do_dest_dizzy_module( PACK_Skill_Define.G_User_Skill_define["魔法箭"], PACK_GameAPI.clk_bind_data({1.75}) ),PACK_Skill.do_dest_hurt_module( PACK_Skill_Define.G_User_Skill_define["魔法箭"], PACK_Skill_Define.fun_get_lvl_val(100, 175, 250, 325) ),},--[[命令光环快捷键:0增加周围300范围内友方单位的基础攻击力。等级 1 - 增加12%的基础攻击力。等级 2 - 增加20%的基础攻击力。等级 3 - 增加28%的基础攻击力。等级 4 - 增加36%的基础攻击力。--]]{PACK_Skill.do_module( PACK_Skill_Define.G_User_Skill_define["命令光环"] ),PACK_Skill.do_dest_ATK_module( PACK_Skill_Define.G_User_Skill_define["命令光环"], PACK_Skill_Define.fun_get_lvl_val(0.12, 0.20, 0.28, 0.36), 30 ),},--[[恐怖快捷键:E复仇之魂发出恶毒的吼叫,唤起周围敌方单位深深的恐惧。减少他们的护甲和攻击力,持续20秒。作用范围:700冷却时间:15秒魔法消耗:40点等级 1 - 减少2点的护甲和5%的攻击力。等级 2 - 减少3点的护甲和10%的攻击力。等级 3 - 减少4点的护甲和15%的攻击力。等级 4 - 减少5点的护甲和20%的攻击力。--]]{PACK_Skill.do_module( PACK_Skill_Define.G_User_Skill_define["恐怖"] ),PACK_Skill.do_dest_DFD_limit_time_module( PACK_Skill_Define.G_User_Skill_define["恐怖"], PACK_Skill_Define.fun_get_lvl_val(-2, -3, -4, -5), 20 ),PACK_Skill.do_dest_ATK_limit_time_module( PACK_Skill_Define.G_User_Skill_define["恐怖"], PACK_Skill_Define.fun_get_lvl_val(-0.05, -0.10, -0.15, -0.20), 20 ),},--[[移形换位快捷键:W瞬间和一个英雄交换位置。无视魔法免疫冷却时间:45秒魔法消耗:100/150/200点等级 1 - 施法距离600。等级 2 - 施法距离900。等级 3 - 施法距离1200。--]]{PACK_Skill.do_module( PACK_Skill_Define.G_User_Skill_define["移形换位"] ),PACK_Skill.do_src_dest_swap_pos_module( PACK_Skill_Define.G_User_Skill_define["移形换位"], PACK_Skill_Define.fun_get_lvl_val(6, 9, 12, 0) ),},}


 

--[[ file name : 技能模块第一版 author  :  Clark/陈泽丹 created :  2012-11-07 purpose : --]]module("test", package.seeall)PACK_GameAPI = require"系统接口"PACK_ROLE_DATA = require"角色数据"PACK_Skill = require"技能"PACK_Skill_Define = require"技能定义"PACK_VS = require"复仇之魂"TEST_SKILL_UID = 1TEST_ROLE_SRC = 2TEST_ROLE_DEST = 3PACK_ROLE_DATA.g_skill_binder.bind_index_to_buf( TEST_SKILL_UID, PACK_ROLE_DATA.new_skill(TEST_ROLE_SRC, TEST_ROLE_SRC, 3, 20, 19) )PACK_ROLE_DATA.g_role_binder.bind_index_to_buf( TEST_ROLE_SRC, PACK_ROLE_DATA.new_role(TEST_ROLE_SRC, TEST_ROLE_SRC, 31, 19) )PACK_ROLE_DATA.g_role_binder.bind_index_to_buf( TEST_ROLE_DEST, PACK_ROLE_DATA.new_role(TEST_ROLE_DEST, TEST_ROLE_DEST, 30, 20) )for i=1, 1 doprint("开始 " .. PACK_GameAPI.sz_T2S(PACK_ROLE_DATA.g_role_binder.get_buf( TEST_ROLE_DEST )))PACK_Skill.skill_svr.dispatch_evt(PACK_Skill_Define.G_User_Skill_define["普通攻击"], PACK_Skill.new_skill_entity( TEST_SKILL_UID, TEST_ROLE_SRC, TEST_ROLE_DEST ) )print("结果 " .. PACK_GameAPI.sz_T2S(PACK_ROLE_DATA.g_role_binder.get_buf( TEST_ROLE_DEST )))print("开始 " .. PACK_GameAPI.sz_T2S(PACK_ROLE_DATA.g_role_binder.get_buf( TEST_ROLE_DEST )))PACK_Skill.skill_svr.dispatch_evt(PACK_Skill_Define.G_User_Skill_define["魔法箭"], PACK_Skill.new_skill_entity( TEST_SKILL_UID, TEST_ROLE_SRC, TEST_ROLE_DEST ) )print("结果 " .. PACK_GameAPI.sz_T2S(PACK_ROLE_DATA.g_role_binder.get_buf( TEST_ROLE_DEST )))print("开始 " .. PACK_GameAPI.sz_T2S(PACK_ROLE_DATA.g_role_binder.get_buf( TEST_ROLE_DEST )))PACK_Skill.skill_svr.dispatch_evt(PACK_Skill_Define.G_User_Skill_define["命令光环"], PACK_Skill.new_skill_entity( TEST_SKILL_UID, TEST_ROLE_SRC, TEST_ROLE_DEST ) )print("结果 " .. PACK_GameAPI.sz_T2S(PACK_ROLE_DATA.g_role_binder.get_buf( TEST_ROLE_DEST )))print("开始 " .. PACK_GameAPI.sz_T2S(PACK_ROLE_DATA.g_role_binder.get_buf( TEST_ROLE_DEST )))PACK_Skill.skill_svr.dispatch_evt(PACK_Skill_Define.G_User_Skill_define["恐怖"], PACK_Skill.new_skill_entity( TEST_SKILL_UID, TEST_ROLE_SRC, TEST_ROLE_DEST ) )print("结果 " .. PACK_GameAPI.sz_T2S(PACK_ROLE_DATA.g_role_binder.get_buf( TEST_ROLE_DEST )))print("开始 " .. PACK_GameAPI.sz_T2S(PACK_ROLE_DATA.g_role_binder.get_buf( TEST_ROLE_DEST )))PACK_Skill.skill_svr.dispatch_evt(PACK_Skill_Define.G_User_Skill_define["移形换位"], PACK_Skill.new_skill_entity( TEST_SKILL_UID, TEST_ROLE_SRC, TEST_ROLE_DEST ) )print("结果 " .. PACK_GameAPI.sz_T2S(PACK_ROLE_DATA.g_role_binder.get_buf( TEST_ROLE_DEST )))end


第一层:

工具接口, 事件机, 数据库, 技能声明

第二层

技能定义,技能配置

第三层

测试