【战斗】=============添加新灵兽技能逻辑 放逐和麒麟印记

dev_chengFeng
wangzhenxing 2021-03-23 20:41:44 +08:00
parent 56d7244740
commit d0a7ef39ca
9 changed files with 167 additions and 25 deletions

View File

@ -5010,7 +5010,6 @@ local passivityList = {
local num = OutDataManager.GetOutData(role.camp,id)
LogError("舍利子数量 "..num)
if num >= 2 then
BattleUtil.AddProp(role, pro1, f1, ct1)
end
@ -5067,7 +5066,7 @@ local passivityList = {
-- 紫+橙
local num = OutDataManager.GetOutData(role.camp, id)
LogError("笔使用次数:"..num)
--LogError("笔使用次数:"..num)
num = min(maxNum, num)
BattleUtil.AddProp(role, pro1, f1 * num, ct1)
end,

View File

@ -283,7 +283,7 @@ function BattleLogic.CheckBattleLogic()
-- 自己阵营中的位置 + 自己阵营的ID * 6 = 自己在PosList中的位置
local role = RoleManager.GetRole(CurCamp, p) --PosList[p + (CurCamp * 6)]
--角色如果被放逐不能行动 by:wangzhenxing 2020/12/23 11:35
if role and not role:IsRealDead() then
if role and not role:IsRealDead() and not role.isExile then
SkillRole = role
break
end

View File

@ -0,0 +1,39 @@
Exile = Buff:New()
--初始化Buff通过传入一些自定义参数控制成长相关的数值
function Exile:SetData(...)
-- 刷新排序等级
self.sort = 4
end
--初始化后调用一次
function Exile:OnStart()
self.target.isExile = true
self.ownPassiveList = self.target.passiveList
self.target.passiveList=nil
if self.caster.exileTargets then
table.insert(self.caster.exileTargets,self.target)
end
end
--间隔N帧触发返回true时表示继续触发返回false立刻触发OnEnd
function Exile:OnTrigger()
return true
end
--效果结束时调用一次
function Exile:OnEnd()
self.target.isExile = false
self.target.passiveList=self.ownPassiveList
self.ownPassiveList=nil
end
--只有当cover字段为true时触发返回true则被新效果覆盖
function Exile:OnCover(newBuff)
return true
end
return Exile

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: fd888eae3d19efc42944d94187a8f19f
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,48 @@
KylinMark = Buff:New()
--初始化Buff通过传入一些自定义参数控制成长相关的数值
function KylinMark:SetData(...)
self.pro1,
self.pro2,
self.v1,
self.pro3 = ...
-- 刷新排序等级
self.sort = 4
end
function KylinMark:roleTurnStar(role)
BattleUtil.RandomAction(self.pro1, function ()
local dd = floor(BattleUtil.ErrorCorrection(role:GetRoleData(BattlePropList[self.pro2])*self.v1))
BattleUtil.ApplyDamage(self.caster,self.target, dd)
end)
--概率消失
BattleUtil.RandomAction(self.pro3, function ()
self.disperse=true
end)
end
--初始化后调用一次
function KylinMark:OnStart()
self.target.Event:AddEvent(BattleEventName.RoleTurnStart,self.roleTurnStar)
end
--间隔N帧触发返回true时表示继续触发返回false立刻触发OnEnd
function KylinMark:OnTrigger()
return true
end
--效果结束时调用一次
function KylinMark:OnEnd()
self.target.Event:RemoveEvent(BattleEventName.RoleTurnStart,self.roleTurnStar)
end
--只有当cover字段为true时触发返回true则被新效果覆盖
function KylinMark:OnCover(newBuff)
return true
end
return KylinMark

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: d7190f33d3e8c7b44a1c0bf98dfb7db9
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -34,7 +34,8 @@ end
function BattleUtil.ChooseFRow(arr)
local tempArr = {}
for _, r in ipairs(arr) do
if r.position <= 3 and not r:IsRealDead() then
--不是放逐
if r.position <= 3 and not r:IsRealDead() and not r.isExile then
table.insert(tempArr, r)
end
end
@ -47,7 +48,7 @@ end
function BattleUtil.ChooseBRow(arr)
local tempArr = {}
for _, r in ipairs(arr) do
if r.position > 3 and not r:IsRealDead() then
if r.position > 3 and not r:IsRealDead() and not r.isExile then
table.insert(tempArr, r)
end
end
@ -60,7 +61,7 @@ end
function BattleUtil.ChooseCol(arr, col)
local tempArr = {}
for _, role in ipairs(arr) do
if role.position % 3 == col then
if role.position % 3 == col and not role.isExile then
table.insert(tempArr, role)
end
end
@ -267,7 +268,7 @@ function BattleUtil.ChooseTarget(role, chooseId)
if chooseType == 1 then
arr = RoleManager.Query(function (r) return r.camp == role.camp end)
elseif chooseType == 2 then
if role.lockTarget and not role.lockTarget:IsRealDead() and num == 1 then --嘲讽时对单个敌军生效
if role.lockTarget and not role.lockTarget:IsRealDead() and not role.lockTarget.isExile and num == 1 then --嘲讽时对单个敌军生效
return {role.lockTarget}
end
arr = RoleManager.Query(function (r) return r.camp ~= role.camp end)
@ -279,7 +280,7 @@ function BattleUtil.ChooseTarget(role, chooseId)
end
return {role}
elseif chooseType == 4 then
if role.lockTarget and not role.lockTarget:IsRealDead() then --嘲讽时对仇恨目标生效
if role.lockTarget and not role.lockTarget:IsRealDead() and not role.lockTarget.isExile then --嘲讽时对仇恨目标生效
return {role.lockTarget}
end
if role.ctrl_blind then --致盲时仇恨目标变随机
@ -373,8 +374,24 @@ function BattleUtil.ChooseTarget(role, chooseId)
-- local r2 = math.abs(role.position - b.position) * 10 + b.position
-- if sort == 1 then return r1 > r2 else return r1 < r2 end
-- end)
elseif chooseWeight == 9 then --血量百分比->血量
BattleUtil.SortByHpFactorAndHp(arr,sort)
elseif chooseWeight ==9 then --攻击最高且没被放逐过
local list=role.exileTargets
if list then
BattleUtil.SortByProp(arr,RoleDataName.Attack,sort)
for i = 1, #arr do
if not arr[i].isExile and not arr[i]:IsDead() and not BattleUtil:ChecklistIsContainValue(list,arr[i]) then
return arr[i]
end
end
end
elseif chooseWeight ==10 then --剩余血量百分比低于25%且生命绝对值最小
return BattleUtil.GetHpPctLessThanPctHero(arr,0.25)
elseif chooseWeight ==11 then --剩余血量百分比低于32%且生命绝对值最小
return BattleUtil.GetHpPctLessThanPctHero(arr,0.32)
elseif chooseWeight ==12 then --剩余血量百分比低于40%且生命绝对值最小
return BattleUtil.GetHpPctLessThanPctHero(arr,0.40)
elseif chooseWeight ==13 then --剩余血量百分比低于50%且生命绝对值最小
return BattleUtil.GetHpPctLessThanPctHero(arr,0.50)
end
local finalArr = {}
if num == 0 then
@ -393,6 +410,29 @@ function BattleUtil.ChooseTarget(role, chooseId)
return finalArr
end
--获取生命百分比少于指定百分比且生命置最少
function BattleUtil.GetHpPctLessThanPctHero(arr,pct)
local hp=0
local hero=nil
for i = 1, #arr[i] do
local aaa=arr[i]
local curHp=aaa:GetRoleData(RoleDataName.Hp)
local r1 = curHp / aaa:GetRoleData(RoleDataName.MaxHp)
if r1<pct then
if hero==nil then
hero=aaa
hp=curHp
else
if curHp<hp then
hero=aaa
hp=curHp
end
end
end
end
return hero
end
function BattleUtil.CreateBuffId(skill, index)
@ -507,7 +547,6 @@ function BattleUtil.SeckillHP(skill, atkRole, defRole, pro)
defRole.Event:DispatchEvent(BattleEventName.RoleDead, atkRole)
atkRole.Event:DispatchEvent(BattleEventName.RoleKill, defRole,skill)
BattleLogic.Event:DispatchEvent(BattleEventName.BattleRoleDead, defRole, atkRole)
atkRole.Event:DispatchEvent(BattleEventName.Seckill, defRole)
defRole.Event:DispatchEvent(BattleEventName.BeSeckill, atkRole)
BattleLogic.Event:DispatchEvent(BattleEventName.Seckill, atkRole, defRole)

View File

@ -23,7 +23,7 @@ function Monster:Init(data)
self.data:Init(self, data.property)
self.buffFilter:Clear() --buff屏蔽列表
self.Event:ClearEvent()
self.exileTargets={}--已经被放逐过的目标
self.skillGroup = MSkillManager.CreateMSkillGroup(self, data.skill)
end

View File

@ -131,9 +131,12 @@ end
-- 获取某阵营所有角色
function this.GetRoleByCamp(camp)
local list = {}
--放逐的不会被获取到
for i = 1, 6 do
if not list[i].isExile then
list[i] = PosList[i + camp * 6]
end
end
return list
end
@ -143,7 +146,7 @@ function RoleManager.Query(func, inCludeDeadRole)
local index = 1
if func then
for pos, v in pairs(PosList) do
if func(v) and (inCludeDeadRole or not v:IsRealDead()) then
if func(v) and (inCludeDeadRole or not v:IsRealDead())and not v.isExile then
list[index] = v
index = index + 1
end
@ -160,7 +163,7 @@ function RoleManager.QueryNoDead(func)
local index = 1
if func then
for pos, v in pairs(PosList) do
if func(v) and not v:IsRealDead() and v.deadFilter then
if func(v) and not v:IsRealDead() and v.deadFilter and not v.isExile then
list[index] = v
index = index + 1
end
@ -177,7 +180,7 @@ function RoleManager.NoOrder(func)
local index = 1
if func then
for pos, v in pairs(PosList) do
if func(v) and not v:IsRealDead() and v.deadFilter then
if func(v) and not v:IsRealDead() and v.deadFilter and not v.isExile then
list[index] = v
index = index + 1
end
@ -201,7 +204,7 @@ function this.GetAggro(role)
-- 向左
for i = startPos, c*3+1, -1 do
local pos = i + enemyCamp * 6
if PosList[pos] and not PosList[pos]:IsRealDead() then
if PosList[pos] and not PosList[pos]:IsRealDead() and not PosList[pos].isExile then
target = PosList[pos]
break
end
@ -210,7 +213,7 @@ function this.GetAggro(role)
-- 向右
for i = startPos + 1, c*3+3 do
local pos = i + enemyCamp * 6
if PosList[pos] and not PosList[pos]:IsRealDead() then
if PosList[pos] and not PosList[pos]:IsRealDead() and not PosList[pos].isExile then
target = PosList[pos]
break
end
@ -233,7 +236,7 @@ function this.GetAliveAggro(role)
-- 向左
for i = startPos, c*3+1, -1 do
local pos = i + enemyCamp * 6
if PosList[pos] and not PosList[pos]:IsDead() then
if PosList[pos] and not PosList[pos]:IsDead() and not PosList[pos].isExile then
target = PosList[pos]
break
end
@ -242,7 +245,7 @@ function this.GetAliveAggro(role)
-- 向右
for i = startPos + 1, c*3+3 do
local pos = i + enemyCamp * 6
if PosList[pos] and not PosList[pos]:IsDead() then
if PosList[pos] and not PosList[pos]:IsDead() and not PosList[pos].isExile then
target = PosList[pos]
break
end
@ -267,14 +270,14 @@ function this.GetArrAggroList(role, arr)
-- 向左
for i = startPos, c*3+1, -1 do
local pos = i
if plist[pos] and not plist[pos]:IsRealDead() then
if plist[pos] and not plist[pos]:IsRealDead() and not plist[pos].isExile then
table.insert(targetList, plist[pos])
end
end
-- 向右
for i = startPos + 1, c*3+3 do
local pos = i
if plist[pos] and not plist[pos]:IsRealDead() then
if plist[pos] and not plist[pos]:IsRealDead() and not plist[pos].isExile then
table.insert(targetList, plist[pos])
end
end
@ -312,7 +315,7 @@ function this.GetNeighbor(role, chooseType)
if chooseType == 1 then
target = role
else
if role.lockTarget and not role.lockTarget:IsRealDead() then
if role.lockTarget and not role.lockTarget:IsRealDead() and not role.isExile then
target = role.lockTarget
else
target = this.GetAggro(role)
@ -321,7 +324,7 @@ function this.GetNeighbor(role, chooseType)
if target then
local list = this.Query(function (r) return r.camp == target.camp end)
for i=1, #list do
if not list[i]:IsRealDead() then
if not list[i]:IsRealDead() and not list[i].isExile then
if list[i].position == target.position + 3 -- 后排的人
or list[i].position == target.position - 3 -- 前排的人
or (math.abs(target.position - list[i].position) <= 1 and math.floor((target.position-1)/3) == math.floor((list[i].position-1)/3)) then -- 旁边的人和自己