斩首=直接斩杀血量低于5%/10%/20%的怪物
禁锢=攻击时有概率让对手禁锢1/2/5秒
蛛网=攻击时有概率让对方被蛛网笼罩1/2/5秒
剧毒=攻击时有概率让对方中毒3/8/20秒
灵活=受到攻击伤害时,有5%/10%/20%的概率吸收99%的伤害!
下面贴代码:
- --使用技能回调
- function tiancai_DoSpellSkill(Actor,TagActor,MagicID)
- local actorname = Actor:getCharName()
- local TagActorName = TagActor:getCharName()
- local Olook = TagActor:getRace()
- local Ulook = Actor:getRace()
- local Ueee = 0
- local u
- local uh
- local buff = "高级剧毒|高级蛛网|中级禁锢|高级斩首" --实装中这里的buff列表肯定从玩家变量中获取,我这里写死是假设该玩家有这些buff
- --如若触发本体是宝宝的话,那么将操作对象转换为本体
- if Ulook == 66 then
- u = s.obj.getPlayer(Actor:getMasterName())
- uh = s.obj.getHero(u:getCharName())
- end
-
- --统一操作对象
- if Ulook == 0 then
- u = Actor
- uh = s.obj.getHero(u:getCharName())
- end
-
- --剧毒buff
- if ini_zfcss(buff,"剧毒") then
- if ini_zfcss(buff,"高级剧毒") > 0 then
- if math.random(1,100) < 10 then
- TagActor:setActorStatus(4,20)
- u:sendMsg(2,"剧毒buff生效,对手中毒20秒", -1, -1)
- end
- end
- if ini_zfcss(buff,"中级剧毒") > 0 then
- if math.random(1,100) < 10 then
- TagActor:setActorStatus(4,10)
- u:sendMsg(2,"剧毒buff生效,对手中毒10秒", -1, -1)
- end
- end
- if ini_zfcss(buff,"初级剧毒") > 0 then
- if math.random(1,100) < 10 then
- TagActor:setActorStatus(4,5)
- u:sendMsg(2,"剧毒buff生效,对手中毒5秒", -1, -1)
- end
- end
- end
- --蛛网buff
- if ini_zfcss(buff,"蛛网") then
- if ini_zfcss(buff,"高级蛛网") > 0 then
- if math.random(1,100) < 10 then
- TagActor:setActorStatus(3,5)
- u:sendMsg(2,"蛛网buff生效,对手减速5秒", -1, -1)
- end
- end
- if ini_zfcss(buff,"中级蛛网") > 0 then
- if math.random(1,100) < 10 then
- TagActor:setActorStatus(3,2)
- u:sendMsg(2,"蛛网buff生效,对手减速2秒", -1, -1)
- end
- end
- if ini_zfcss(buff,"初级蛛网") > 0 then
- if math.random(1,100) < 10 then
- TagActor:setActorStatus(3,1)
- u:sendMsg(2,"蛛网buff生效,对手减速1秒", -1, -1)
- end
- end
- end
- --禁锢buff
- if ini_zfcss(buff,"禁锢") then
- if ini_zfcss(buff,"高级禁锢") > 0 then
- if math.random(1,100) < 10 then
- TagActor:setActorStatus(1,5)
- u:sendMsg(2,"禁锢buff生效,对手定身5秒", -1, -1)
- end
- end
- if ini_zfcss(buff,"中级禁锢") > 0 then
- if math.random(1,100) < 10 then
- TagActor:setActorStatus(1,2)
- u:sendMsg(2,"禁锢buff生效,对手定身2秒", -1, -1)
- end
- end
- if ini_zfcss(buff,"初级禁锢") > 0 then
- if math.random(1,100) < 10 then
- TagActor:setActorStatus(1,1)
- u:sendMsg(2,"禁锢buff生效,对手定身1秒", -1, -1)
- end
- end
- end
- --斩首buff
- if not in_array(Olook,{0,66}) then
- if ini_zfcss(buff,"斩首") > 0 then
- local omaxhp = TagActor:getMaxHp()
- local ohp = TagActor:getHp()
- local ohpf = math.round(ohp / omaxhp * 100)
- print("怪物剩余百分百血量:"..ohpf.." 他的血量"..omaxhp.."-"..ohp)
- if ini_zfcss(buff,"高级斩首") > 0 then
- if ohpf < 20 then
- TagActor:setHp(0)
- u:sendMsg(2,"高级斩首buff生效,直接斩杀"..TagActorName..ohp.."血量!", -1, -1)
- end
- end
- if ini_zfcss(buff,"中级斩首") > 0 then
- if ohpf < 10 then
- TagActor:setHp(0)
- u:sendMsg(2,"中级斩首buff生效,直接斩杀"..TagActorName..ohp.."血量!", -1, -1)
- end
- end
- if ini_zfcss(buff,"初级斩首") > 0 then
- if ohpf < 5 then
- TagActor:setHp(0)
- u:sendMsg(2,"初级斩首buff生效,直接斩杀"..TagActorName..ohp.."血量!", -1, -1)
- end
- end
- end
- end
-
- end
- --角色受到伤害时触发(返回指定伤害数值)
- function tiancai_shoushang(actor,nPoint)
- local actorname = actor:getCharName()
- local Ulook = actor:getRace()
- local u
- local uh
- local buff = "高级剧毒|高级蛛网|中级禁锢|高级灵活" --实装中这里的buff列表肯定从玩家变量中获取,我这里写死是假设该玩家有这些buff
- local upo = math.round(nPoint / 100)
- local upox = 0
- --如若触发本体是宝宝的话,那么将操作对象转换为本体
- if Ulook == 66 then
- u = s.obj.getPlayer(actor:getMasterName())
- uh = s.obj.getHero(u:getCharName())
- end
-
- --统一操作对象
- if Ulook == 0 then
- u = actor
- uh = s.obj.getHero(u:getCharName())
- end
-
- --人物或者宝宝才能执行
- if in_array(Ulook,{0,66}) then
- if ini_zfcss(buff,"灵活") > 999 then
- if ini_zfcss(buff,"高级灵活") > 0 then
- if math.random(1,100) < 20 then
- upox = upo * 99
- u:sendMsg(2,"高级灵活buff生效,本次吸收99%("..upox..")点伤害", -1, -1)
- end
- end
- if ini_zfcss(buff,"中级灵活") > 0 then
- if math.random(1,100) < 10 then
- upox = upo * 99
- u:sendMsg(2,"中级灵活buff生效,本次吸收99%("..upox..")点伤害", -1, -1)
- end
- end
- if ini_zfcss(buff,"初级灵活") > 0 then
- if math.random(1,100) < 5 then
- upox = upo * 99
- u:sendMsg(2,"初级灵活buff生效,本次吸收99%("..upox..")点伤害", -1, -1)
- end
- end
- end
- end
- nPoint = nPoint - upox
- print("扣血回调:"..nPoint)
- return nPoint
- end
- --数组检测
- function in_array(b,list)
- if not list then
- return false
- end
- if list then
- for _, v in pairs(list) do
- if v == b then
- return true
- end
- end
- return false
- end
- end
- --字符串检测
- function ini_zfcss(str,str1)
- if string.find(str,str1) ~= nil then
- return string.find(str,str1)
- else
- return 0
- end
- end
复制代码
脚本写完没整理,可能会有一些问题,诸如执行完中级的buff后还会继续执行等状况,自己加个判断就好了! 还是同样的话,代码贴出来只是开阔思路,用类似的方法可以让大家写出更优秀的东西,更有效的促进HGE发展的脚步!
|