Files

619 lines
20 KiB
Lua
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

require("Envir/Market_Def/wza.lua") --个人封装函数
--特效触发提醒
local function _effectNotice(actor, str)
sendCenterMsg(actor, str, 0, 250, 0, 1)
end
--判断是否免疫控制-灵器-true免疫false不免疫
local function lingqi_immune_control(player)
if not isplayer(player) then
return false
end
local time = tonumber(lualib:GetTempStr(player, "灵器十步一杀释放"))
local data = config[TYPE_CFG.LQ_SUIT2]
local suitnum = data.suitnum
local level = get_level_suit(player, suitnum)
if data.immune_control[level] then
local lasttime = data.immune_control[level]
if time and time + lasttime >= uicGetTimes64() then
return true
else
return false
end
else
return false
end
end
--===========================是否免疫控制==================
local function _check_mykz(actor, attacker)
if getbaseinfo(actor,51,213) > 0 then
return true
end
if hasbuff(actor, 12024) then
--屏障免疫一次控制
--lualib:SendSelfMsg(actor, "免疫一次控制")
delbuff(actor, 12024)
return true
end
-- if lingqi_immune_control(actor) then
-- lualib:SendMsg(actor, "灵器特效抵抗控制!", 9)
-- if attacker then
-- lualib:SendMsg(attacker, "目标灵器特效触发抵抗了你的控制!", 9)
-- end
-- return true
-- end
return false
end
--================================================================天赋 屏障
local function _talent_pingzhan(actor)
local uid = "308"
local level = _getTalentLv(actor, uid)
if level > 0 then
local cfg = tTalentUIDMap[uid]
if cfg and cfg.Abilty and cfg.Abilty.Data then
local cd = cfg.Abilty.Data[level][1]
local nowTime = os.time()
if lualib:GetPlayerU(actor, PLAYER_VAR.U.TALENT_PINGZHAN) < nowTime then
--CD已过
lualib:SetPlayerU(actor, PLAYER_VAR.U.TALENT_PINGZHAN, nowTime + cd)
if not lualib:HasBuff(actor, 12024) then
lualib:AddBuff(actor, 12024, 0)
end
end
end
else
if lualib:HasBuff(actor, 12024) then
lualib:DelBuff(actor, 12024)
end
end
end
----------------------------麻痹----------------------------
--朱雀神装
local function _processShenZhuangZhuque(actor, hitter)
local tag = TYPE_CFG.SZZQ
local level = _getPlayerData(actor, tag)
local cfg = config[tag]
if cfg.levSpecAtt[level] then
local resistChance = cfg.levSpecAtt[level][1] --抵抗概率万分比
if math.random(1, 10000) <= resistChance then
local chancePct = cfg.levSpecAtt[level][2] --麻痹概率万分比
local iTime = cfg.levSpecAtt[level][3] --麻痹概率万分比
if math.random(1, 10000) <= chancePct then
_effectNotice(actor, "你对" .. lualib:Name(hitter) .. "造成麻痹" .. iTime .. "")
_effectNotice(hitter, lualib:Name(actor) .. "对你造成麻痹" .. iTime .. "")
lualib:Mabi(hitter, iTime, actor)
end
return true
end
end
return false
end
--麻痹效果
local function _processMabi(actor, target, actorName, targetName, targetIsPlayer)
local level = _getPlayerData(actor, TYPE_CFG.MABI)
local cfg = config[TYPE_CFG.MABI]
if level and cfg.levSpecAtt[level] then
local time = lualib:GetTempInt(actor, cfg.cdVar)
local nowTime = os.time()
if time <= nowTime then
if math.random(10000) <= cfg.levSpecAtt[level][1] then
--添加麻痹buff
if targetIsPlayer then
local zodiacLv = _getPlayerData(target, TYPE_CFG.ZODIAC)
local zodiacCfg = config[TYPE_CFG.ZODIAC]
if zodiacCfg.levSpecAtt[zodiacLv] and math.random(10000) <= zodiacCfg.levSpecAtt[zodiacLv][1] then
--生肖免疫麻痹
_effectNotice(actor, targetName .. "抵抗了你的麻痹")
_effectNotice(target, "抵抗来自" .. actorName .. "的麻痹")
else
if not _check_mykz(target, actor) then
local secTime = cfg.levSpecAtt[level][3]
if zodiacCfg.levSpecAtt[zodiacLv] and zodiacCfg.levSpecAtt[zodiacLv][2] then
--生肖减麻痹时间
secTime = math.max(secTime - zodiacCfg.levSpecAtt[zodiacLv][2], 0)
end
if not _processShenZhuangZhuque(target, actor) then
lualib:Mabi(target, secTime, actor)
_effectNotice(target, actorName .. "对你造成麻痹" .. secTime .. "")
_effectNotice(actor, "你对" .. targetName .. "造成麻痹" .. secTime .. "")
end
lualib:SetTempInt(actor, cfg.cdVar, nowTime + cfg.levSpecAtt[level][4])
end
end
else
local secTime = cfg.levSpecAtt[level][3]
lualib:Mabi(target, secTime, actor)
lualib:SetTempInt(actor, cfg.cdVar, nowTime + cfg.levSpecAtt[level][4])
end
end
end
end
end
--================================================================夜间无敌流程
local function _processNightWudi(actor, damage, gongjizhe)
if not isplayer(actor) then
return damage
end
if lualib:GetFlag(actor, PLAYER_VAR.FLAG.GUAJIWUDI) == 0 then
return damage
end
local hour = GetHour()
if 10 <= hour and hour < 23 then
return damage
end
local mapKey = getmap(actor)
if not MAP_DEFINE[mapKey] then
--不在挂机地图
return damage
end
if gongjizhe and lualib:IsPlayer(gongjizhe) then
sendmsg9(gongjizhe, "对方处于夜间无敌状态")
end
return 0
end
-- 处理无敌
local function _processWudi(actor, damage, gongjizhe)
if not isplayer(actor) then
return damage
end
local tag = TYPE_CFG.ZB3
if config[tag] and config[tag].buffId and lualib:HasBuff(actor, config[tag].buffId) then
return 0
end
--降龙-倒转乾坤-无敌
local tag = TYPE_CFG.ZZX_2_6
if config[tag] and config[tag].buffid and lualib:HasBuff(actor, config[tag].buffid) then
return 0
end
--闪避
local attr = lualib:Attr(actor,243)
if attr >= 100 or (attr > 0 and math.random(1,100) <= attr) then
lualib:AtkEffect(actor,3,gongjizhe)
return 0
end
--鬼王-绝地反击
local zz1_tag = TYPE_CFG.ZZX_1_6
local steps = lualib:GetInt(actor, PLAYER_VAR.INT.ZHUAN_ZHI_XIN_LEVEL)
local career = lualib:GetInt(actor, PLAYER_VAR.INT.ZHUAN_ZHI_XIN_CAREER)
if career == CAREER_DEFINE.GW and steps >= config[zz1_tag].needlevel and lualib:HasBuff(actor, config[zz1_tag].buffid) then
return 0
end
return damage
end
--计算伤害减免
local function _shjm(actor, gongjizhe, shoujizhe, damage)
if hitter then
-- dbg(lualib:Name(hitter),targetName)
local attrType = 27
--受击者减伤
local decPct = getbaseinfo(shoujizhe,attrType)
--攻击者无视减伤
local ignorePct = getbaseinfo(gongjizhe,51,235)
-- dbg(decPct, ignorePct)
if decPct > 0 then
decPct = math.max(decPct - ignorePct, 0)
decPct = math.min(decPct, 99)
-- dbg("伤害减免"..decPct.."%")
return math.ceil(damage * (100 - decPct) / 100)
end
end
return damage
end
--加血
local function _playerAddHp(actor, hp)
local maxHp = getbaseinfo(actor,10)
local curHp = getbaseinfo(actor,9)
if maxHp <= curHp then
return
end
--humanhp(actor, "=", math.min(curHp + hp, maxHp))
humanhp(actor, "+", hp)
end
--扣血
local function _playerSubHp(actor, gongjizhe, shoujizhe, hp, Typeid)
if isplayer(shoujizhe) then
local targetName = getname(shoujizhe)
--是玩家
-- hp = _processNightWudi(actor, hp)
-- hp = _processWudi(actor, hp)
hp =_shjm(actor, gongjizhe, shoujizhe, hp)
end
if ismon(shoujizhe) then
local monname = getname(shoujizhe)
----怪物减伤万分比
--hp = GetMonDecDamage(targetName, hp)
if MONSTER_FIXED_DAMAGE[monname] then
--怪物固定伤害
hp = math.min(hp, MONSTER_FIXED_DAMAGE[monname])
end
end
if hp > 0 then
humanhp(shoujizhe, "-", hp, Typeid, nil, gongjizhe)
end
end
--================================================================受怪减伤流程
local function _processMonDmgRec(actor,gongjizhe,shoujizhe,skillid,damage)
local dmgDec = getbaseinfo(shoujizhe,51,225)
if dmgDec > 0 then
damage = math.max(damage - dmgDec, 0)
end
return damage
end
--================================================================额外受怪减伤减少X%怪物对你造成的伤害
local function _processMonDmgRecex(actor,gongjizhe,shoujizhe,skillid,damage)
local decPct = getbaseinfo(shoujizhe,51,211)
if decPct > 0 then
return math.ceil(damage * (100 - decPct) / 100)
end
return damage
end
--================================================================玩家回血流程
local function _processHpRecover(actor, recoverHp)
if recoverHp < 0 then
return
end
local injured = getbaseinfo(actor,51,208) --重伤
if injured >= 100 then
return
end
recoverHp = math.ceil(recoverHp * (100 - injured) / 100)
_playerAddHp(actor, recoverHp)
end
--================================================================对怪固定吸血流程
local function _processMonSuckHp(actor)
local suckHp = getbaseinfo(actor,51,219)
if suckHp > 0 then
_processHpRecover(actor, suckHp) --走回血流程
end
end
--================================================================专属 烈火燎原
local function _zhuanshu_liehuoliaoyuan(actor)
local value = getbaseinfo(actor,51,220)
if value > 0 then
releasemagic(actor, getskillindex("专属烈火燎原"), 1, 3, 1, 0)
end
end
--烈火剑法处理
local function _processmagicliehuo(actor,gongjizhe,shoujizhe,skillid,damage)
local value = getbaseinfo(actor,51,226)
if value > 0 then
damage = math.ceil(damage * (1 + value / 10000))
end
_zhuanshu_liehuoliaoyuan(actor) --专属 烈火燎原
return damage
end
--================================================================专属 对怪固定伤害
local function _zhuanshu_gudingshanghai(actor, damage)
local value = getbaseinfo(actor,51,228)
if value > 0 then
damage = damage + value
end
return damage
end
--================================================================专属 冰咆哮
local function _zhuanshu_bingpaoxiao(actor)
local value = getbaseinfo(actor,51,221)
if value > 0 and math.random(1,100) <= 3 and getint(actor,"专属冰咆哮CD") < os.time() then
setint(actor,"专属冰咆哮CD",os.time() + 3)
releasemagic(actor, getskillindex("专属冰咆哮"), 1, 3, 1, 0)
end
end
--================================================================专属 寒霜风暴
local function _zhuanshu_hanshuangfengbao(actor)
local value = getbaseinfo(actor,51,222)
if value > 0 and math.random(1,100) <= 3 and getint(actor,"专属寒霜风暴CD") < os.time() then
setint(actor,"专属寒霜风暴CD",os.time() + 3)
releasemagic(actor, getskillindex("专属寒霜风暴"), 1, 3, 1, 0)
end
end
--================================================================专属 雷霆万钧
local function _zhuanshu_leitingwanjun(actor)
local value = getbaseinfo(actor,51,223)
if value > 0 and math.random(1,100) <= 3 and getint(actor,"专属雷霆万钧CD") < os.time() then
setint(actor,"专属雷霆万钧CD",os.time() + 3)
releasemagic(actor, getskillindex("专属雷霆万钧"), 1, 3, 1, 0)
end
end
--十步一杀麻痹抵抗
local function _processShiBuResist(actor)
local baseChance = getbaseinfo(actor,51,203)
local value = getbaseinfo(actor,51,227)
if value == 2 then
baseChance = baseChance + 25
elseif value > 0 then
baseChance = baseChance + 30
end
return math.random(1, 100) <= baseChance
end
--玉清套装麻痹配置
local levSpecAtt = {
--伤害提升(百分比)、麻痹概率增加万分比、麻痹时长、buff、持续时间(s)、buff属性加成
{30, 1000, 1, 0, 3},
{50, 1500, 1, 0, 3},
{80, 2000, 1, 0, 3},
{100, 3000, 1, 0, 3},
{120, 3000, 2, 0, 3},
{125, 3200, 2, 0, 3},
{130, 3400, 2, 0, 3},
{135, 3600, 2, 0, 3},
{140, 3800, 2, 0, 3},
{145, 4000, 2, 0, 3},
{150, 4500, 2, 30021, 3},
{155, 5000, 2, 30022, 3},
{160, 5500, 2, 30023, 3},
{165, 6000, 2, 30024, 3},
}
--十步一杀麻痹处理
local function _shibuMabichuli(actor,gongjizhe,shoujizhe,skillid,damage)
local rate = 1500
local mabiTime = 1
local level = getbaseinfo(gongjizhe, 51, 229)
if level > 0 and levSpecAtt[level] then
mabiTime = levSpecAtt[level][3]
rate = rate + levSpecAtt[level][2]
damage = damage * levSpecAtt[level][1] / 100 + damage
local buffid = levSpecAtt[level][4]
local bufftime = levSpecAtt[level][5]
addbuff(gongjizhe, buffid, bufftime, 1, actor)
end
if math.random(1,10000) <= rate then
if isplayer(shoujizhe) then
if not _processShiBuResist(shoujizhe) then
-- if not _check_mykz(shoujizhe, gongjizhe) and not _processShenZhuangZhuque(target, actor) then
if not _check_mykz(shoujizhe, gongjizhe) then
setMabi(shoujizhe, mabiTime, gongjizhe)
end
else
_effectNotice(shoujizhe, "抵抗对方十步一杀麻痹")
end
else
setMabi(shoujizhe, mabiTime, gongjizhe)
end
end
-- lualib:DelayCall(actor, 200, "delaystartautofight")
-- lualib:SetTempStr(actor, "灵器十步一杀释放", tostring(uicGetTimes64()))
return damage
end
--================================================================专属 龙啸苍穹
local function _zhuanshu_longxiaocangqiong(actor)
local value = getbaseinfo(actor,51,224)
if value > 0 and math.random(1,100) <= 3 and getint(actor,"专属龙啸苍穹CD") < os.time() then
setint(actor,"专属龙啸苍穹CD",os.time() + 3)
releasemagic(actor, getskillindex("专属龙啸苍穹"), 1, 3, 1, 0)
end
end
--================================================================专属 龙啸苍穹麻痹
local function _zhuangshu_longxiaomabi(actor, gongjizhe, shoujizhe)
if isplayer(shoujizhe) then
-- if not _check_mykz(target, actor) and not _processShenZhuangZhuque(target, actor) then
if not _check_mykz(shoujizhe, gongjizhe) then
setMabi(shoujizhe, 2, gongjizhe)
end
else
setMabi(shoujizhe, 2, gongjizhe)
end
end
--专属 女娲补天石减伤
local function _zhuanshu_nvwabutianshi(actor, gongjizhe,shoujizhe,skillid,damage)
local level = getbaseinfo(shoujizhe,51, 244)
if level > 0 and damage >= math.floor(getbaseinfo(shoujizhe,10) * 0.1) then
local nowTime = os.time()
if nowTime > getint(shoujizhe,"女娲补天石CD") then
setint(shoujizhe,"女娲补天石CD",os.time() + 30)
sendattackeff(shoujizhe, 200, 0, gongjizhe)
damage = math.floor(damage * 0.5)
return damage
end
end
return damage
end
--玩家吸血流程
local function _processSuckHp(actor, damage, targetIsPlayer, target, targetName)
local suckHpPct = lualib:Attr(actor, 206)
if suckHpPct < 0 then
return
end
local suckHpResist = 0
if targetIsPlayer then
--是玩家
suckHpResist = lualib:Attr(target, 207)
else
--是怪物
suckHpResist = GetMonsterExtraAtt(targetName, 207)
--行会副本动态抗吸血
if hhfb1_player_suckhp then
suckHpResist = hhfb1_player_suckhp(actor, targetName, suckHpResist)
end
end
suckHpPct = math.max(suckHpPct - suckHpResist, 0)
local damage = _shjm(target, damage, targetName,actor)
if suckHpPct < 0 then
return
end
_processHpRecover(actor, math.ceil(damage * suckHpPct / 100))
end
--受击前执行
function shoujiqianzhixing(actor,gongjizhe,shoujizhe,skillid,damage)
if ismon(gongjizhe) then
damage = _processMonDmgRec(actor,gongjizhe,shoujizhe,skillid,damage)
damage = _processMonDmgRecex(actor,gongjizhe,shoujizhe,skillid,damage)
end
damage = _zhuanshu_nvwabutianshi(actor, gongjizhe,shoujizhe,skillid,damage)
return damage
end
--攻击前执行
function gongjiqianzhixing(actor,shoujizhe,gongjizhe,skillid,damage,model)
if ismon(shoujizhe) then
_processMonSuckHp(actor)
damage =_zhuanshu_gudingshanghai(actor, damage)
end
_zhuanshu_bingpaoxiao(actor)
_zhuanshu_hanshuangfengbao(actor)
_zhuanshu_leitingwanjun(actor)
_zhuanshu_longxiaocangqiong(actor)
if skillid == getskillindex("烈火剑法") then
damage = _processmagicliehuo(actor,gongjizhe,shoujizhe,skillid,damage)
end
if skillid == getskillindex("十步一杀") then
_shibuMabichuli(actor,gongjizhe,shoujizhe,skillid,damage)
end
if skillid == getskillindex("专属烈火燎原") then
_playerSubHp(actor, gongjizhe, shoujizhe, damage, 119)
damage = 0
end
if skillid == getskillindex("专属冰咆哮") then
_playerSubHp(actor, gongjizhe, shoujizhe, damage, 120)
damage = 0
end
if skillid == getskillindex("专属寒霜风暴") then
_playerSubHp(actor, gongjizhe, shoujizhe, damage, 121)
local value = getbaseinfo(gongjizhe, 51, 222)
if value > 0 then
if math.random(1, 100) <= 10 then
if isplayer(shoujizhe) then
if not _check_mykz(shoujizhe, gongjizhe) then
setBingDong(shoujizhe, 1, gongjizhe)
end
else
setBingDong(shoujizhe, 1, gongjizhe)
end
end
end
damage = 0
end
if skillid == getskillindex("专属雷霆万钧") then
_playerSubHp(actor, gongjizhe, shoujizhe, damage, 122)
local value = getbaseinfo(gongjizhe, 51, 223)
if value > 1 then
--2级雷霆万钧 麻痹
if math.random(1, 100) <= 5 then
if isplayer(shoujizhe) then
-- if not _check_mykz(shoujizhe, gongjizhe) and not _processShenZhuangZhuque(shoujizhe, actor) then
if not _check_mykz(shoujizhe, gongjizhe) then
setMabi(shoujizhe, 1, gongjizhe)
end
else
setMabi(shoujizhe, 1, gongjizhe)
end
end
end
damage = 0
end
if skillid == getskillindex("专属龙啸苍穹") then
local level = getbaseinfo(gongjizhe, 51, 224)
local rate = 1
if level == 1 or not isplayer(shoujizhe) then
rate = math.random(1, 10)
if rate == 10 then
_zhuangshu_longxiaomabi(actor, gongjizhe, shoujizhe)
end
else
--在对生命值上限高于自身的玩家释放时会增加多倍龙啸的几率当目标生命值上限高于自身生命值上限100%时,达到最大几率。
local tPct = {
{25, 2, 10},
{50, 3, 10},
{75, 4, 10},
{100, 5, 10}
}
local maxHpS = getbaseinfo(gongjizhe, 10)
local maxHpT = getbaseinfo(shoujizhe, 10)
local value = maxHpT / maxHpS * 100 - 1
local function _getIndex()
for i = #tPct, 1, -1 do
if value >= tPct[i][1] then
return i
end
end
end
local index = _getIndex()
if index then
rate = math.random(tPct[index][2], tPct[index][3])
if rate == 10 then
_zhuangshu_longxiaomabi(actor, gongjizhe, shoujizhe)
end
end
end
_playerSubHp(actor, gongjizhe, shoujizhe, damage * rate, 108 + rate)
damage = 0
end
return damage
end