--[[
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 do
if nil ~= _t[i] then
t[ table.getn(t) + 1] = _t[i]
end
end
return t
end
--索引管理
function new_index_manager()
local t_index = {}
local public = {}
--创建索引
function public.create_index()
for i=1, 9999999 do
if nil == t_index[i] then
t_index[i] = 1
return i
end
end
myPrint("索引资源用尽", 1)
return nil
end
--索引是否有效
function public.is_valid_index( _index )
if nil ~= t_index[_index] then
return true
end
return false
end
--删除索引
function public.delete_index( _index )
t_index[_index] = nil
end
return public
end
--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] then
left_set[_left] = {}
end
local len = table.getn(left_set[_left])
for i=1, len do
if left_set[_left][i] == _right then
return
end
end
left_set[_left][table.getn(left_set[_left])+1] = _right
right_set[_right] = _left
end
--清除绑定
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 do
right_set[ t_right[i] ] = nil
end
left_set[_left] = nil
end
--清除绑定
function public.clear_right( _left, _right )
right_set[_right] = nil
local t_right = left_set[_left]
local len = table.getn( t_right )
for i=1, len do
if t_right[i] == _right then
t_right[i] = nil
end
end
end
--通过left获得rigth表
function public.get_t_right_by_left( _left )
return get_valid_t( left_set[_left] )
end
--通过right获得left
function public.get_left_by_right( _right )
return right_set[ _right ]
end
return public
end
--buf绑定器(用于把类的实现内容弱耦合的分拆成多个模块独立完成)
function new_map_for_index_to_buf( _sign )
local index_set = {}
local public = {}
--获得绑定者标识
function public.get_sign()
return _sign
end
--绑定buf
function public.bind_index_to_buf( _index, _buf )
index_set[ _index ] = _buf
end
--清除绑定
function public.clear_index_to_buf( _index )
index_set[_index] = nil
end
--通过left获得rigth表
function public.get_buf( _index )
return index_set[ _index ]
end
return public
end
--常用绑定者
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 _uid
end
function 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 do
if g_type_binder.get_buf( t_right[i] ) == _buf_type then
ret[ table.getn(ret) + 1] = t_right[i]
end
end
return ret
end
--table转字符串
function sz_T2S(_table)
local szLua = ""
local t = type(_table)
if t == "number" then
szLua = szLua .. _table
elseif t == "boolean" then
szLua = szLua .. tostring(_table)
elseif t == "string" then
szLua = szLua .. string.format("%q", _table)
elseif t == "table" then
szLua = szLua .. "{"
for k, v in pairs(_table) do
szLua = szLua .. "[" .. sz_T2S(k) .. "]=" .. sz_T2S(v) .. ","
end
local metatable = getmetatable(_table)
if metatable ~= nil and type(metatable.__index) == "table" then
for k, v in pairs(metatable.__index) do
szLua = szLua .. "[" .. sz_T2S(k) .. "]=" .. sz_T2S(v) .. ","
end
end
szLua = szLua .. "}"
elseif t == "nil" then
return {}
end
return szLua
end
--提供绑定数据的函数
function clk_bind_data( t_par )
local function do_clk_bind_data()
if nil == t_par then
return nil
end
local len = table.getn( t_par )
if 0 == len then
return nil
elseif 1 == len then
return t_par[1]
elseif 2 == len then
return t_par[1], t_par[2]
elseif 3 == len then
return t_par[1], t_par[2], t_par[3]
elseif 4 == len then
return t_par[1], t_par[2], t_par[3], t_par[4]
elseif 5 == len then
return t_par[1], t_par[2], t_par[3], t_par[4], t_par[5]
elseif 6 == len then
return t_par[1], t_par[2], t_par[3], t_par[4], t_par[5], t_par[6]
elseif 7 == len then
return t_par[1], t_par[2], t_par[3], t_par[4], t_par[5], t_par[6], t_par[7]
elseif 8 == len then
return 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 then
return 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 then
return 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 then
return 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 then
return 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 then
return 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]
else
myPrint("clk_bind_data",1) --------------------------------------------------------
return nil
end
end
return do_clk_bind_data
end
--提供绑定函数和相关参数的
function clk_bind_fun_data( _fun, t_par )
local function do_clk_bind_fun_data()
if nil == _fun then
myPrint("clk_bind_fun_data fun is nil", 1)
return true
end
if nil == t_par then
return _fun()
end
local len = table.getn( t_par )
if 0 == len then
return _fun()
elseif 1 == len then
return _fun(t_par[1])
elseif 2 == len then
return _fun(t_par[1], t_par[2])
elseif 3 == len then
return _fun(t_par[1], t_par[2], t_par[3])
elseif 4 == len then
return _fun(t_par[1], t_par[2], t_par[3], t_par[4])
elseif 5 == len then
return _fun(t_par[1], t_par[2], t_par[3], t_par[4], t_par[5])
elseif 6 == len then
return _fun(t_par[1], t_par[2], t_par[3], t_par[4], t_par[5], t_par[6])
elseif 7 == len then
return _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 then
return _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 then
return _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 then
return _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 then
return _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 then
return _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 then
return _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])
else
myPrint("clk_bind_fun_data实现",1) --------------------------------------------------------
return true
end
end
return do_clk_bind_fun_data
end
--[[
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 do
if _t[i] == _p then
return i
end
end
return nil
end
--否决事件监听
function new_vote_evt_listener()
local public = {}
function public.on_vote( _t_evt )
myPrint("未实现 new_vote_evt_listener", 1)
return false
end
return public
end
--执行消息监听
function new_action_evt_listener()
local public = {}
function public.on_action( _t_evt )
myPrint("未实现 new_action_evt_listener", 1)
end
return public
end
--完毕消息监听
function new_response_evt_listener()
local public = {}
function public.on_response( _t_evt )
myPrint("未实现 new_response_evt_listener", 1)
end
return public
end
--消息处理机
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] then
this_public.map[_evt_iid] = {}
end
local t = this_public.map[_evt_iid]
if nil == find_obj_pos(t, _p_recv) then
t[ table.getn(t) + 1 ] = _p_recv
end
end
function this_public.remove_listener(_evt_iid, _p_recv)
if nil ~= this_public.map[_evt_iid] then
local t = this_public.map[_evt_iid]
local id = find_obj_pos(t, _p_recv)
if nil ~= id then
local len = table.getn(t)
t[id] = t[len]
t[len] = nil
end
if table.getn(t) <= 0 then
this_public.map[_evt_iid] = nil
end
end
end
function this_public.clear()
this_public.map = {}
end
return this_public
end
local 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()
end
function public.dispatch_evt( _evt_iid, _t_evt )
--记录当前服,用于回复消息
_t_evt.from_evt_svr = public
--否决
if nil ~= public.vote_map.map[ _evt_iid ] then
local t = public.vote_map.map[ _evt_iid ]
local len = table.getn( t )
for i=1, len do
if t[i].on_vote( _t_evt ) then
return
end
end
end
--触发
if nil ~= public.action_map.map[ _evt_iid ] then
local t = public.action_map.map[ _evt_iid ]
local len = table.getn( t )
for i=1, len do
t[i].on_action( _t_evt )
end
end
--完毕
if nil ~= public.response_map.map[ _evt_iid ] then
local t = public.response_map.map[ _evt_iid ]
local len = table.getn( t )
for i=1, len do
t[i].on_response( _t_evt )
end
end
end
return public
end
--[[
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, --IID
uid = _uid, --UID
skill_lvl = _skill_lvl, --技能等级
}
return public
end
g_skill_binder = PACK_GameAPI.new_map_for_index_to_buf("skill")
--玩家实体
function new_role( _iid, _uid, _x, _y )
local public =
{
iid = _iid, --IID
uid = _uid, --UID
life_max = 100, --最大生命值
life_cur = 100, --当前生命值
is_dizzy = false, --眩晕状态
dodge_pro = 20, --闪避率
ATK = 50, --攻击力
DFD = 10, --防守力
pos_x = _x, --坐标x
pos_y = _y, --坐标y
STATE_SIGN = {}, --状态标示
}
return public
end
g_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 then
return _lvl1_val
elseif 2 == buf.skill_lvl then
return _lvl2_val
elseif 3 == buf.skill_lvl then
return _lvl3_val
elseif 4 == buf.skill_lvl then
return _lvl4_val
end
return 0
end
return do_fun_get_lvl_val
end
--[[
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 = true
local from_buf = PACK_ROLE_DATA.g_role_binder.get_buf( _from_role_uid )
if nil == from_buf then
is_hit = false
end
local to_buf = PACK_ROLE_DATA.g_role_binder.get_buf( _to_role_uid )
if nil == to_buf then
is_hit = false
end
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)
if dx + dy > _distance*_distance then
is_hit = false
end
if is_hit == _is_hit then
_fun_callback(_from_role_uid, _to_role_uid)
print("删除触发器")
end
end
--技能服
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 public
end
--执行
function do_module( _evt_iid )
local public = PACK_EvtSvr.new_action_evt_listener()
function public.on_action( _skill_entity )
print("执行指令[" .. _evt_iid .. "]" )
return true
end
skill_svr.action_map.add_listener(_evt_iid, public)
return public
end
--是否闪避
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 then
print("实体[" .. _skill_entity.to_t_role_uid .. "]闪避" )
return true
end
return false
end
skill_svr.vote_map.add_listener(_evt_iid, public)
return public
end
--执行眩晕
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 true
end
skill_svr.action_map.add_listener(_evt_iid, public)
return public
end
--执行伤害
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 then
buf.life_cur = 0
end
end
skill_svr.action_map.add_listener(_evt_iid, public)
return public
end
--攻击力加成
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 + _val
end
--减少攻击力
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 - _val
end
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 = 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}))
end
skill_svr.action_map.add_listener(_evt_iid, public)
return public
end
--攻击力加成
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 + _val
end
--减少攻击力
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 - _val
end
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 = buf.ATK*_fun_get_ATK_val( _skill_entity )
print("实体[" .. _skill_entity.to_t_role_uid .. "]攻击加成" .. val )
fun_add_ATK_by_times(_skill_entity, val)
--计时器暂时先不实现
end
skill_svr.action_map.add_listener(_evt_iid, public)
return public
end
--防守力加成
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 + _val
end
--减少防守力
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 - _val
end
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_DFD_val( _skill_entity )
print("实体[" .. _skill_entity.to_t_role_uid .. "]防守加成" .. val )
fun_add_DFD_by_times(_skill_entity, val)
--计时器暂时先不实现
end
skill_svr.action_map.add_listener(_evt_iid, public)
return public
end
--换位置
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 then
print("交换位置失败" )
return true
end
return false
end
local 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_x
local temp_y = from_buf.pos_y
from_buf.pos_x = to_buf.pos_x
from_buf.pos_y = to_buf.pos_y
to_buf.pos_x = temp_x
to_buf.pos_y = temp_y
end
skill_svr.vote_map.add_listener(_evt_iid, public_vote)
skill_svr.action_map.add_listener(_evt_iid, public_act)
return public_act
end
--获得攻击力
function fun_get_role_ATK( _skill_entity )
local buf = PACK_ROLE_DATA.g_role_binder.get_buf( _skill_entity.from_role_uid )
return buf.ATK
end
--通用技能
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 = 1
TEST_ROLE_SRC = 2
TEST_ROLE_DEST = 3
PACK_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 do
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 )))
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
第一层:
工具接口, 事件机, 数据库, 技能声明
第二层
技能定义,技能配置
第三层
测试

8362

被折叠的 条评论
为什么被折叠?



