| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598 |
- -- 涉及到的相关属性在属性表配置
- AGAndSD = {}
- local this = AGAndSD;
- local filename = "AGAndSD";
- -- LuaMessageIdToClient.RES_AGANDSD_SENDSTATE = 90001034 --data [1]类型 0数据通知 l当前sd变化
- local curSDVar = "ZC_CurSDVar" -- 当前SD值
- local MaxSDVar = "ZC_MaxSDVar" -- 最大SD值
- local CurAGVar = "ZC_CurAGVar" -- 当前AG值
- local MaxAGVar = "ZC_MaxAGVar" -- 最大AG值
- local AGTimeVar = "AGTimeVar" -- ag倒计时
- local outFightTimeVar = "outFightTimeVar" -- 脱离战斗时间
- local maxOutFightTime = 3 -- 脱离战斗时间
- local Sd_TimeKey = "Sd_TimeKey" -- sd药水冷却时间
- local SDitems_CD = 4 -- sd药水冷却时间间隔
- -- SYS_AGANDSD_OFFLINE_PLAYERS = "R$agandsd_offline_players"
- AGAngSDConfig = {
- sdbilv_base = 9000, -- 护盾基础比率配置 万分比
- sd_huifu_time = 5, -- sd恢复时间间隔
- ag_huifu_time = 3, -- ag恢复时间间隔
- podun_buff = 100402301 -- 破盾buff添加
- };
- function APIGetTable(actor, varName, var_type)
- local val = nil
- if var_type == 0 then
- val = getplaydef(actor, "J$" .. varName)
- elseif var_type == 1 then
- val = getplaydef(actor, "@" .. varName)
- else
- val = getplaydef(actor, "T$" .. varName)
- end
- return val
- end
- ---设置玩家table变量 val类型必须是table var_type 0天变量 1缓存变量 其它正常保存数据库变量
- function APISetTable(actor, varName, val, var_type)
- if type(val) ~= "table" then
- return
- end
- if var_type == 0 then
- setplaydef(actor, "J$" .. varName, val)
- elseif var_type == 1 then
- setplaydef(actor, "@" .. varName, val)
- else
- setplaydef(actor, "T$" .. varName, val)
- -- info("记录成功",val,getplaydef(actor,"T$"..varName))
- end
- end
- function APIGetInt(actor, varName, var_type)
- local val = 0
- if var_type == 0 then
- val = getplaydef(actor, "J$" .. varName)
- elseif var_type == 1 then
- val = getplaydef(actor, "@" .. varName)
- else
- val = getplaydef(actor, "T$" .. varName)
- end
- return val or 0
- end
- ---设置玩家Int变量 val类型必须是number
- function APISetInt(actor, varName, val, var_type)
- if type(val) ~= "number" then
- return
- end
- if var_type == 0 then
- return setplaydef(actor, "J$" .. varName, val)
- elseif var_type == 1 then
- return setplaydef(actor, "@" .. varName, val)
- else
- return setplaydef(actor, "T$" .. varName, val)
- end
- end
- function APISendCenterMsg(actor, msg, color, log)
- if not color then
- tipinfo(actor, msg)
- else
- tipinfo(actor, "<color='" .. color .. "'>" .. msg .. "</color>")
- end
- if log then
- error(getbaseinfo(actor, "rolename"), msg)
- end
- end
- -- 伤害 excusefightdamage extra_result最后触发
- -- 此代码仅供参考
- --[[
- local extra_result = {};--额外的飘字拆分
- if targettype == MapObjectType.PLAYER then
- fightResult.targethurt = targethurt --受击者伤害
- --伤害后AG和SD操作执行
- AGAndSD.onAttackAGAndSD(paramMap,fightResult,extra_result)
- -- info("现伤害2",fightResult)
- targethurt = fightResult.targethurt
- hurttype = fightResult.hurttype
- end
- ]]
- -- 护盾扣除逻辑(伤害的90%,不足则全扣)
- function AGAndSD.onAttackSD(actor, paramMapList, fightResult)
- -- info("onAttackSD paramMapList ",paramMapList);
- -- info("onAttackSD fightResult ",fightResult);
- -- local castType = paramMapList["castertype"]
- local target = paramMapList[1]["target"] -- —— 受击对象
- local targethurt = fightResult["targethurt"] -- 攻击者伤害
- local actortype = getbaseinfo(actor, "mapobjecttype"); -- 攻击者
- local targettype = getbaseinfo(target, "mapobjecttype"); -- 受击者
- -- info("actortype ",actortype);
- -- APISetInt(target, outFightTimeVar, maxOutFightTime) -- 设置3秒脱战
- -- APISetInt(actor, outFightTimeVar, maxOutFightTime) -- 设置3秒脱战
- if actortype == 2 or targettype == 2 then
- return fightResult -- 怪物攻击时不做处理
- end
- if targethurt <= 0 then
- return fightResult
- end
- local curSD = APIGetInt(target, curSDVar);
- if curSD <= 0 then
- return fightResult
- end
- local maxSD = APIGetInt(target, MaxSDVar)
- local curAG = APIGetInt(target, CurAGVar)
- local maxAG = APIGetInt(target, MaxAGVar)
- if curSD >= 0 then
- local tmp = targethurt * 90 / 100
- if curSD >= tmp then
- curSD = curSD - tmp;
- targethurt = targethurt - tmp;
- else
- targethurt = targethurt - curSD;
- curSD = 0;
- end
- -- messagebox(actor,"伤害:"..casthurt.." 当前护盾:"..curSD.." 减少伤害:"..tmp)
- APISetInt(target, curSDVar, curSD)
- AGAndSD.SendMsg(target, {0, curSD, maxSD, curAG, maxAG})
- else
- APISetInt(target, curSDVar, 0)
- AGAndSD.SendMsg(target, {0, 0, maxSD, curAG, maxAG})
- end
- fightResult["targethurt"] = targethurt
- fightResult["targethurtshow"] = targethurt
- -- info("onAttackSD fightResult ",fightResult);
- return fightResult;
- end
- -- --护盾裆下的伤害用加血的方式处理
- -- function AddHealth(actor, healAmount)
- -- local currentHp = getbaseinfo(actor, "hp")
- -- local maxHp = getbaseinfo(actor, "maxhp")
- -- local newHp = math.min(maxHp, currentHp + healAmount)
- -- info("当前血量",currentHp,"最大血量",maxHp,"加血",healAmount,"新血量",newHp)
- -- sethp(actor, newHp)
- -- end
- -- 脱战后,每秒回复护盾值10点
- function AGAndSD.onSecCullSd(actor, fightResult)
- local time = APIGetInt(actor, AGTimeVar)
- if time == 0 then
- time = 2
- on3SecCullAg(actor, fightResult);
- else
- time = time - 1
- end
- APISetInt(actor, AGTimeVar, time)
- local outfighttime = APIGetInt(actor, outFightTimeVar)
- if outfighttime > 0 then
- outfighttime = outfighttime - 1
- APISetInt(actor, outFightTimeVar, outfighttime)
- return
- end
- -- messagebox(actor,"每秒回复护盾值10")
- local curSD = APIGetInt(actor, curSDVar)
- local maxSD = APIGetInt(actor, MaxSDVar)
- local curAG = APIGetInt(actor, CurAGVar)
- local maxAG = APIGetInt(actor, MaxAGVar)
- curSD = curSD + 10
- if curSD > maxSD then
- curSD = maxSD
- end
- APISetInt(actor, curSDVar, curSD)
- AGAndSD.SendMsg(actor, {0, curSD, maxSD, curAG, maxAG})
- end
- -- 技能消耗ag值的逻辑
- function AGAndSD.onAttackAG(actor, skillId)
- -- if true then
- -- return
- -- end
- -- APISetInt(actor, outFightTimeVar, maxOutFightTime) -- 设置3秒脱战
- local newConsumeAG = ConfigDataManager.getTableValue("cfg_skill_info", "newConsumeAG", "skillID", skillId)
- if newConsumeAG == nil then
- return
- end
- local castAG = tonumber(newConsumeAG) or 0
- local curSD = APIGetInt(actor, curSDVar)
- local maxSD = APIGetInt(actor, MaxSDVar)
- local curAG = APIGetInt(actor, CurAGVar)
- local maxAG = APIGetInt(actor, MaxAGVar)
- if curAG >= castAG then
- curAG = curAG - castAG
- APISetInt(actor, CurAGVar, curAG)
- AGAndSD.SendMsg(actor, {0, curSD, maxSD, curAG, maxAG})
- else
- APISetInt(actor, CurAGVar, 0)
- AGAndSD.SendMsg(actor, {0, curSD, maxSD, 0, maxAG})
- end
- end
- -- 每3秒触发回复技能伤害值
- function on3SecCullAg(actor, fightResult)
- local curSD = APIGetInt(actor, curSDVar)
- local maxSD = APIGetInt(actor, MaxSDVar)
- local curAG = APIGetInt(actor, CurAGVar)
- local maxAG = APIGetInt(actor, MaxAGVar)
- local tmp = maxAG * 3 / 100
- -- messagebox(actor,"三秒回复技能值="..tmp)
- curAG = curAG + tmp
- if curAG > maxAG then
- curAG = maxAG
- end
- APISetInt(actor, CurAGVar, curAG)
- AGAndSD.SendMsg(actor, {0, curSD, maxSD, curAG, maxAG})
- -- APISendCenterMsg(actor,"当前技能值="..curAG,0,true)
- end
- function AGAndSD.onAttackAGAndSD(paramMap, fightResult, extra_result)
- local actor = paramMap.caster -- —— 攻击对象
- local target = paramMap.target -- —— 受击对象
- local targethurt = fightResult.targethurt -- 受击者伤害
- local casthurt = fightResult.casthurt -- 攻击者伤害
- local castershield = fightResult.castershield -- 攻击者者扣除护盾
- local targetshield = fightResult.targetshield -- 受击者扣除护盾
- local nowsec = getbaseinfo(actor, "nowsec")
- local playerName = getbaseinfo(actor, "rolename")
- local attackRid = actor:toString()
- APISetInt(actor, "ZC_SDTime", nowsec, 1)
- APISetInt(target, "ZC_SDTime", nowsec, 1)
- local curSD = APIGetInt(target, curSDVar);
- if curSD <= 0 then
- AGAndSD.SendMsg(target, {1, curSD, playerName, attackRid})
- return
- end
- -- info("原伤害",targethurt,casthurt)
- local c_SDwushiRate = getattrinfo(actor, "SDwushiRate") -- 攻击者sd的无视概率
- local t_dikangwushiSd = getattrinfo(actor, "dikangwushiSd") -- 受击者的抵抗无视概率
- -- 判定是否可无视
- if c_SDwushiRate > t_dikangwushiSd then
- local randomValue = math.random(10000);
- -- 无视成功
- if randomValue < c_SDwushiRate - t_dikangwushiSd then
- return
- end
- end
- local c_SDwushiRate = getattrinfo(actor, "adbilvRate") -- 攻击者SD减少率
- local t_dikangwushiSd = getattrinfo(actor, "SDsubRate") -- 受击者SD比率
- local bilv = (AGAngSDConfig.sdbilv_base / 10000 + c_SDwushiRate - t_dikangwushiSd) -- 最终比率
- local sd_hurt = targethurt * bilv -- 减少伤害
- if sd_hurt > targethurt then
- sd_hurt = targethurt;
- end
- -- 破盾
- if sd_hurt >= curSD then
- -- APISendCenterMsg(target,"破盾了")
- sd_hurt = curSD
- curSD = 0;
- addbuff(target, AGAngSDConfig.podun_buff)
- else
- sd_hurt = math.floor(sd_hurt)
- curSD = curSD - sd_hurt;
- end
- fightResult.targethurt = targethurt - sd_hurt
- -- fightResult.targetshield = targetshield + sd_hurt
- local extar_fight = table.copy(fightResult)
- extar_fight.hurttype = 203
- extar_fight.targethurt = 0;
- extar_fight.targethurtshow = sd_hurt;
- extar_fight.fightLog = {"SD护盾显示飘字" .. extar_fight.targethurtshow}
- -- info(extar_fight)
- table.insert(extra_result, extar_fight)
- APISetInt(target, curSDVar, curSD)
- AGAndSD.SendMsg(target, {1, curSD, playerName, attackRid})
- end
- function AGAndSD.onReflexDamage(paramMap, fightResult, extra_result, casthurt)
- local actor = paramMap.caster -- —— 攻击对象
- local nowsec = getbaseinfo(actor, "nowsec")
- APISetInt(actor, "ZC_SDTime", nowsec, 1)
- local curSD = APIGetInt(actor, curSDVar);
- if curSD <= 0 then
- return casthurt
- end
- local bilv = (AGAngSDConfig.sdbilv_base / 10000)
- local sd_hurt = casthurt * bilv -- 减少伤害
- if sd_hurt > casthurt then
- sd_hurt = casthurt;
- end
- -- 破盾
- if sd_hurt >= curSD then
- -- APISendCenterMsg(target,"破盾了")
- sd_hurt = curSD
- curSD = 0;
- addbuff(actor, AGAngSDConfig.podun_buff)
- else
- sd_hurt = math.floor(sd_hurt)
- curSD = curSD - sd_hurt;
- end
-
- -- fightResult.targetshield = targetshield + sd_hurt
- local extar_fight = table.copy(fightResult)
- extar_fight.target = actor
- extar_fight.hurttype = 203
- extar_fight.targethurt = 0;
- extar_fight.targethurtshow = sd_hurt;
- extar_fight.fightLog = {"SD护盾显示飘字" .. extar_fight.targethurtshow}
- -- info(extar_fight)
- table.insert(extra_result, extar_fight)
- APISetInt(actor, curSDVar, curSD)
- AGAndSD.SendMsg(actor, {1, curSD})
- return casthurt - sd_hurt
- end
- -- 每秒心跳 rolesecondheart调用
- function AGAndSD.onRoleseCond(actor)
- -- local playerinfo = getplayermaininfo(actor)
- -- info('获取玩家所有的属性点信息', playerinfo)
- -- jprint(playerinfo)
- local maxSD = APIGetInt(actor, MaxSDVar)
- local hudunValue = getattrinfo(actor, "hudunValue")
- local curSD = APIGetInt(actor, curSDVar)
- local is_change = false;
- -- if maxSD <= 0 and curSD > 0 then
- -- maxSD = curSD
- -- APISetInt(actor, MaxSDVar, maxSD)
- -- end
- if hudunValue > maxSD or curSD > maxSD then
- maxSD = hudunValue;
- curSD = math.max(0, curSD)
- curSD = math.min(maxSD, curSD)
- is_change = true;
- -- info("上限增加",curSD,maxSD)
- end
- -- SDyewaihuivValue SDyewaihuivRate 属性表注册
- local SDyewaihuivValue = getattrinfo(actor, "SDyewaihuivValue")
- local SDyewaihuivRate = getattrinfo(actor, "SDyewaihuivRate")
- -- info("恢复1",curSD,maxSD,SDyewaihuivValue,SDyewaihuivRate,curSD < maxSD and (SDyewaihuivValue > 0 or SDyewaihuivRate > 0))
- if curSD < maxSD and (SDyewaihuivValue > 0 or SDyewaihuivRate > 0) then
- local nowsec = getbaseinfo(actor, "nowsec")
- local fightstate = getfightstate(actor)
- -- if fightstate == 0 then
- local last_huifu_time = APIGetInt(actor, "ZC_SDTime", 1)
- -- info("恢复", last_huifu_time, last_huifu_time >= nowsec + AGAngSDConfig.sd_huifu_time)
- if last_huifu_time + AGAngSDConfig.sd_huifu_time <= nowsec then
- APISetInt(actor, "ZC_SDTime", nowsec, 1)
- local huifu_count = SDyewaihuivValue + math.ceil(maxSD * SDyewaihuivRate)
- curSD = curSD + huifu_count
- -- info("当前护盾值恢复",curSD,maxSD)
- if curSD > maxSD then
- curSD = maxSD
- end
- is_change = true
- end
- -- else
- -- APISetInt(actor, "ZC_SDTime", nowsec, 1)
- -- end
- end
- -- AG
- local curAG = APIGetInt(actor, CurAGVar);
- local maxAG = APIGetInt(actor, MaxAGVar);
- local agValue = getattrinfo(actor, "agValue")
- if agValue > maxAG then
- curAG = curAG + agValue - maxAG
- maxAG = agValue;
- is_change = true;
- end
- local agZiDongHuifu = getattrinfo(actor, "agZiDongHuifu")
- local AGZiDongHuiFuBili = getattrinfo(actor, "AGZiDongHuiFuBili") -- 0.0 , 0.08
- -- agZiDongHuifu = tonumber(agZiDongHuifu) or 0
- -- AGZiDongHuiFuBili = tonumber(AGZiDongHuiFuBili) or 0
- if curAG < maxAG and (agZiDongHuifu > 0 or AGZiDongHuiFuBili > 0) then
- local nowsec = getbaseinfo(actor, "nowsec")
- -- if getfightstate(actor) == 0 then
- local last_huifu_time = APIGetInt(actor, "ZC_AGTime", 1)
- if last_huifu_time + AGAngSDConfig.ag_huifu_time <= nowsec then
- APISetInt(actor, "ZC_AGTime", nowsec, 1)
- local huifu_count = agZiDongHuifu + math.ceil(maxAG * AGZiDongHuiFuBili)
- curAG = curAG + huifu_count
- if curAG > maxAG then
- curAG = maxAG
- end
- is_change = true
- end
- -- else
- -- APISetInt(actor, "ZC_AGTime", nowsec, 1)
- -- end
- end
- -- info(string.format("MS -> AGAndSD.onRoleseCond, 8.结束心跳 actor: %s, curAG: %d, maxAG: %d", actor, curAG, maxAG))
- if is_change then
- APISetInt(actor, MaxSDVar, maxSD)
- APISetInt(actor, curSDVar, curSD)
- APISetInt(actor, CurAGVar, curAG)
- APISetInt(actor, MaxAGVar, maxAG)
- AGAndSD.SendMsg(actor, {0, curSD, maxSD, curAG, maxAG})
- end
- -- info("数据同步") 测试期间, 先不检测是否改变
- end
- -- 玩家登录 login调用
- function AGAndSD.onLoginEnd(actor)
- local curSD = APIGetInt(actor, curSDVar);
- local maxSD = APIGetInt(actor, MaxSDVar);
- local curAG = APIGetInt(actor, CurAGVar);
- local maxAG = APIGetInt(actor, MaxAGVar);
- local curMaxSD = getattrinfo(actor, "hudunValue")
- local agValue = getattrinfo(actor, "agValue")
- -- messagebox("curMaxSD", curMaxSD, "agValue", agValue, "curSD", curSD, "maxSD", maxSD, "curAG", curAG, "maxAG", maxAG)
- if maxSD ~= curMaxSD then
- maxSD = curMaxSD
- APISetInt(actor, MaxSDVar, maxSD)
- end
- if maxAG ~= agValue then
- maxAG = agValue
- APISetInt(actor, MaxAGVar, maxAG)
- end
- if curAG > maxAG then
- curAG = maxAG
- APISetInt(actor, CurAGVar, curAG)
- end
- AGAndSD.SendMsg(actor, {0, curSD, maxSD, curAG, maxAG})
- end
- function AGAndSD.onLogout(actor)
- end
- -- 怪物死亡 killmon 调用
- function AGAndSD.onKillMon(actor, monsterId, monsterCfgId, monsterName, pointX, pointY, activityId, monsterLevel,
- mongenCfgId)
- local shaguaihuiSDValue = getattrinfo(actor, "shaguaihuiSDValue")
- local shaguaihuiSDRate = getattrinfo(actor, "shaguaihuiSDRate")
- if shaguaihuiSDValue > 0 or shaguaihuiSDRate > 0 then
- local maxSD = APIGetInt(actor, MaxSDVar)
- local curSD = APIGetInt(actor, curSDVar)
- if curSD < maxSD then
- local huifu_count = shaguaihuiSDValue + math.ceil(maxSD * shaguaihuiSDRate)
- curSD = curSD + huifu_count
- AGAndSD.SetCurSD(actor, curSD)
- end
- end
- end
- -- 设置当前sd 并同步客户端
- function AGAndSD.SetCurSD(actor, SD)
- local maxSD = APIGetInt(actor, MaxSDVar)
- if SD > maxSD then
- SD = maxSD
- end
- APISetInt(actor, curSDVar, SD)
- -- info("数据同步")
- AGAndSD.SendMsg(actor, {1, SD})
- end
- -- 获取当前sd以及最大sd
- function AGAndSD.GetSD(actor)
- return APIGetInt(actor, curSDVar), APIGetInt(actor, MaxSDVar)
- end
- -- 设置当前AG 并同步客户端
- function AGAndSD.SetCurAG(actor, AG)
- local maxSD = APIGetInt(actor, MaxAGVar)
- if AG > maxSD then
- AG = maxSD
- end
- APISetInt(actor, CurAGVar, AG)
- -- info("数据同步",AG)
- AGAndSD.SendMsg(actor, {2, AG})
- end
- -- 获取当前AG以及最大AG
- function AGAndSD.GetAG(actor)
- return APIGetInt(actor, CurAGVar), APIGetInt(actor, MaxAGVar)
- end
- -- releaseskill 调用 newConsumeAG在cfg_skill_info添加配置
- --[[ 代码参考
- function releaseskill(actor, skillid, skilllevel, targetlist)
- if not AGAndSD.CanRelease(actor,skillid,skilllevel) then
- return false
- end
- end
- ]]
- function AGAndSD.CanRelease(actor, skillid, skilllevel)
- local curAG = APIGetInt(actor, CurAGVar);
- local consumeAG = ConfigDataManager.getTableValue("cfg_skill_info", "newConsumeAG", "skillID", skillid,
- "skillLevel", skilllevel)
- -- info("consumeAG1",type(consumeAG),consumeAG)
- consumeAG = tonumber(consumeAG)
- -- info("consumeAG",type(consumeAG),consumeAG)
- if consumeAG then
- local agConsumeJianShao = getattrinfo(actor, "agConsumeJianShao")
- local agConsumeJianShaoBiLi = getattrinfo(actor, "agConsumeJianShaoBiLi")
- if agConsumeJianShao > 0 or agConsumeJianShaoBiLi > 0 then
- -- info("ag减少",agConsumeJianShao - consumeAG*agConsumeJianShaoBiLi)
- consumeAG = consumeAG - agConsumeJianShao - math.floor(consumeAG * agConsumeJianShaoBiLi)
- end
- if consumeAG > 0 then
- if consumeAG > curAG then
- APISendCenterMsg(actor, "AG值不足")
- return false
- else
- AGAndSD.SetCurAG(actor, curAG - consumeAG)
- end
- end
- end
- return true
- end
- function AGAndSD.SendMsg(actor, data)
- local msg = {
- rid = actor:toString(),
- data = data
- }
- sendluamsg(actor, LuaMessageIdToClient.RES_AGANDSD_SENDSTATE, msg)
- end
- function AGAndSD.useItem(actor, itemId, itemCount, type)
- if itemId ~= 50020021 then
- return false
- end
- local config = ConfigDataManager.getById("cfg_item", itemId)
- if table.isEmpty(config) then
- return false
- end
- -- local type = tonumber(config['type'])
- -- local subType = tonumber(config['subtype'])
- -- if type ~= 3 or subType ~= 94 then
- -- return
- -- end
- local useParam = tonumber(config['useparam']) or 0
- if useParam == 0 then
- return false
- end
- if type == 1 then
- local nowsec = getbaseinfo(actor, "nowsec")
- local cdVal = APIGetInt(actor, Sd_TimeKey, 1)
- if cdVal > 0 and nowsec - cdVal <= SDitems_CD then
- messagebox(actor, "冷却中,请稍后再使用!")
- -- noticeTip.noticeinfo(actor, "冷却中,请稍后再使用!")
- return false
- end
- APISetInt(actor, Sd_TimeKey, nowsec, 1)
- return true
- end
- local maxSD = APIGetInt(actor, MaxSDVar)
- local curSD = APIGetInt(actor, curSDVar)
- if curSD < maxSD then
- local huifu_count = math.ceil(maxSD * useParam / 100)
- curSD = curSD + huifu_count
- AGAndSD.SetCurSD(actor, curSD)
- end
- end
- function AGAndSD.playerRelive(actor)
- local maxSD = APIGetInt(actor, MaxSDVar);
- local maxAG = APIGetInt(actor, MaxAGVar);
- AGAndSD.SetCurSD(actor, maxSD)
- AGAndSD.SetCurAG(actor, maxAG)
- end
|