diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua index 1f786cf6db..dd794a9a6d 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua @@ -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, diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/BattleLogic.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/BattleLogic.lua index def6731c2f..ef2e1f797c 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/BattleLogic.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/BattleLogic.lua @@ -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 diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Buff/Exile.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Buff/Exile.lua new file mode 100644 index 0000000000..18ecaa5403 --- /dev/null +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Buff/Exile.lua @@ -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 \ No newline at end of file diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Buff/Exile.lua.meta b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Buff/Exile.lua.meta new file mode 100644 index 0000000000..07de27efdf --- /dev/null +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Buff/Exile.lua.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: fd888eae3d19efc42944d94187a8f19f +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Buff/KylinMark.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Buff/KylinMark.lua new file mode 100644 index 0000000000..3bd06e2390 --- /dev/null +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Buff/KylinMark.lua @@ -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 \ No newline at end of file diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Buff/KylinMark.lua.meta b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Buff/KylinMark.lua.meta new file mode 100644 index 0000000000..0a909eb813 --- /dev/null +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Buff/KylinMark.lua.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: d7190f33d3e8c7b44a1c0bf98dfb7db9 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleUtil.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleUtil.lua index dbf05ce36e..b81c442d10 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleUtil.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleUtil.lua @@ -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 --致盲时仇恨目标变随机 @@ -372,9 +373,25 @@ function BattleUtil.ChooseTarget(role, chooseId) -- local r1 = math.abs(role.position - a.position) * 10 + a.position -- 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) + -- end) + 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