【战斗统计】第一版
parent
dda2e859c6
commit
6f386e1b52
File diff suppressed because it is too large
Load Diff
|
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1970efa5bf1e564409b6e2543edf6210
|
||||
guid: bdd2cb22c07575143b3673c859f70c21
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
|
|
|||
|
|
@ -0,0 +1,161 @@
|
|||
BattleAnalysisManager = {}
|
||||
|
||||
function BattleAnalysisManager:Init()
|
||||
self.data = {}
|
||||
self.mdata = {}
|
||||
|
||||
BattleLogic.Event:AddEvent(BattleEventName.RecordDamage, self.OnRecordDamage, self)
|
||||
BattleLogic.Event:AddEvent(BattleEventName.RecordTreat, self.OnRecordTreat, self)
|
||||
BattleLogic.Event:AddEvent(BattleEventName.RecordRage, self.OnRecordRage, self)
|
||||
BattleLogic.Event:AddEvent(BattleEventName.RecordTransRage, self.OnRecordTransRage, self)
|
||||
BattleLogic.Event:AddEvent(BattleEventName.RecordBuff, self.OnRecordBuff, self)
|
||||
BattleLogic.Event:AddEvent(BattleEventName.RecordSecKill, self.OnRecordSecKill, self)
|
||||
|
||||
BattleLogic.Event:AddEvent(BattleEventName.AddRole, self.OnAddRole, self)
|
||||
BattleLogic.Event:AddEvent(BattleEventName.AddMonster, self.OnAddMonster, self)
|
||||
|
||||
end
|
||||
|
||||
-- 获取分析后的数据
|
||||
function BattleAnalysisManager:GetAnalysisData()
|
||||
-- for pos, role in pairs(self.data) do
|
||||
-- print("角色:", pos)
|
||||
-- for pro, data in pairs(role) do
|
||||
-- if pro == "buff" then
|
||||
-- for id, count in pairs(data) do
|
||||
-- print("buff", id, count)
|
||||
-- end
|
||||
-- else
|
||||
-- print(pro, data)
|
||||
-- end
|
||||
-- end
|
||||
-- end
|
||||
|
||||
-- for pos, role in pairs(self.mdata) do
|
||||
-- print("角色:", pos)
|
||||
-- for pro, data in pairs(role) do
|
||||
-- if pro == "buff" then
|
||||
-- for id, count in pairs(data) do
|
||||
-- print("buff", id, count)
|
||||
-- end
|
||||
-- else
|
||||
-- print(pro, data)
|
||||
-- end
|
||||
-- end
|
||||
-- end
|
||||
return self.data, self.mdata
|
||||
end
|
||||
|
||||
-- 获取要记录的数据
|
||||
function BattleAnalysisManager:GetRecordData(role)
|
||||
local data = {}
|
||||
if role.type == BattleUnitType.Role then
|
||||
data = self.data
|
||||
elseif role.type == BattleUnitType.Monster then
|
||||
data = self.mdata
|
||||
end
|
||||
local pos = role.position
|
||||
local camp = role.camp
|
||||
local index = role.camp * 6 + pos
|
||||
if not data[index] then
|
||||
data[index] = {damage = 0, treat = 0}
|
||||
end
|
||||
return data[index]
|
||||
end
|
||||
|
||||
|
||||
function BattleAnalysisManager:OnAddRole(role)
|
||||
local data = self:GetRecordData(role)
|
||||
data.info = role
|
||||
end
|
||||
function BattleAnalysisManager:OnAddMonster(monster)
|
||||
local data = self:GetRecordData(monster)
|
||||
data.info = monster
|
||||
end
|
||||
|
||||
-- 伤害计算
|
||||
function BattleAnalysisManager:OnRecordDamage(castRole, targetRole, damage)
|
||||
local data = self:GetRecordData(castRole)
|
||||
if not data.damage then
|
||||
data.damage = 0
|
||||
end
|
||||
data.damage = data.damage + damage
|
||||
end
|
||||
|
||||
-- 治疗量
|
||||
function BattleAnalysisManager:OnRecordTreat(castRole, targetRole, treat)
|
||||
local data = self:GetRecordData(castRole)
|
||||
if not data.treat then
|
||||
data.treat = 0
|
||||
end
|
||||
data.treat = data.treat + treat
|
||||
end
|
||||
|
||||
-- 怒气改变
|
||||
function BattleAnalysisManager:OnRecordRage(castRole, targetRole, delta)
|
||||
local data = self:GetRecordData(castRole)
|
||||
if delta > 0 then -- 加怒
|
||||
if not data.addRage then
|
||||
data.addRage = 0
|
||||
end
|
||||
data.addRage = data.addRage + delta
|
||||
elseif delta < 0 then -- 减怒
|
||||
if not data.subRage then
|
||||
data.subRage = 0
|
||||
end
|
||||
data.subRage = data.subRage + math.abs(delta)
|
||||
end
|
||||
end
|
||||
|
||||
-- 转移怒气(精卫借怒)
|
||||
function BattleAnalysisManager:OnRecordTransRage(castRole, targetRole, delta)
|
||||
local data = self:GetRecordData(castRole)
|
||||
if not data.transRage then
|
||||
data.transRage = 0
|
||||
end
|
||||
data.transRage = data.transRage + delta
|
||||
end
|
||||
|
||||
-- buff计算
|
||||
function BattleAnalysisManager:OnRecordBuff(castRole, targetRole, buff)
|
||||
local data = self:GetRecordData(castRole)
|
||||
if not data.buff then
|
||||
data.buff = {}
|
||||
end
|
||||
local id = buff.type * 100
|
||||
if buff.type == BuffName.Control then -- 控制类
|
||||
id = id + buff.ctrlType
|
||||
elseif buff.type == BuffName.Shield then -- 盾
|
||||
id = id + buff.shieldType
|
||||
elseif buff.type == BuffName.Curse then -- 连接符
|
||||
id = id + 1
|
||||
end
|
||||
if not data.buff[id] then
|
||||
data.buff[id] = 0
|
||||
end
|
||||
data.buff[id] = data.buff[id] + 1
|
||||
end
|
||||
|
||||
-- 斩杀次数计算
|
||||
function BattleAnalysisManager:OnRecordSecKill(castRole, targetRole)
|
||||
local data = self:GetRecordData(castRole)
|
||||
if not data.secKill then
|
||||
data.secKill = 0
|
||||
end
|
||||
data.secKill = data.secKill + 1
|
||||
end
|
||||
|
||||
function BattleAnalysisManager:Clear()
|
||||
BattleLogic.Event:RemoveEvent(BattleEventName.RecordDamage, self.OnRecordDamage, self)
|
||||
BattleLogic.Event:RemoveEvent(BattleEventName.RecordTreat, self.OnRecordTreat, self)
|
||||
BattleLogic.Event:RemoveEvent(BattleEventName.RecordRage, self.OnRecordRage, self)
|
||||
BattleLogic.Event:RemoveEvent(BattleEventName.RecordTransRage, self.OnRecordTransRage, self)
|
||||
BattleLogic.Event:RemoveEvent(BattleEventName.RecordBuff, self.OnRecordBuff, self)
|
||||
BattleLogic.Event:RemoveEvent(BattleEventName.RecordSecKill, self.OnRecordSecKill, self)
|
||||
|
||||
BattleLogic.Event:RemoveEvent(BattleEventName.AddRole, self.OnAddRole, self)
|
||||
BattleLogic.Event:RemoveEvent(BattleEventName.AddMonster, self.OnAddMonster, self)
|
||||
end
|
||||
|
||||
|
||||
return BattleAnalysisManager
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9fca8a32e71f6ef4e8c9e3b809ad5b68
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
BattleRecordManager = {}
|
||||
require("Modules.Battle.BattleAnalysisManager")
|
||||
BattleRecordManager = {}
|
||||
local this = BattleRecordManager
|
||||
|
||||
local BattleRecordList = {}
|
||||
|
|
@ -87,37 +88,25 @@ function this.GetBattleRecord(Id)
|
|||
BattleLogic.Init(fightData, userData, fightMaxRound)
|
||||
BattleLogic.Type = battleType
|
||||
|
||||
BattleLogic.Event:AddEvent(BattleEventName.AddRole, function (role)
|
||||
local record = {}
|
||||
record.uid = role.uid
|
||||
record.roleId = role.roleData.roleId
|
||||
record.monsterId = role.roleData.monsterId
|
||||
record.roleLv = role:GetRoleData(RoleDataName.Level)
|
||||
record.camp = role.camp
|
||||
record.skinId=role.roleData.skinId
|
||||
record.damage = 0
|
||||
record.heal = 0
|
||||
record.type = 0
|
||||
record.order = BattleLogic.CurOrder
|
||||
role.Event:AddEvent(BattleEventName.RoleDamage, function (defRole, damage, bCrit, finalDmg)
|
||||
record.damage = record.damage + finalDmg
|
||||
end)
|
||||
role.Event:AddEvent(BattleEventName.RoleTreat, function (targetRole, treat)
|
||||
record.heal = record.heal + treat
|
||||
end)
|
||||
battleRecord[role.uid] = record
|
||||
end)
|
||||
|
||||
-- 初始化战斗分析
|
||||
BattleAnalysisManager:Init()
|
||||
-- 开始战斗
|
||||
BattleLogic.StartOrder()
|
||||
while not BattleLogic.IsEnd do
|
||||
BattleLogic.Update()
|
||||
end
|
||||
-- 获取战斗分析数据
|
||||
local data, mdata = BattleAnalysisManager:GetAnalysisData()
|
||||
battleRecord.data = data
|
||||
battleRecord.mdata = mdata
|
||||
BattleAnalysisManager:Clear()
|
||||
--Log("客户端战斗统计------------")
|
||||
--for k,v in pairs(battleRecord) do
|
||||
-- Log("uid:"..k)
|
||||
-- Log("order = "..v.order.." camp = "..v.camp.." roleId = "..v.roleId.." monsterId = "..(v.monsterId or "nil").." roleLv = "..v.roleLv .." damage:"..v.damage.." heal:"..v.heal)
|
||||
--end
|
||||
record.result = BattleLogic.Result
|
||||
battleRecord.result = BattleLogic.Result
|
||||
return battleRecord
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -2,10 +2,26 @@
|
|||
local floor = math.floor
|
||||
local buffPoolList = {}
|
||||
|
||||
local BuffRegister = {
|
||||
[BuffName.PropertyChange] = "PropertyChange",
|
||||
[BuffName.Control] = "Control",
|
||||
[BuffName.DOT] = "DOT",
|
||||
[BuffName.HOT] = "HOT",
|
||||
[BuffName.Shield] = "Shield",
|
||||
[BuffName.Immune] = "Immune",
|
||||
[BuffName.Curse] = "Curse",
|
||||
[BuffName.KylinMark] = "KylinMark",
|
||||
[BuffName.Exile] = "Exile",
|
||||
[BuffName.NoDead] = "NoDead",
|
||||
[BuffName.Aura] = "Aura",
|
||||
[BuffName.Brand] = "Brand",
|
||||
}
|
||||
|
||||
|
||||
local getBuff = function(type)
|
||||
if not buffPoolList[type] then
|
||||
buffPoolList[type] = BattleObjectPool.New(function (type)
|
||||
return require("Modules/Battle/Logic/Buff/"..type):New()
|
||||
return require("Modules/Battle/Logic/Buff/"..BuffRegister[type]):New()
|
||||
end)
|
||||
end
|
||||
return buffPoolList[type]:Get(type)
|
||||
|
|
@ -152,6 +168,8 @@ function BuffManager:AddBuff(target, buff)
|
|||
buff.roundDuration = buff.duration
|
||||
buff.roundInterval = buff.interval
|
||||
buff.caster.Event:DispatchEvent(BattleEventName.BuffCaster, buff)
|
||||
-- 用于记录统计
|
||||
BattleLogic.Event:DispatchEvent(BattleEventName.RecordBuff, buff.caster, buff.target, buff)
|
||||
end
|
||||
|
||||
function BuffManager:QueryBuff(target, checkFunc)
|
||||
|
|
|
|||
|
|
@ -1932,7 +1932,7 @@ local effectList = {
|
|||
local i1 = args[2]
|
||||
-- caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, skill, target)
|
||||
BattleLogic.WaitForTrigger(interval, function ()
|
||||
target:AddRage(i1, ct)
|
||||
BattleUtil.CalRage(caster, target, i1, ct)
|
||||
end)
|
||||
end,
|
||||
|
||||
|
|
@ -2259,7 +2259,7 @@ local effectList = {
|
|||
|
||||
BattleLogic.WaitForTrigger(interval, function ()
|
||||
BattleUtil.RandomAction(f1, function()
|
||||
target:AddRage(i1, ct)
|
||||
BattleUtil.CalRage(caster, target, i1, ct)
|
||||
end)
|
||||
end)
|
||||
end,
|
||||
|
|
|
|||
|
|
@ -1569,7 +1569,7 @@ local passivityList = {
|
|||
-- buff.clear = false -- 不可驱散
|
||||
-- role:AddBuff(buff)
|
||||
if skill and not skill.isAdd and defRole:IsDead() and not BattleUtil.CheckIsNoDead(defRole) then
|
||||
role:AddRage(i1, CountTypeName.Add)
|
||||
BattleUtil.CalRage(role, role, i1, CountTypeName.Add)
|
||||
end
|
||||
end
|
||||
role.Event:AddEvent(BattleEventName.RoleHit, OnRoleHit)
|
||||
|
|
@ -1615,7 +1615,7 @@ local passivityList = {
|
|||
local i1 = args[1]
|
||||
-- 行动结束后
|
||||
local onTurnEnd = function()
|
||||
role:AddRage(i1, CountTypeName.Add)
|
||||
BattleUtil.CalRage(role, role, i1, CountTypeName.Add)
|
||||
end
|
||||
role.Event:AddEvent(BattleEventName.RoleTurnEnd, onTurnEnd)
|
||||
end,
|
||||
|
|
@ -1833,7 +1833,7 @@ local passivityList = {
|
|||
local list = RoleManager.Query(function(v) return v.camp == role.camp end)
|
||||
for i = 1, #list do
|
||||
local r = list[i]
|
||||
r:AddRage(i1, CountTypeName.Add)
|
||||
BattleUtil.CalRage(role, r, i1, CountTypeName.Add)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1869,7 +1869,7 @@ local passivityList = {
|
|||
-- 释放技能后
|
||||
local onSkillEnd = function(skill)
|
||||
if skill.type == BattleSkillType.Special then
|
||||
role:AddRage(i1, CountTypeName.Add)
|
||||
BattleUtil.CalRage(role, role, i1, CountTypeName.Add)
|
||||
end
|
||||
end
|
||||
role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
|
||||
|
|
@ -1913,7 +1913,7 @@ local passivityList = {
|
|||
local onBeSkillCastEnd = function(skill)
|
||||
--同阵营普工加血不触发被动
|
||||
if skill.type == BattleSkillType.Normal and skill.owner and skill.owner.camp~=role.camp then
|
||||
role:AddRage(i1, CountTypeName.Add)
|
||||
BattleUtil.CalRage(role, role, i1, CountTypeName.Add)
|
||||
end
|
||||
end
|
||||
role.Event:AddEvent(BattleEventName.BeSkillCastEnd, onBeSkillCastEnd)
|
||||
|
|
@ -1929,7 +1929,7 @@ local passivityList = {
|
|||
local list = skill:GetDirectTargetsNoMiss()
|
||||
if list then
|
||||
for i = 1, #list do
|
||||
list[i]:AddRage(i1, CountTypeName.Sub)
|
||||
BattleUtil.CalRage(role, list[i], i1, CountTypeName.Sub)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -2162,7 +2162,7 @@ local passivityList = {
|
|||
-- 释放技能后
|
||||
local onSkillEnd = function(skill)
|
||||
if skill.type == BattleSkillType.Normal then
|
||||
role:AddRage(i1, CountTypeName.Add)
|
||||
BattleUtil.CalRage(role, role, i1, CountTypeName.Add)
|
||||
end
|
||||
end
|
||||
role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
|
||||
|
|
@ -2221,7 +2221,7 @@ local passivityList = {
|
|||
if skill.type == BattleSkillType.Special then
|
||||
local list = RoleManager.Query(function(v) return v.position > 3 and v.camp==role.camp end)
|
||||
for _, r in ipairs(list) do
|
||||
r:AddRage(i1, CountTypeName.Add)
|
||||
BattleUtil.CalRage(role, r, i1, CountTypeName.Add)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -2283,7 +2283,7 @@ local passivityList = {
|
|||
local list = skill:GetDirectTargetsNoMiss()
|
||||
if list then
|
||||
for _, r in ipairs(list) do
|
||||
r:AddRage(i1, CountTypeName.Sub)
|
||||
BattleUtil.CalRage(role, r, i1, CountTypeName.Sub)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -2931,7 +2931,7 @@ local passivityList = {
|
|||
return
|
||||
end
|
||||
if target:IsDead() and not BattleUtil.CheckIsNoDead(target) then
|
||||
role:AddRage(i1, CountTypeName.Add)
|
||||
BattleUtil.CalRage(role, role, i1, CountTypeName.Add)
|
||||
-- 回血
|
||||
if p1 and v1 then
|
||||
local dd = floor(BattleUtil.ErrorCorrection(role:GetRoleData(BattlePropList[p1])*v1))
|
||||
|
|
@ -2989,7 +2989,7 @@ local passivityList = {
|
|||
local onBeSkillCastEnd = function(skill)
|
||||
--同阵营给自己普攻加血不扣除怒气
|
||||
if skill.owner.camp~=role.camp and skill.type == BattleSkillType.Normal then
|
||||
skill.owner:AddRage(i1, CountTypeName.Sub)
|
||||
BattleUtil.CalRage(role, skill.owner, i1, CountTypeName.Sub)
|
||||
end
|
||||
end
|
||||
role.Event:AddEvent(BattleEventName.BeSkillCastEnd, onBeSkillCastEnd)
|
||||
|
|
@ -3022,7 +3022,7 @@ local passivityList = {
|
|||
end)
|
||||
for i= 1, #list do
|
||||
if list[i] and not list[i]:IsRealDead() then
|
||||
list[i]:AddRage(i1, CountTypeName.Add)
|
||||
BattleUtil.CalRage(role, list[i], i1, CountTypeName.Add)
|
||||
break
|
||||
end
|
||||
end
|
||||
|
|
@ -3233,7 +3233,7 @@ local passivityList = {
|
|||
local onSkillEnd = function(skill)
|
||||
local targets = skill:GetDirectTargets()
|
||||
if targets and #targets > i1 then
|
||||
role:AddRage(i2, 1)
|
||||
BattleUtil.CalRage(role, role, i2, 1)
|
||||
end
|
||||
end
|
||||
role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
|
||||
|
|
@ -3495,7 +3495,7 @@ local passivityList = {
|
|||
-- 对每个目标附加减伤盾
|
||||
local targets = skill:GetDirectTargetsNoMiss()
|
||||
if targets and #targets == 1 then
|
||||
targets[1]:AddRage(i1, CountTypeName.Sub)
|
||||
BattleUtil.CalRage(role, targets[1], i1, CountTypeName.Sub)
|
||||
end
|
||||
end
|
||||
role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillCastEnd)
|
||||
|
|
@ -3601,7 +3601,7 @@ local passivityList = {
|
|||
local targets = skill:GetDirectTargetsNoMiss()
|
||||
if targets then
|
||||
for _, r in ipairs(targets) do
|
||||
r:AddRage(i1, CountTypeName.Sub)
|
||||
BattleUtil.CalRage(role, r, i1, CountTypeName.Sub)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -3901,7 +3901,7 @@ local passivityList = {
|
|||
local onRoleHit = function(target, damage, bCrit, finalDmg, damageType, skill)
|
||||
if skill and (skill.type == BattleSkillType.Special or skill.type==BattleSkillType.Extra) and target:IsDead() and not BattleUtil.CheckIsNoDead(target) then
|
||||
BattleUtil.RandomAction(f1, function()
|
||||
role:AddRage(target.Rage, CountTypeName.Add)
|
||||
BattleUtil.CalRage(role, role, target.Rage, CountTypeName.Add)
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
|
@ -3955,6 +3955,7 @@ local passivityList = {
|
|||
end
|
||||
if damagingFunc then damagingFunc(md) end
|
||||
end
|
||||
|
||||
end
|
||||
role.Event:AddEvent(BattleEventName.FinalBeDamageEnd, onFinalBeDamage)
|
||||
end,
|
||||
|
|
@ -4067,7 +4068,7 @@ local passivityList = {
|
|||
local onRoleTurnEnd = function(target)
|
||||
if not target:IsDead() and BattleLogic.BuffMgr:HasBuff(target, BuffName.Curse, function(buff) return buff.curseType == CurseTypeName.ShareDamage end) then
|
||||
BattleUtil.RandomAction(f1, function()
|
||||
target:AddRage(i2, CountTypeName.Sub)
|
||||
BattleUtil.CalRage(role, target, i2, CountTypeName.Sub)
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
|
@ -4261,7 +4262,7 @@ local passivityList = {
|
|||
local i1 = args[1]
|
||||
local function onRoundChange(curRound)
|
||||
if curRound == 1 then
|
||||
role:AddRage(i1, CountTypeName.Add)
|
||||
BattleUtil.CalRage(role, role, i1, CountTypeName.Add)
|
||||
-- BattleLogic.Event:RemoveEvent(BattleEventName.BattleRoundChange, onRoundChange)
|
||||
end
|
||||
end
|
||||
|
|
@ -4731,7 +4732,7 @@ local passivityList = {
|
|||
local function _OnRoundChange(curRound)
|
||||
if role.element == ele then
|
||||
BattleUtil.RandomAction(f1, function()
|
||||
role:AddRage(i1, CountTypeName.Add)
|
||||
BattleUtil.CalRage(role, role, i1, CountTypeName.Add)
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
|
@ -4901,7 +4902,7 @@ local passivityList = {
|
|||
return
|
||||
end
|
||||
if skill and not skill.isAdd and defRole:IsDead() and not BattleUtil.CheckIsNoDead(defRole) then
|
||||
role:AddRage(i1, CountTypeName.Add)
|
||||
BattleUtil.CalRage(role, role, i1, CountTypeName.Add)
|
||||
if skill then
|
||||
-- skill.isTriggePassivity=true
|
||||
table.insert(skill.triggerPassivityId,id)
|
||||
|
|
@ -5096,7 +5097,7 @@ local passivityList = {
|
|||
return
|
||||
end
|
||||
if target:IsDead() and not BattleUtil.CheckIsNoDead(target) then
|
||||
role:AddRage(i1, CountTypeName.Add)
|
||||
BattleUtil.CalRage(role, role, i1, CountTypeName.Add)
|
||||
if skill then
|
||||
--skill.isTriggePassivity=true
|
||||
table.insert(skill.triggerPassivityId,id)
|
||||
|
|
@ -5168,7 +5169,7 @@ local passivityList = {
|
|||
end
|
||||
if skill and skill.type == BattleSkillType.Special and target:IsDead() and not BattleUtil.CheckIsNoDead(target) then
|
||||
BattleUtil.RandomAction(f1, function()
|
||||
role:AddRage(target.Rage, CountTypeName.Add)
|
||||
BattleUtil.CalRage(role, role, target.Rage, CountTypeName.Add)
|
||||
if skill then
|
||||
--skill.isTriggePassivity=true
|
||||
table.insert(skill.triggerPassivityId,id)
|
||||
|
|
@ -5314,7 +5315,7 @@ local passivityList = {
|
|||
end
|
||||
end
|
||||
if num>0 then
|
||||
role:AddRage(i1, CountTypeName.Add)
|
||||
BattleUtil.CalRage(role, role, i1, CountTypeName.Add)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -5372,7 +5373,7 @@ local passivityList = {
|
|||
return
|
||||
end
|
||||
if skill and skill.owner==role and defRole.camp~=role.camp and skill.type~=BattleSkillType.Monster and skill.type~=BattleSkillType.Normal then
|
||||
defRole:AddRage(v2,CountTypeName.Sub)
|
||||
BattleUtil.CalRage(role, defRole, v2,CountTypeName.Sub)
|
||||
end
|
||||
end
|
||||
role.Event:AddEvent(BattleEventName.FinalDamage,onFinalBeDamage)
|
||||
|
|
@ -5446,7 +5447,7 @@ local passivityList = {
|
|||
for key, value in pairs(list) do
|
||||
local isHave=BattleLogic.BuffMgr:HasBuff(value, BuffName.Control, function(buff) return buff.ctrlType == dot and buff.caster==role and buff.startRound == BattleLogic.GetCurRound() end)
|
||||
if isHave then
|
||||
value:AddRage(i1, CountTypeName.Sub)
|
||||
BattleUtil.CalRage(role, value, i1, CountTypeName.Sub)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -5551,7 +5552,7 @@ local passivityList = {
|
|||
return
|
||||
end
|
||||
if BattleLogic.BuffMgr:HasBuff(caster, BuffName.DOT, function(buff) return buff.damageType == dot end) then
|
||||
role:AddRage(f1,ct)
|
||||
BattleUtil.CalRage(role, role, f1, ct)
|
||||
end
|
||||
end
|
||||
role.Event:AddEvent(BattleEventName.PassiveBeDamaging, onPassiveBeDamaging)
|
||||
|
|
@ -5686,7 +5687,7 @@ local passivityList = {
|
|||
end
|
||||
list = BattleUtil.SortByProp(list, BattlePropList[pro],0)
|
||||
if not list[1]:IsDead() then
|
||||
list[1]:AddRage(num,ct)
|
||||
BattleUtil.CalRage(role, list[1], num, ct)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -5788,22 +5789,24 @@ local passivityList = {
|
|||
[281]=function(role,args)
|
||||
local ele=args[1]
|
||||
local onRoleCastSkillBrfore=function(caster)
|
||||
-- 施法者不是自身/自身不足已释放技能/不是己方英雄/不是a 阵营
|
||||
if caster==role or role.Rage <= role.SuperSkillRage or caster.camp~=role.camp or caster.element~=role.element then
|
||||
return
|
||||
end
|
||||
--释放者死亡或释放着被沉默
|
||||
if caster:IsDead() or caster.ctrl_slient then
|
||||
return
|
||||
end
|
||||
local moreRage=role.Rage-role.SuperSkillRage
|
||||
local lessRage=caster.SuperSkillRage-caster.Rage
|
||||
local num=moreRage-lessRage
|
||||
if num>=0 then
|
||||
--精卫转移怒气不算减怒
|
||||
role.Rage=role.Rage-lessRage
|
||||
caster:AddRage(lessRage, CountTypeName.Add)
|
||||
end
|
||||
-- 施法者不是自身/自身不足已释放技能/不是己方英雄/不是a 阵营
|
||||
if caster==role or role.Rage <= role.SuperSkillRage or caster.camp~=role.camp or caster.element~=role.element then
|
||||
return
|
||||
end
|
||||
--释放者死亡或释放着被沉默
|
||||
if caster:IsDead() or caster.ctrl_slient then
|
||||
return
|
||||
end
|
||||
local moreRage=role.Rage-role.SuperSkillRage
|
||||
local lessRage=caster.SuperSkillRage-caster.Rage
|
||||
local num=moreRage-lessRage
|
||||
if num>=0 then
|
||||
--精卫转移怒气不算减怒
|
||||
role.Rage=role.Rage-lessRage
|
||||
caster:AddRage(lessRage, CountTypeName.Add)
|
||||
-- 用于记录统计
|
||||
BattleLogic.Event:DispatchEvent(BattleEventName.RecordTransRage, role, caster, lessRage)
|
||||
end
|
||||
end
|
||||
BattleLogic.Event:AddEvent(BattleEventName.RoleCastSkillBefore, onRoleCastSkillBrfore)
|
||||
end,
|
||||
|
|
@ -5859,7 +5862,7 @@ local passivityList = {
|
|||
return
|
||||
end
|
||||
list=BattleUtil.SortByRage(list,0)
|
||||
list[1]:AddRage(v1,ct)
|
||||
BattleUtil.CalRage(role, list[1], v1, ct)
|
||||
end
|
||||
end
|
||||
role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillCastEnd)
|
||||
|
|
@ -6018,7 +6021,7 @@ local passivityList = {
|
|||
end
|
||||
end
|
||||
if num>0 then
|
||||
role:AddRage(i1*num, CountTypeName.Add)
|
||||
BattleUtil.CalRage(role, role, i1*num, CountTypeName.Add)
|
||||
if p1 and v1 then
|
||||
local dd = floor(BattleUtil.ErrorCorrection(role:GetRoleData(BattlePropList[p1])*v1*num))
|
||||
BattleUtil.ApplyTreat(role, role, dd)
|
||||
|
|
|
|||
|
|
@ -363,12 +363,13 @@ function BattleLogic.Update()
|
|||
return
|
||||
end
|
||||
if CurRound > MaxRound then
|
||||
if BattleLogic.Type==9 or BattleLogic.Type==17 then
|
||||
if allHeroDamage>allEnemyDamage then
|
||||
BattleLogic.BattleEnd(1)
|
||||
else
|
||||
BattleLogic.BattleEnd(0)
|
||||
end
|
||||
if BattleLogic.Type == BATTLE_SERVER_TYPE.TOPFight -- 巅峰赛
|
||||
or BattleLogic.Type == BATTLE_SERVER_TYPE.Firend then -- 好友切磋
|
||||
if allHeroDamage>allEnemyDamage then
|
||||
BattleLogic.BattleEnd(1)
|
||||
else
|
||||
BattleLogic.BattleEnd(0)
|
||||
end
|
||||
else
|
||||
BattleLogic.BattleEnd(0)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -4,6 +4,28 @@ local function indexAdd()
|
|||
return index
|
||||
end
|
||||
|
||||
|
||||
BATTLE_SERVER_TYPE = {
|
||||
StoryFight = 1, --故事副本
|
||||
MapExploreFight = 2, -- 地图探索
|
||||
ArenaFight = 3, --竞技场
|
||||
InvasionBossFight = 4,--秘境boss
|
||||
AdventureLock = 5, -- 解锁秘境
|
||||
GuildFight = 6, -- 公会站
|
||||
BloodyFight = 7, -- 血战
|
||||
MonterFight = 8, -- 兽潮
|
||||
TOPFight = 9, -- 巅峰赛
|
||||
GuildBossFight = 10, -- 工会boss
|
||||
CarBossFight = 11, -- 车迟斗法挑战boss
|
||||
CarPersonFight = 12, -- 车迟斗法抢夺
|
||||
EXPEDITION = 13, -- 远征
|
||||
GuildChallenge = 14, --公会副本
|
||||
NewGeneral = 15,--新将
|
||||
TenDespairArray = 16,--十绝阵
|
||||
Firend = 17,--好友
|
||||
SenLuoHuanJing = 18,-- 森罗环境
|
||||
}
|
||||
|
||||
BattleEventName = {
|
||||
BattleStart = indexAdd(),
|
||||
|
||||
|
|
@ -133,6 +155,15 @@ BattleEventName = {
|
|||
ShieldBuffEnd=indexAdd(),
|
||||
--治疗效果导入
|
||||
HotBuffEnd=indexAdd(),
|
||||
|
||||
-- 战斗记录用
|
||||
RecordDamage = indexAdd(), -- 伤害
|
||||
RecordTreat = indexAdd(), -- 治疗
|
||||
RecordRage = indexAdd(), -- 怒气
|
||||
RecordTransRage = indexAdd(), -- 转移怒气
|
||||
RecordBuff = indexAdd(), -- buff
|
||||
RecordSecKill = indexAdd(), -- 斩杀
|
||||
|
||||
}
|
||||
|
||||
BattleMaxFrame = 1000000
|
||||
|
|
@ -169,18 +200,18 @@ RoleDataName = {
|
|||
}
|
||||
|
||||
BuffName = {
|
||||
PropertyChange = "PropertyChange",
|
||||
HOT = "HOT",
|
||||
DOT = "DOT",
|
||||
Control = "Control",
|
||||
Aura = "Aura",
|
||||
Brand = "Brand",
|
||||
Shield = "Shield",
|
||||
Immune = "Immune",
|
||||
NoDead = "NoDead",
|
||||
Curse = "Curse",
|
||||
KylinMark = "KylinMark",
|
||||
Exile = "Exile",
|
||||
PropertyChange = 1,
|
||||
Control = 2,
|
||||
DOT = 3,
|
||||
HOT = 4,
|
||||
Shield = 5,
|
||||
Immune = 6,
|
||||
Curse = 7,
|
||||
KylinMark = 8,
|
||||
Exile = 9,
|
||||
NoDead = 10,
|
||||
Aura = 11,
|
||||
Brand = 12,
|
||||
}
|
||||
|
||||
DotType = {
|
||||
|
|
|
|||
|
|
@ -272,7 +272,6 @@ function BattleUtil.ChooseTarget(role, chooseId)
|
|||
else
|
||||
arr = RoleManager.GetArrAggroList(role, arr)
|
||||
end
|
||||
-- body
|
||||
-- elseif chooseWeight == 9 then -- 展位距离
|
||||
-- BattleUtil.Sort(arr, function(a, b)
|
||||
-- local r1 = math.abs(role.position - a.position) * 10 + a.position
|
||||
|
|
@ -385,10 +384,12 @@ function BattleUtil.Seckill(skill, atkRole, defRole)
|
|||
defRole.Event:DispatchEvent(BattleEventName.RoleBeHit, atkRole, damage, nil, finalDmg, nil, skill)
|
||||
end
|
||||
end
|
||||
-- 用于记录统计
|
||||
BattleLogic.Event:DispatchEvent(BattleEventName.RecordSecKill, atkRole, defRole)
|
||||
end
|
||||
|
||||
-- 秒杀定额血量
|
||||
function BattleUtil.SeckillHP(skill, atkRole, defRole,pro)
|
||||
function BattleUtil.SeckillHP(skill, atkRole, defRole, pro)
|
||||
-- 灵兽无效
|
||||
if defRole.type == BattleUnitType.Monster then
|
||||
return
|
||||
|
|
@ -415,6 +416,8 @@ function BattleUtil.SeckillHP(skill, atkRole, defRole,pro)
|
|||
defRole.Event:DispatchEvent(BattleEventName.RoleBeHit, atkRole, damage, nil, finalDmg, nil, skill)
|
||||
end
|
||||
end
|
||||
-- 用于记录统计
|
||||
BattleLogic.Event:DispatchEvent(BattleEventName.RecordSecKill, atkRole, defRole)
|
||||
end
|
||||
|
||||
-- 计算真实伤害
|
||||
|
|
@ -463,6 +466,23 @@ function BattleUtil.ApplyDamage(skill, atkRole, defRole, damage, bCrit, damageTy
|
|||
end
|
||||
|
||||
|
||||
-- 怒气计算
|
||||
function BattleUtil.CalRage(caster, target, value, countType)
|
||||
|
||||
-- 角色身上有无敌盾,不扣除怒气 by:wangzhenxing 2020/08/10 14:56
|
||||
if (countType==3 or countType==4) -- 降怒
|
||||
and (target.isImmuneReduceRage -- 免疫降怒 或者 有无敌盾
|
||||
or BattleLogic.BuffMgr:HasBuff(target, BuffName.Shield, function (buff) return buff.shieldType and buff.shieldType == ShieldTypeName.AllReduce end))
|
||||
then
|
||||
return
|
||||
end
|
||||
|
||||
-- 操作怒气
|
||||
local deltaRage = target:AddRage(value, countType)
|
||||
-- 用于记录统计
|
||||
BattleLogic.Event:DispatchEvent(BattleEventName.RecordRage, caster, target, deltaRage)
|
||||
end
|
||||
|
||||
--检测是否有是金翅大鹏有不灭效果
|
||||
function BattleUtil.CheckIsNoDead(target)
|
||||
if target then
|
||||
|
|
@ -471,6 +491,7 @@ function BattleUtil.CheckIsNoDead(target)
|
|||
return false
|
||||
end
|
||||
|
||||
|
||||
--检测列表是否包含值
|
||||
function BattleUtil.ChecklistIsContainValue(_list,_value)
|
||||
if _list and _value then
|
||||
|
|
@ -533,6 +554,8 @@ function BattleUtil.FinalDamage(skill, atkRole, defRole, damage, bCrit, damageTy
|
|||
end
|
||||
end
|
||||
|
||||
-- 战斗记录用
|
||||
BattleLogic.Event:DispatchEvent(BattleEventName.RecordDamage, atkRole, defRole, damage)
|
||||
--
|
||||
BattleLogManager.Log(
|
||||
"Final Damage",
|
||||
|
|
@ -547,7 +570,6 @@ function BattleUtil.FinalDamage(skill, atkRole, defRole, damage, bCrit, damageTy
|
|||
return finalDmg
|
||||
end
|
||||
|
||||
|
||||
--执行完整的命中,伤害,暴击计算,返回命中,暴击
|
||||
--skill造成伤害的技能 atkRole攻击者 defRole受击者 damageType伤害类型 baseFactor伤害系数 ignoreDef无视防御参数 dotType是持续伤害类型
|
||||
function BattleUtil.CalDamage(skill, atkRole, defRole, damageType, baseFactor, ignoreDef, dotType)
|
||||
|
|
@ -719,6 +741,8 @@ function BattleUtil.ApplyTreat(castRole, targetRole, value, baseFactor,critDamag
|
|||
targetRole.Event:DispatchEvent(BattleEventName.RoleBeTreated, castRole, treat, baseTreat)
|
||||
--添加发送到battleLogic的治疗消息,用于计算总的战斗伤害值
|
||||
BattleLogic.Event:DispatchEvent(BattleEventName.RoleBeTreated, castRole, treat, baseTreat)
|
||||
-- 战斗记录用
|
||||
BattleLogic.Event:DispatchEvent(BattleEventName.RecordTreat, castRole, targetRole, baseTreat)
|
||||
BattleLogManager.Log(
|
||||
"Final Treat",
|
||||
"acamp", castRole.camp,
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@ function RoleLogic:Init(uid, data, position)
|
|||
self.isExile = false --是否放逐
|
||||
self.reliveFilter = true -- 控制复活的标志位,置为false角色将不再享受复活效果
|
||||
self.reliveHPF = 1
|
||||
self.reliveCaster = nil
|
||||
|
||||
self.IsCanAddSkill = true -- 是否可以追加技能
|
||||
self.mustHit=false --必定命中
|
||||
|
|
@ -159,11 +160,6 @@ end
|
|||
|
||||
-- 改变怒气值
|
||||
function RoleLogic:AddRage(value, type)
|
||||
-- 角色身上有无敌盾,不扣除怒气 by:wangzhenxing 2020/08/10 14:56
|
||||
if (type==3 or type==4) and (self.isImmuneReduceRage or BattleLogic.BuffMgr:HasBuff(self, BuffName.Shield, function (buff) return buff.shieldType and buff.shieldType == ShieldTypeName.AllReduce end)) then
|
||||
return
|
||||
end
|
||||
|
||||
local delta = 0
|
||||
if type == 1 then --加算
|
||||
delta = value
|
||||
|
|
@ -177,6 +173,8 @@ function RoleLogic:AddRage(value, type)
|
|||
self.Event:DispatchEvent(BattleEventName.RoleRageChange, delta)
|
||||
--怒气值不可为负值
|
||||
self.Rage = max(self.Rage + delta, 0)
|
||||
|
||||
return delta
|
||||
end
|
||||
|
||||
function RoleLogic:GetRoleData(property)
|
||||
|
|
@ -537,10 +535,13 @@ function RoleLogic:Relive()
|
|||
self.isDead = false
|
||||
self.isRealDead = false
|
||||
local maxHp = self.data:GetData(RoleDataName.MaxHp)
|
||||
self.data:SetValue(RoleDataName.Hp, floor(self.reliveHPF * maxHp))
|
||||
local reHp = floor(self.reliveHPF * maxHp)
|
||||
self.data:SetValue(RoleDataName.Hp, reHp)
|
||||
-- 发送复活事件
|
||||
self.Event:DispatchEvent(BattleEventName.RoleRelive, self)
|
||||
BattleLogic.Event:DispatchEvent(BattleEventName.RoleRelive, self)
|
||||
-- 复活的血量算做加血
|
||||
BattleLogic.Event:DispatchEvent(BattleEventName.RecordTreat, self.reliveCaster or self, self, reHp)
|
||||
return true
|
||||
end
|
||||
return false
|
||||
|
|
@ -550,10 +551,11 @@ function RoleLogic:SetReliveFilter(filter)
|
|||
self.reliveFilter = filter
|
||||
end
|
||||
--,hpf 复活时拥有的血量的百分比
|
||||
function RoleLogic:SetRelive(hpf)
|
||||
function RoleLogic:SetRelive(hpf, caster)
|
||||
-- 判断是否可以复活
|
||||
if self:IsCanRelive() then
|
||||
self.reliveHPF = hpf or 1
|
||||
self.reliveCaster = caster
|
||||
RoleManager.AddReliveRole(self)
|
||||
end
|
||||
return false
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
require("Modules.Battle.Config.PokemonEffectConfig")
|
||||
require("Base/BasePanel")
|
||||
local SpiritAnimal = ConfigManager.GetConfig(ConfigName.SpiritAnimal)
|
||||
|
||||
local DamageResultPanel = Inherit(BasePanel)
|
||||
local this = DamageResultPanel
|
||||
|
||||
|
|
@ -9,7 +11,10 @@ local _TabFontColor = { default = Color.New(168 / 255, 168 / 255, 167 / 255, 1),
|
|||
select = Color.New(250 / 255, 227 / 255, 175 / 255, 1) }
|
||||
local _TabData = {
|
||||
[1] = { default = "r_hero_xuanze_002", select = "r_hero_xuanze_001", name = Language[10271] },
|
||||
[2] = { default = "r_hero_xuanze_002", select = "r_hero_xuanze_001", name = Language[10272] },}
|
||||
[2] = { default = "r_hero_xuanze_002", select = "r_hero_xuanze_001", name = Language[10272] },
|
||||
[3] = { default = "r_hero_xuanze_002", select = "r_hero_xuanze_001", name = "特殊" },
|
||||
[4] = { default = "r_hero_xuanze_002", select = "r_hero_xuanze_001", name = "灵兽" },
|
||||
}
|
||||
|
||||
-- 最大层数
|
||||
local _MaxOrder = 0
|
||||
|
|
@ -18,10 +23,6 @@ local _MaxOrder = 0
|
|||
local _MaxDamageValue = 0
|
||||
local _MaxTreatValue = 0
|
||||
|
||||
-- 总伤害和治疗数值
|
||||
local _AllDamageValue = {}
|
||||
local _AllTreatValue = {}
|
||||
|
||||
-- 节点保存
|
||||
local _LeftItemPool = {}
|
||||
local _RightItemPool = {}
|
||||
|
|
@ -47,7 +48,7 @@ function DamageResultPanel:InitComponent()
|
|||
this.rightName = Util.GetGameObject(this.transform, "right/name"):GetComponent("Text")
|
||||
this.rightItem = Util.GetGameObject(this.transform, "right/item")
|
||||
this.rightGrid = Util.GetGameObject(this.transform, "right/scrollRect/grid")
|
||||
|
||||
|
||||
-- 初始化Tab管理器
|
||||
this.tabbox = Util.GetGameObject(this.transform, "top")
|
||||
this.TabCtrl = TabBox.New()
|
||||
|
|
@ -75,10 +76,8 @@ end
|
|||
|
||||
--界面打开时调用(用于子类重写)
|
||||
function DamageResultPanel:OnOpen(result)
|
||||
|
||||
this.leftResult.sprite = Util.LoadSprite(result == 1 and "UI_effect_JJC_JieSuan_ShengLi_png" or "UI_effect_JJC_JieSuan_ShiBai_png")
|
||||
this.rightResult.sprite = Util.LoadSprite(result == 0 and "UI_effect_JJC_JieSuan_ShengLi_png" or "UI_effect_JJC_JieSuan_ShiBai_png")
|
||||
|
||||
local nameStr = BattleRecordManager.GetBattleBothNameStr()
|
||||
if nameStr then
|
||||
local namelist = string.split(nameStr, "|")
|
||||
|
|
@ -88,63 +87,23 @@ function DamageResultPanel:OnOpen(result)
|
|||
this.leftName.text = Language[10273]
|
||||
this.rightName.text = Language[10274]
|
||||
end
|
||||
|
||||
-- 数据
|
||||
this.battleRecord = BattleRecordManager.GetBattleRecord()
|
||||
|
||||
-- 初始化数据
|
||||
_MaxOrder = 0
|
||||
if not this.battleRecord then return end
|
||||
-- 计算最大数据
|
||||
_MaxDamageValue = 0
|
||||
_MaxTreatValue = 0
|
||||
_AllDamageValue = {}
|
||||
_AllTreatValue = {}
|
||||
_NormalMonsterList = {}
|
||||
_DiffMonsterList = {}
|
||||
|
||||
-- 判断最后一层战斗的层数
|
||||
for _, data in pairs(this.battleRecord) do
|
||||
if data.order > _MaxOrder then
|
||||
_MaxOrder = data.order
|
||||
end
|
||||
end
|
||||
|
||||
-- 数据匹配
|
||||
if not this.battleRecord then return end
|
||||
for _, data in pairs(this.battleRecord) do
|
||||
-- 怪物只显示最后一层的怪物信息
|
||||
if data.camp ~= RIGHT_CAMP or data.order == _MaxOrder then
|
||||
if this.battleRecord.data then
|
||||
for _, role in pairs(this.battleRecord.data) do
|
||||
-- 计算最大值
|
||||
if data.damage > _MaxDamageValue then _MaxDamageValue = data.damage end
|
||||
if data.heal > _MaxTreatValue then _MaxTreatValue = data.heal end
|
||||
|
||||
-- 计算总值
|
||||
if not _AllDamageValue[data.camp] then _AllDamageValue[data.camp] = 0 end
|
||||
if not _AllTreatValue[data.camp] then _AllTreatValue[data.camp] = 0 end
|
||||
_AllDamageValue[data.camp] = _AllDamageValue[data.camp] + data.damage
|
||||
_AllTreatValue[data.camp] = _AllTreatValue[data.camp] + data.heal
|
||||
|
||||
-- 数据重构
|
||||
if data.type == 0 then
|
||||
table.insert(_NormalMonsterList, data)
|
||||
else
|
||||
table.insert(_DiffMonsterList, data)
|
||||
end
|
||||
if role.damage and role.damage > _MaxDamageValue then _MaxDamageValue = role.damage end
|
||||
if role.treat and role.treat > _MaxTreatValue then _MaxTreatValue = role.treat end
|
||||
end
|
||||
end
|
||||
|
||||
-- 排序
|
||||
table.sort(_NormalMonsterList, function(a, b)
|
||||
return a.uid < b.uid
|
||||
end)
|
||||
table.sort(_DiffMonsterList, function(a, b)
|
||||
return a.camp == b.camp and a.type < b.type or a.camp < b.camp
|
||||
end)
|
||||
|
||||
|
||||
-- tab节点管理
|
||||
if this.TabCtrl then
|
||||
this.TabCtrl:ChangeTab(1)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
--界面打开或者重新打开后,界面刷新时调用(用于子类重写)
|
||||
|
|
@ -160,7 +119,7 @@ end
|
|||
-- tab改变回调事件
|
||||
function this.OnTabChange(index, lastIndex)
|
||||
|
||||
local showType = index -- 1 伤害 2 治疗
|
||||
local showType = index -- 1 伤害 2 治疗 3 特殊 4 灵兽
|
||||
|
||||
-- 关闭显示
|
||||
for _, item in pairs(_LeftItemPool) do
|
||||
|
|
@ -172,82 +131,75 @@ function this.OnTabChange(index, lastIndex)
|
|||
|
||||
-- 数据匹配
|
||||
if not this.battleRecord then return end
|
||||
local leftIndex, rightIndex = 1, 1
|
||||
local leftIndex, rightIndex = 0, 0
|
||||
local function CreateMonsterItem(data)
|
||||
-- 怪物只显示最后一层的怪物信息
|
||||
if data.camp ~= RIGHT_CAMP or data.order == _MaxOrder then
|
||||
local pool, item, grid, index
|
||||
if data.camp == LEFT_CAMP then
|
||||
pool, item, grid, index = _LeftItemPool, this.leftItem, this.leftGrid, leftIndex
|
||||
leftIndex = leftIndex + 1
|
||||
elseif data.camp == RIGHT_CAMP then
|
||||
pool, item, grid, index = _RightItemPool, this.rightItem, this.rightGrid, rightIndex
|
||||
rightIndex = rightIndex + 1
|
||||
end
|
||||
|
||||
if not pool[index] then
|
||||
pool[index] = newObjToParent(item, grid)
|
||||
end
|
||||
pool[index]:SetActive(true)
|
||||
this.ItemAdapter(pool[index], data, showType)
|
||||
local pool, item, grid, index
|
||||
if data.info.camp == LEFT_CAMP then
|
||||
leftIndex = leftIndex + 1
|
||||
pool, item, grid, index = _LeftItemPool, this.leftItem, this.leftGrid, leftIndex
|
||||
elseif data.info.camp == RIGHT_CAMP then
|
||||
rightIndex = rightIndex + 1
|
||||
pool, item, grid, index = _RightItemPool, this.rightItem, this.rightGrid, rightIndex
|
||||
end
|
||||
|
||||
if not pool[index] then
|
||||
pool[index] = newObjToParent(item, grid)
|
||||
end
|
||||
pool[index]:SetActive(true)
|
||||
this.ItemAdapter(pool[index], data, showType)
|
||||
end
|
||||
|
||||
-- 创建
|
||||
for _, data in ipairs(_NormalMonsterList) do
|
||||
local showList = this.battleRecord.data
|
||||
if showType == 4 then
|
||||
showList = this.battleRecord.mdata
|
||||
end
|
||||
for _, data in pairs(showList) do
|
||||
CreateMonsterItem(data)
|
||||
end
|
||||
for _, data in ipairs(_DiffMonsterList) do
|
||||
CreateMonsterItem(data)
|
||||
end
|
||||
|
||||
-- 播放动画
|
||||
this.StartPlayAnim(showType)
|
||||
end
|
||||
|
||||
-- 开始播放动画
|
||||
function this.StartPlayAnim(showType)
|
||||
if showType > 2 then
|
||||
return
|
||||
end
|
||||
-- 根据showType播放动画
|
||||
DoTween.To(
|
||||
DG.Tweening.Core.DOGetter_float( function () return 0 end),
|
||||
DG.Tweening.Core.DOSetter_float(
|
||||
function (progress)
|
||||
local leftIndex, rightIndex = 1, 1
|
||||
local leftIndex, rightIndex = 0, 0
|
||||
local function _Play(data)
|
||||
-- 怪物只显示最后一层的怪物信息
|
||||
if data.camp ~= RIGHT_CAMP or data.order == _MaxOrder then
|
||||
local pool, index, drt
|
||||
if data.camp == LEFT_CAMP then
|
||||
pool, index = _LeftItemPool, leftIndex
|
||||
leftIndex = leftIndex + 1
|
||||
drt = 1
|
||||
elseif data.camp == RIGHT_CAMP then
|
||||
pool, index = _RightItemPool, rightIndex
|
||||
rightIndex = rightIndex + 1
|
||||
drt = -1
|
||||
end
|
||||
if pool[index] then
|
||||
local _progress = Util.GetGameObject(pool[index], "progress")
|
||||
local value = 0
|
||||
if showType == 1 then
|
||||
if _MaxDamageValue ~= 0 then
|
||||
value = data.damage/_MaxDamageValue
|
||||
end
|
||||
else
|
||||
if _MaxTreatValue ~= 0 then
|
||||
value = data.heal/_MaxTreatValue
|
||||
end
|
||||
local pool, index, drt
|
||||
if data.info.camp == LEFT_CAMP then
|
||||
leftIndex = leftIndex + 1
|
||||
pool, index = _LeftItemPool, leftIndex
|
||||
drt = 1
|
||||
elseif data.info.camp == RIGHT_CAMP then
|
||||
rightIndex = rightIndex + 1
|
||||
pool, index = _RightItemPool, rightIndex
|
||||
drt = -1
|
||||
end
|
||||
if pool[index] then
|
||||
local _progress = Util.GetGameObject(pool[index], "progress")
|
||||
local value = 0
|
||||
if showType == 1 then
|
||||
if _MaxDamageValue ~= 0 then
|
||||
value = (data.damage or 0)/_MaxDamageValue
|
||||
end
|
||||
else
|
||||
if _MaxTreatValue ~= 0 then
|
||||
value = (data.treat or 0)/_MaxTreatValue
|
||||
end
|
||||
_progress.transform.localScale = Vector3(value * progress * drt, 1, 1)
|
||||
end
|
||||
_progress.transform.localScale = Vector3(value * progress * drt, 1, 1)
|
||||
end
|
||||
end
|
||||
|
||||
-- 创建
|
||||
for _, data in ipairs(_NormalMonsterList) do
|
||||
_Play(data)
|
||||
end
|
||||
for _, data in ipairs(_DiffMonsterList) do
|
||||
for _, data in pairs(this.battleRecord.data) do
|
||||
_Play(data)
|
||||
end
|
||||
end),
|
||||
|
|
@ -257,20 +209,70 @@ end
|
|||
|
||||
-- 数据匹配
|
||||
function this.ItemAdapter(item, data, showType)
|
||||
local head = Util.GetGameObject(item, "headpos/head")
|
||||
this.HeadAdapter(head, data.info, showType)
|
||||
|
||||
local damage = Util.GetGameObject(item, "damage"):GetComponent("Text")
|
||||
local progress = Util.GetGameObject(item, "progress")
|
||||
local head = Util.GetGameObject(item, "headpos/head")
|
||||
local scroll = Util.GetGameObject(item, "scroll")
|
||||
local content = Util.GetGameObject(item, "scroll/Viewport/Content"):GetComponent("Text")
|
||||
|
||||
local value = showType == 1 and data.damage or data.heal
|
||||
damage.text = value
|
||||
-- 显隐
|
||||
damage.gameObject:SetActive(showType <= 2)
|
||||
progress.gameObject:SetActive(showType <= 2)
|
||||
scroll:SetActive(showType > 2)
|
||||
|
||||
--local allValue = showType == 1 and _AllDamageValue[data.camp] or _AllTreatValue[data.camp]
|
||||
--local ratio = allValue == 0 and 0 or math.floor(value/allValue*10000)/100
|
||||
--damage.text = string.format("%d(%.2f%%)", value, ratio)
|
||||
--
|
||||
if showType == 1 then
|
||||
damage.text = data.damage or 0
|
||||
progress:GetComponent("Image").sprite = Util.LoadSprite("r_guaji_zhandoutongjitiao_01")
|
||||
progress.transform.localScale = Vector3(0, 1, 1)
|
||||
|
||||
elseif showType == 2 then
|
||||
damage.text = data.treat or 0
|
||||
progress:GetComponent("Image").sprite = Util.LoadSprite("r_guaji_zhandoutongjitiao_02")
|
||||
progress.transform.localScale = Vector3(0, 1, 1)
|
||||
elseif showType == 3 or showType == 4 then
|
||||
local txt = ""
|
||||
for key, value in pairs(data) do
|
||||
local s = this.GetSpecialText(key, value)
|
||||
if s then
|
||||
if txt ~= "" then
|
||||
txt = txt.."\n"
|
||||
end
|
||||
txt = txt..s
|
||||
end
|
||||
end
|
||||
content.text = txt == "" and "无" or txt
|
||||
end
|
||||
end
|
||||
|
||||
progress:GetComponent("Image").sprite = Util.LoadSprite(showType == 1 and "r_guaji_zhandoutongjitiao_01" or "r_guaji_zhandoutongjitiao_02")
|
||||
progress.transform.localScale = Vector3(0, 1, 1)
|
||||
this.HeadAdapter(head, data)
|
||||
|
||||
function this.GetSpecialText(key, value)
|
||||
if key == "buff" then
|
||||
local s = ""
|
||||
for id, v in pairs(value) do
|
||||
local type = math.floor(id/100)
|
||||
local subType = id%100
|
||||
print(id, type, subType)
|
||||
local config = ConfigManager.TryGetConfigDataByDoubleKey(ConfigName.BuffEffectConfig, "Type", type, "CType", subType)
|
||||
if config then
|
||||
if s ~= "" then
|
||||
s = s.."\n"
|
||||
end
|
||||
s = s .. string.format("%s:<color=%s>%s</color>次", config.Describe, "#ff0000", v)
|
||||
end
|
||||
end
|
||||
return s
|
||||
elseif key == "addRage" then
|
||||
return string.format("回怒:<color=%s>%s</color>点", "#ff0000", value)
|
||||
elseif key == "subRage" then
|
||||
return string.format("减怒:<color=%s>%s</color>点", "#ff0000", value)
|
||||
elseif key == "transRage" then
|
||||
return string.format("借怒:<color=%s>%s</color>点", "#ff0000", value)
|
||||
elseif key == "secKill" then
|
||||
return string.format("斩杀:<color=%s>%s</color>次", "#ff0000", value)
|
||||
end
|
||||
end
|
||||
|
||||
-- 头像数据匹配
|
||||
|
|
@ -285,15 +287,11 @@ function this.HeadAdapter(head, data)
|
|||
local lv = Util.GetGameObject(head, "lv")
|
||||
local lvText = Util.GetGameObject(head, "lv/Text"):GetComponent("Text")
|
||||
|
||||
--
|
||||
local roleId = data.monsterId or data.roleId
|
||||
-- Log("------ 结算界面roleId = ")
|
||||
-- Log(tostring(data.monsterId))
|
||||
-- Log(tostring(data.roleId))
|
||||
-- Log("---------------------- ")
|
||||
if data.type == BattleUnitType.Role then
|
||||
local roleId = data.roleData.monsterId or data.roleData.roleId
|
||||
local roleLv = data:GetRoleData(RoleDataName.Level)
|
||||
local skinId = data.roleData.skinId
|
||||
|
||||
--local roleInfo = BattleManager.GetRoleData(data.type, data.uid)
|
||||
if data.type == 0 then
|
||||
local config = {}
|
||||
if roleId > 10100 then
|
||||
local MonsterConfig = ConfigManager.GetConfigData(ConfigName.MonsterConfig, roleId)
|
||||
|
|
@ -315,10 +313,9 @@ function this.HeadAdapter(head, data)
|
|||
config.Icon = heroConfig.Icon
|
||||
config.Profession = heroConfig.Profession
|
||||
config.PropertyName = heroConfig.PropertyName
|
||||
|
||||
config.lv = data.roleLv
|
||||
config.lv = roleLv
|
||||
end
|
||||
|
||||
-- 头像
|
||||
frame.sprite = Util.LoadSprite(GetHeroQuantityImageByquality(config.Quality))
|
||||
local aa=config.Icon
|
||||
if data.skinId and data.skinId>0 then
|
||||
|
|
@ -328,30 +325,26 @@ function this.HeadAdapter(head, data)
|
|||
end
|
||||
end
|
||||
icon.sprite = Util.LoadSprite(GetResourcePath(aa))
|
||||
|
||||
-- 等级
|
||||
lv:SetActive(true)
|
||||
lvText.text = config.lv
|
||||
|
||||
-- 职业
|
||||
prefess:SetActive(false)
|
||||
--if config.Profession then
|
||||
-- prefessIcon.sprite = Util.LoadSprite(GetJobSpriteStrByJobNum(config.Profession))
|
||||
-- prefess:SetActive(true)
|
||||
--end
|
||||
|
||||
-- 属性
|
||||
proto:SetActive(false)
|
||||
if config.PropertyName then
|
||||
protoIcon.sprite = Util.LoadSprite(GetProStrImageByProNum(config.PropertyName))
|
||||
proto:SetActive(true)
|
||||
end
|
||||
|
||||
else
|
||||
elseif data.type == BattleUnitType.Monster then
|
||||
local id = data.uid
|
||||
prefess:SetActive(false)
|
||||
proto:SetActive(false)
|
||||
lv:SetActive(false)
|
||||
|
||||
frame.sprite = Util.LoadSprite("r_zhandou_yiyaodi")
|
||||
local iconName = PokemonEffectConfig[data.type].icon
|
||||
icon:GetComponent("Image").sprite = Util.LoadSprite(iconName)
|
||||
icon:GetComponent("Image").sprite = Util.LoadSprite(GetResourcePath(SpiritAnimal[id].Icon))
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in New Issue