Merge branch 'master' of http://60.1.1.230/backend/jieling_server
commit
93a48fc5f7
|
@ -1557,12 +1557,12 @@ local passivityList = {
|
||||||
[92] = function(role, args)
|
[92] = function(role, args)
|
||||||
local i1 = args[1]
|
local i1 = args[1]
|
||||||
|
|
||||||
local OnRoleHit = function(defRole)
|
local OnRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill)
|
||||||
-- local buff = Buff.Create(role, BuffName.PropertyChange, 0, BattlePropList[pro], i1, 1)
|
-- local buff = Buff.Create(role, BuffName.PropertyChange, 0, BattlePropList[pro], i1, 1)
|
||||||
-- buff.cover = true -- 可以叠加
|
-- buff.cover = true -- 可以叠加
|
||||||
-- buff.clear = false -- 不可驱散
|
-- buff.clear = false -- 不可驱散
|
||||||
-- role:AddBuff(buff)
|
-- role:AddBuff(buff)
|
||||||
if defRole:IsDead() then
|
if skill and not skill.isAdd and defRole:IsDead() then
|
||||||
role:AddRage(i1, CountTypeName.Add)
|
role:AddRage(i1, CountTypeName.Add)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -2088,7 +2088,7 @@ local passivityList = {
|
||||||
local af = 0
|
local af = 0
|
||||||
|
|
||||||
local onSkillCast = function(skill)
|
local onSkillCast = function(skill)
|
||||||
if skill.type == BattleSkillType.Normal then
|
if skill.type == BattleSkillType.Normal and not skill.isAdd then
|
||||||
af = 0
|
af = 0
|
||||||
elseif skill.type == BattleSkillType.Special then
|
elseif skill.type == BattleSkillType.Special then
|
||||||
af = af + f1
|
af = af + f1
|
||||||
|
@ -3109,7 +3109,7 @@ local passivityList = {
|
||||||
local f1 = args[1]
|
local f1 = args[1]
|
||||||
local ct = args[2]
|
local ct = args[2]
|
||||||
local f2 = args[3]
|
local f2 = args[3]
|
||||||
local ct2 = args[4]
|
local ct2 = args[4] -- 废物参数
|
||||||
|
|
||||||
-- 释放技能后
|
-- 释放技能后
|
||||||
local onPassiveDamaging = function(damagingFunc, defRole, damage, skill)
|
local onPassiveDamaging = function(damagingFunc, defRole, damage, skill)
|
||||||
|
@ -4363,7 +4363,7 @@ local passivityList = {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- 我方武将造成伤害时,[a]概率附加[b]效果,每回合造成攻击[c]%的伤害,持续[d]秒。
|
-- 普攻时,[a]概率附加[b]效果,每回合造成攻击[c]%的伤害,持续[d]秒。
|
||||||
-- a[float],b[持续伤害效果],c[float],d[int]
|
-- a[float],b[持续伤害效果],c[float],d[int]
|
||||||
[223] = function(role, args)
|
[223] = function(role, args)
|
||||||
local rand = args[1]
|
local rand = args[1]
|
||||||
|
@ -4371,12 +4371,14 @@ local passivityList = {
|
||||||
local f1 = args[3]
|
local f1 = args[3]
|
||||||
local i1 = args[3]
|
local i1 = args[3]
|
||||||
|
|
||||||
local function _OnRoleHit(target)
|
local function _OnRoleHit(target, damage, _, finalDmg, _, skill)
|
||||||
-- BattleUtil.RandomDot(rand, dot, role, target, i1, 1, )
|
-- BattleUtil.RandomDot(rand, dot, role, target, i1, 1, )
|
||||||
|
if skill and skill.type == BattleSkillType.Normal then
|
||||||
BattleUtil.RandomAction(rand, function()
|
BattleUtil.RandomAction(rand, function()
|
||||||
target:AddBuff(Buff.Create(role, BuffName.DOT, i1, 1, dot, 2, f1))
|
target:AddBuff(Buff.Create(role, BuffName.DOT, i1, 1, dot, 2, f1))
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
role.Event:AddEvent(BattleEventName.RoleHit, _OnRoleHit)
|
role.Event:AddEvent(BattleEventName.RoleHit, _OnRoleHit)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
@ -4395,6 +4397,10 @@ local passivityList = {
|
||||||
role.Event:AddEvent(BattleEventName.RoleHit, _OnRoleHit)
|
role.Event:AddEvent(BattleEventName.RoleHit, _OnRoleHit)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
--
|
||||||
|
[225] = function()
|
||||||
|
|
||||||
|
end,
|
||||||
|
|
||||||
-- 斩杀生命低于[a]的敌人
|
-- 斩杀生命低于[a]的敌人
|
||||||
-- a[float]
|
-- a[float]
|
||||||
|
|
|
@ -38,9 +38,9 @@ end
|
||||||
--随机0-1
|
--随机0-1
|
||||||
function Random.Range01()
|
function Random.Range01()
|
||||||
local var = random() / 2147483647
|
local var = random() / 2147483647
|
||||||
if BattleLogic.IsOpenBattleRecord then
|
BattleLogManager.Log(
|
||||||
BattleLogic.RecordSeed(seed)
|
"random",
|
||||||
end
|
"seed", seed)
|
||||||
return var
|
return var
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -37,9 +37,12 @@ function RoleData:SetValue(name, value)
|
||||||
delta = value - delta
|
delta = value - delta
|
||||||
if delta ~= 0 then
|
if delta ~= 0 then
|
||||||
self.role.Event:DispatchEvent(BattleEventName.RolePropertyChanged, name, value, delta)
|
self.role.Event:DispatchEvent(BattleEventName.RolePropertyChanged, name, value, delta)
|
||||||
if BattleLogic.IsOpenBattleRecord then
|
BattleLogManager.Log(
|
||||||
BattleLogic.RecordRoleProperty(self.role.uid, self.role.camp, name, value, delta)
|
"property change",
|
||||||
end
|
"camp", self.role.camp,
|
||||||
|
"position", self.role.position,
|
||||||
|
"propId", name,
|
||||||
|
"value", value)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -91,9 +91,13 @@ local function takeEffect(caster, target, effects, duration, skill)
|
||||||
--
|
--
|
||||||
if effect[e.type] then
|
if effect[e.type] then
|
||||||
effect[e.type](caster, target, e.args, duration, skill)
|
effect[e.type](caster, target, e.args, duration, skill)
|
||||||
if BattleLogic.IsOpenBattleRecord then
|
|
||||||
BattleLogic.RecordEffect(caster, target, e.type, e.args, duration)
|
BattleLogManager.Log(
|
||||||
end
|
"Take Effect",
|
||||||
|
"tcamp", target.camp,
|
||||||
|
"tpos", target.position,
|
||||||
|
"type", e.type
|
||||||
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -131,6 +135,15 @@ function Skill:Cast(func)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
--
|
||||||
|
BattleLogManager.Log(
|
||||||
|
"Cast Skill",
|
||||||
|
"camp", self.owner.camp,
|
||||||
|
"pos", self.owner.position,
|
||||||
|
"type", self.type,
|
||||||
|
"isRage", tostring(self.isRage),
|
||||||
|
"isAdd", tostring(self.isAdd)
|
||||||
|
)
|
||||||
|
|
||||||
-- 对目标造成相应的效果
|
-- 对目标造成相应的效果
|
||||||
for i=1, self.effectList.size do
|
for i=1, self.effectList.size do
|
||||||
|
|
|
@ -1,10 +1,3 @@
|
||||||
|
|
||||||
require("Modules.Battle.Logic.SkillManager")
|
|
||||||
require("Modules.Battle.Logic.RoleManager")
|
|
||||||
require("Modules.Battle.Logic.OutDataManager")
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BattleLogic = {}
|
BattleLogic = {}
|
||||||
|
|
||||||
local floor = math.floor
|
local floor = math.floor
|
||||||
|
@ -88,6 +81,7 @@ function BattleLogic.Init(data, optionData, maxRound)
|
||||||
SkillManager.Init()
|
SkillManager.Init()
|
||||||
OutDataManager.Init(fightData)
|
OutDataManager.Init(fightData)
|
||||||
PassiveManager.Init()
|
PassiveManager.Init()
|
||||||
|
BattleLogManager.Init(fightData)
|
||||||
end
|
end
|
||||||
|
|
||||||
function BattleLogic.StartOrder()
|
function BattleLogic.StartOrder()
|
||||||
|
@ -165,6 +159,11 @@ function BattleLogic.TurnRound(debugTurn)
|
||||||
CurCamp = 0
|
CurCamp = 0
|
||||||
CurSkillPos[0] = 0
|
CurSkillPos[0] = 0
|
||||||
CurSkillPos[1] = 0
|
CurSkillPos[1] = 0
|
||||||
|
--
|
||||||
|
BattleLogManager.Log(
|
||||||
|
"Round Change",
|
||||||
|
"round", CurRound
|
||||||
|
)
|
||||||
-- 轮数变化
|
-- 轮数变化
|
||||||
BattleLogic.Event:DispatchEvent(BattleEventName.BattleRoundChange, CurRound)
|
BattleLogic.Event:DispatchEvent(BattleEventName.BattleRoundChange, CurRound)
|
||||||
else
|
else
|
||||||
|
@ -172,6 +171,11 @@ function BattleLogic.TurnRound(debugTurn)
|
||||||
CurCamp = (CurCamp + 1) % 2
|
CurCamp = (CurCamp + 1) % 2
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--
|
||||||
|
BattleLogManager.Log(
|
||||||
|
"Camp Change",
|
||||||
|
"camp", CurCamp
|
||||||
|
)
|
||||||
-- 当前阵营下一释放技能的位置
|
-- 当前阵营下一释放技能的位置
|
||||||
local cpos = CurSkillPos[CurCamp] + 1
|
local cpos = CurSkillPos[CurCamp] + 1
|
||||||
-- 找到下一个释放技能的人
|
-- 找到下一个释放技能的人
|
||||||
|
@ -195,10 +199,16 @@ function BattleLogic.TurnRound(debugTurn)
|
||||||
end
|
end
|
||||||
-- 如果找不到下一个人,直接交换阵营
|
-- 如果找不到下一个人,直接交换阵营
|
||||||
if not SkillRole then
|
if not SkillRole then
|
||||||
|
BattleLogManager.Log( "No Skill Position" )
|
||||||
BattleLogic.TurnRoundNextFrame()
|
BattleLogic.TurnRoundNextFrame()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--
|
||||||
|
BattleLogManager.Log(
|
||||||
|
"Position Change",
|
||||||
|
"position", CurSkillPos[CurCamp]
|
||||||
|
)
|
||||||
|
|
||||||
-- 如果角色无法释放技能
|
-- 如果角色无法释放技能
|
||||||
if not SkillRole:IsAvailable() then
|
if not SkillRole:IsAvailable() then
|
||||||
|
@ -239,9 +249,6 @@ function BattleLogic.WaitForTrigger(delayTime, action)
|
||||||
item[1] = curFrame + delayFrame
|
item[1] = curFrame + delayFrame
|
||||||
item[2] = action
|
item[2] = action
|
||||||
tbActionList:Add(item)
|
tbActionList:Add(item)
|
||||||
if BattleLogic.IsOpenBattleRecord then
|
|
||||||
BattleLogic.RecordDelayTrigger(delayTime, curFrame + delayFrame)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -308,11 +315,14 @@ end
|
||||||
function BattleLogic.BattleEnd(result)
|
function BattleLogic.BattleEnd(result)
|
||||||
--
|
--
|
||||||
BattleLogic.Event:DispatchEvent(BattleEventName.BeforeBattleEnd, result)
|
BattleLogic.Event:DispatchEvent(BattleEventName.BeforeBattleEnd, result)
|
||||||
|
|
||||||
--
|
--
|
||||||
BattleLogic.IsEnd = true
|
BattleLogic.IsEnd = true
|
||||||
BattleLogic.Result = result
|
BattleLogic.Result = result
|
||||||
BattleLogic.Event:DispatchEvent(BattleEventName.BattleEnd, result)
|
BattleLogic.Event:DispatchEvent(BattleEventName.BattleEnd, result)
|
||||||
|
-- 战斗日志写入
|
||||||
|
if not BattleLogic.GetIsDebug() then
|
||||||
|
BattleLogManager.WriteFile()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
--
|
--
|
||||||
function BattleLogic.Clear()
|
function BattleLogic.Clear()
|
||||||
|
@ -324,75 +334,3 @@ function BattleLogic.Clear()
|
||||||
tbActionList:Remove(tbActionList.size)
|
tbActionList:Remove(tbActionList.size)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-------++++++++++++++++++++++++++++ 战斗记录相关
|
|
||||||
--Record专用
|
|
||||||
function BattleLogic.GetRecord()
|
|
||||||
return record
|
|
||||||
end
|
|
||||||
|
|
||||||
--Record专用
|
|
||||||
function BattleLogic.RecordSeed(seed)
|
|
||||||
table.insert(record, string.format("frame:%d, seed:%d", curFrame, seed))
|
|
||||||
end
|
|
||||||
|
|
||||||
--Record专用
|
|
||||||
function BattleLogic.RecordRoleProperty(uid, camp, name, value, delta)
|
|
||||||
table.insert(record, string.format("frame:%d, uid:%d, camp:%d, name:%s, value:%d, delta:%d", curFrame, uid, camp, name, value, delta))
|
|
||||||
end
|
|
||||||
|
|
||||||
--Record专用
|
|
||||||
function BattleLogic.RecordMul(args)
|
|
||||||
local str = ""
|
|
||||||
for i=1, #args do
|
|
||||||
str = str..tostring(args[i]) .. (i == #args and "" or "#")
|
|
||||||
end
|
|
||||||
table.insert(record, string.format("frame:%d, mulArgs:%s", curFrame, str))
|
|
||||||
end
|
|
||||||
|
|
||||||
--Record专用
|
|
||||||
function BattleLogic.RecordEffect(caster, target, type, args, interval)
|
|
||||||
local cUid = tostring(caster.uid) or "cTeam"
|
|
||||||
local tUid = tostring(target.uid) or "tTeam"
|
|
||||||
local str = ""
|
|
||||||
for i=1, #args do
|
|
||||||
str = str..tostring(args[i]) .. (i == #args and "" or "#")
|
|
||||||
end
|
|
||||||
table.insert(record, string.format("frame:%d, caster:%s, target:%s, effectType:%d, args:%s, interval:%d", curFrame, cUid, tUid, type, str, interval))
|
|
||||||
end
|
|
||||||
|
|
||||||
--Record专用
|
|
||||||
function BattleLogic.RecordDelayTrigger(delayFrame, triggerFrame)
|
|
||||||
table.insert(record, string.format("frame:%d, delayTime:%f, triggerFrame:%d", curFrame, delayFrame, triggerFrame))
|
|
||||||
end
|
|
||||||
|
|
||||||
--Record专用
|
|
||||||
function BattleLogic.GenerateRecordFile()
|
|
||||||
local time = string.format("%d-%d-%d-%d-%d-%d",
|
|
||||||
os.date("%Y"),
|
|
||||||
os.date("%m"),
|
|
||||||
os.date("%d"),
|
|
||||||
os.date("%H"),
|
|
||||||
os.date("%M"),
|
|
||||||
os.date("%S"))
|
|
||||||
local file = io.open("BattleRecord/"..time..".txt", "a")
|
|
||||||
for i=1, #record do
|
|
||||||
file:write(record[i].."\n")
|
|
||||||
end
|
|
||||||
io.close(file)
|
|
||||||
end
|
|
||||||
|
|
|
@ -25,6 +25,8 @@ function NoDead:OnStart()
|
||||||
self.target:SetDeadFilter(false)
|
self.target:SetDeadFilter(false)
|
||||||
|
|
||||||
self.target:SetReliveFilter(self.isCanRelive)
|
self.target:SetReliveFilter(self.isCanRelive)
|
||||||
|
|
||||||
|
self.target:SetIsCanAddSkill(false)
|
||||||
end
|
end
|
||||||
|
|
||||||
--间隔N帧触发,返回true时表示继续触发,返回false立刻触发OnEnd
|
--间隔N帧触发,返回true时表示继续触发,返回false立刻触发OnEnd
|
||||||
|
@ -36,6 +38,8 @@ end
|
||||||
function NoDead:OnEnd()
|
function NoDead:OnEnd()
|
||||||
self.target.Event:AddEvent(BattleEventName.PassiveDamaging, self.onPassiveDamaging, self)
|
self.target.Event:AddEvent(BattleEventName.PassiveDamaging, self.onPassiveDamaging, self)
|
||||||
self.target:SetDeadFilter(true)
|
self.target:SetDeadFilter(true)
|
||||||
|
|
||||||
|
-- self.target:SetIsCanAddSkill(false)
|
||||||
end
|
end
|
||||||
|
|
||||||
--只有当cover字段为true时触发,返回true则被新效果覆盖
|
--只有当cover字段为true时触发,返回true则被新效果覆盖
|
||||||
|
|
|
@ -27,9 +27,6 @@ function BattleUtil.FP_Mul(...)
|
||||||
for i, v in ipairs{...} do
|
for i, v in ipairs{...} do
|
||||||
f = floor(f * v * 100000 + 0.5) / 100000
|
f = floor(f * v * 100000 + 0.5) / 100000
|
||||||
end
|
end
|
||||||
if BattleLogic.IsOpenBattleRecord then
|
|
||||||
BattleLogic.RecordMul({...})
|
|
||||||
end
|
|
||||||
return f
|
return f
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -227,6 +224,11 @@ function BattleUtil.ChooseTarget(role, chooseId)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- table.sort(finalArr, function(a, b)
|
||||||
|
-- return a.position < b.position
|
||||||
|
-- end)
|
||||||
|
|
||||||
return finalArr
|
return finalArr
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -363,6 +365,18 @@ function BattleUtil.FinalDamage(skill, atkRole, defRole, damage, bCrit, damageTy
|
||||||
defRole.Event:DispatchEvent(BattleEventName.RoleBeHit, atkRole, damage, bCrit, finalDmg, damageType, skill)
|
defRole.Event:DispatchEvent(BattleEventName.RoleBeHit, atkRole, damage, bCrit, finalDmg, damageType, skill)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--
|
||||||
|
BattleLogManager.Log(
|
||||||
|
"Final Damage",
|
||||||
|
"acamp", atkRole.camp,
|
||||||
|
"apos", atkRole.position,
|
||||||
|
"tcamp", defRole.camp,
|
||||||
|
"tpos", defRole.position,
|
||||||
|
"damage", damage,
|
||||||
|
"dotType", tostring(dotType)
|
||||||
|
)
|
||||||
|
|
||||||
return finalDmg
|
return finalDmg
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -438,6 +452,10 @@ function BattleUtil.CalDamage(skill, atkRole, defRole, damageType, baseFactor, i
|
||||||
atkRole.Event:DispatchEvent(BattleEventName.RoleDamageAfter, defRole, damageFunc, fixDamage)
|
atkRole.Event:DispatchEvent(BattleEventName.RoleDamageAfter, defRole, damageFunc, fixDamage)
|
||||||
defRole.Event:DispatchEvent(BattleEventName.RoleBeDamagedAfter, atkRole, damageFunc, fixDamage)
|
defRole.Event:DispatchEvent(BattleEventName.RoleBeDamagedAfter, atkRole, damageFunc, fixDamage)
|
||||||
|
|
||||||
|
|
||||||
|
fixDamage = max(floor(attack * 0.1), fixDamage)
|
||||||
|
|
||||||
|
|
||||||
local finalDmg = 0 --计算实际造成的扣血
|
local finalDmg = 0 --计算实际造成的扣血
|
||||||
if not defRole:IsRealDead() then
|
if not defRole:IsRealDead() then
|
||||||
finalDmg = BattleUtil.ApplyDamage(skill, atkRole, defRole, fixDamage, bCrit, damageType, dotType)
|
finalDmg = BattleUtil.ApplyDamage(skill, atkRole, defRole, fixDamage, bCrit, damageType, dotType)
|
||||||
|
@ -494,6 +512,16 @@ function BattleUtil.ApplyTreat(castRole, targetRole, value, baseFactor)
|
||||||
end
|
end
|
||||||
castRole.Event:DispatchEvent(BattleEventName.RoleTreat, targetRole, treat, baseTreat)
|
castRole.Event:DispatchEvent(BattleEventName.RoleTreat, targetRole, treat, baseTreat)
|
||||||
targetRole.Event:DispatchEvent(BattleEventName.RoleBeTreated, castRole, treat, baseTreat)
|
targetRole.Event:DispatchEvent(BattleEventName.RoleBeTreated, castRole, treat, baseTreat)
|
||||||
|
|
||||||
|
--
|
||||||
|
BattleLogManager.Log(
|
||||||
|
"Final Damage",
|
||||||
|
"acamp", castRole.camp,
|
||||||
|
"apos", castRole.position,
|
||||||
|
"tcamp", targetRole.camp,
|
||||||
|
"tpos", targetRole.position,
|
||||||
|
"value", value
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -713,9 +741,9 @@ end
|
||||||
-- 根据位置类型获取数据
|
-- 根据位置类型获取数据
|
||||||
function BattleUtil.GetRoleListByPosType(camp, posType)
|
function BattleUtil.GetRoleListByPosType(camp, posType)
|
||||||
if posType == 1 then
|
if posType == 1 then
|
||||||
return RoleManager.Query(function (r) return r.camp ~= camp and r.position <= 3 end)
|
return RoleManager.Query(function (r) return r.camp == camp and r.position <= 3 end)
|
||||||
elseif posType == 2 then
|
elseif posType == 2 then
|
||||||
return RoleManager.Query(function (r) return r.camp ~= camp and r.position > 3 end)
|
return RoleManager.Query(function (r) return r.camp == camp and r.position > 3 end)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
--战斗外数据管理、
|
--战斗外数据管理、
|
||||||
OutDataManager = {}
|
OutDataManager = {}
|
||||||
local this = OutDataManager
|
local this = OutDataManager
|
||||||
--
|
|
||||||
|
|
||||||
local function _Split(input, delimiter)
|
local function _Split(input, delimiter)
|
||||||
input = tostring(input)
|
input = tostring(input)
|
||||||
|
|
|
@ -18,7 +18,7 @@ function RoleLogic.New()
|
||||||
exCalDmgList=BattleList.New(),
|
exCalDmgList=BattleList.New(),
|
||||||
proTranList=BattleList.New(),
|
proTranList=BattleList.New(),
|
||||||
buffFilter=BattleList.New(),
|
buffFilter=BattleList.New(),
|
||||||
Event=BattleEvent:New(),passiveList={},isDead=false,IsDebug=false}
|
Event = BattleEvent:New(),passiveList={},isDead=false,IsDebug=false}
|
||||||
setmetatable(instance, RoleLogic)
|
setmetatable(instance, RoleLogic)
|
||||||
return instance
|
return instance
|
||||||
end
|
end
|
||||||
|
@ -36,6 +36,7 @@ function RoleLogic:Init(uid, data, position)
|
||||||
self.name = data.name
|
self.name = data.name
|
||||||
self.element = data.element
|
self.element = data.element
|
||||||
self.professionId = data.professionId
|
self.professionId = data.professionId
|
||||||
|
self.star = data.star or 1
|
||||||
|
|
||||||
self.shield:Clear() --护盾列表
|
self.shield:Clear() --护盾列表
|
||||||
self.exCalDmgList:Clear() --额外计算伤害列表
|
self.exCalDmgList:Clear() --额外计算伤害列表
|
||||||
|
@ -100,6 +101,8 @@ function RoleLogic:Init(uid, data, position)
|
||||||
|
|
||||||
self.reliveFilter = true -- 控制复活的标志位,置为false角色将不再享受复活效果
|
self.reliveFilter = true -- 控制复活的标志位,置为false角色将不再享受复活效果
|
||||||
self.reliveHPF = 1
|
self.reliveHPF = 1
|
||||||
|
|
||||||
|
self.IsCanAddSkill = true -- 是否可以追加技能
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 添加一个被动技能
|
-- 添加一个被动技能
|
||||||
|
@ -350,13 +353,39 @@ end
|
||||||
-- isAdd 是否是追加技能
|
-- isAdd 是否是追加技能
|
||||||
-- isRage 是否正常操作怒气值
|
-- isRage 是否正常操作怒气值
|
||||||
function RoleLogic:AddSkill(type, isRage, isAdd, targets)
|
function RoleLogic:AddSkill(type, isRage, isAdd, targets)
|
||||||
|
if not self.IsCanAddSkill and isAdd then return end
|
||||||
local effectData = type == BattleSkillType.Normal and self.skill or self.superSkill
|
local effectData = type == BattleSkillType.Normal and self.skill or self.superSkill
|
||||||
SkillManager.AddSkill(self, effectData, type, targets, isAdd, isRage)
|
SkillManager.AddSkill(self, effectData, type, targets, isAdd, isRage)
|
||||||
|
--
|
||||||
|
BattleLogManager.Log(
|
||||||
|
"Add Skill",
|
||||||
|
"camp", self.camp,
|
||||||
|
"pos", self.position,
|
||||||
|
"type", type,
|
||||||
|
"isRage", tostring(isRage),
|
||||||
|
"isAdd", tostring(isAdd),
|
||||||
|
"targets", targets and #targets or "0"
|
||||||
|
)
|
||||||
end
|
end
|
||||||
-- 插入一个技能
|
-- 插入一个技能
|
||||||
function RoleLogic:InsertSkill(type, isRage, isAdd, targets)
|
function RoleLogic:InsertSkill(type, isRage, isAdd, targets)
|
||||||
|
if not self.IsCanAddSkill and isAdd then return end
|
||||||
local effectData = type == BattleSkillType.Normal and self.skill or self.superSkill
|
local effectData = type == BattleSkillType.Normal and self.skill or self.superSkill
|
||||||
SkillManager.InsertSkill(self, effectData, type, targets, isAdd, isRage)
|
SkillManager.InsertSkill(self, effectData, type, targets, isAdd, isRage)
|
||||||
|
--
|
||||||
|
BattleLogManager.Log(
|
||||||
|
"Insert Skill",
|
||||||
|
"camp", self.camp,
|
||||||
|
"pos", self.position,
|
||||||
|
"type", type,
|
||||||
|
"isRage", tostring(isRage),
|
||||||
|
"isAdd", tostring(isAdd),
|
||||||
|
"targets", targets and #targets or "0"
|
||||||
|
)
|
||||||
|
end
|
||||||
|
-- 设置是否可以追加技能
|
||||||
|
function RoleLogic:SetIsCanAddSkill(isCan)
|
||||||
|
self.IsCanAddSkill = isCan
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -149,6 +149,9 @@ function RoleManager.Query(func, inCludeDeadRole)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
table.sort(list, function(a, b)
|
||||||
|
return a.position < b.position
|
||||||
|
end)
|
||||||
return list
|
return list
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -245,6 +248,9 @@ function this.GetArrAggroList(role, arr)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
table.sort(targetList, function(a, b)
|
||||||
|
return a.position < b.position
|
||||||
|
end)
|
||||||
return targetList
|
return targetList
|
||||||
end
|
end
|
||||||
--获取对位相邻站位的人 chooseType 1 我方 2 敌方(对位的敌人受到嘲讽的影响,若对位的敌人死亡,则选取相邻最近的作为目标)
|
--获取对位相邻站位的人 chooseType 1 我方 2 敌方(对位的敌人受到嘲讽的影响,若对位的敌人死亡,则选取相邻最近的作为目标)
|
||||||
|
@ -272,6 +278,9 @@ function this.GetNeighbor(role, chooseType)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
table.sort(posList, function(a, b)
|
||||||
|
return a.position < b.position
|
||||||
|
end)
|
||||||
return posList
|
return posList
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -3170,14 +3170,10 @@ public class MapLogic {
|
||||||
if(map instanceof TowerMap){
|
if(map instanceof TowerMap){
|
||||||
int curXY = mapManager.getCurXY();
|
int curXY = mapManager.getCurXY();
|
||||||
int floor = mapManager.getTrialInfo().getFloor();
|
int floor = mapManager.getTrialInfo().getFloor();
|
||||||
if(floor>10000){
|
TreeMap<Integer, STrialConfig> sTrialConfigMap = (TreeMap<Integer,STrialConfig>)STrialConfig.sTrialConfigMap;
|
||||||
STrialwelfareConfig welfareConfig = STrialwelfareConfig.sTrialwelfareConfigMap.get(floor % 10000);
|
STrialConfig sTrialConfig = sTrialConfigMap.ceilingEntry(floor).getValue();
|
||||||
drop = getBoxReward(welfareConfig.getBoxPosition(),welfareConfig.getBoxReward(),user,curXY,type);
|
|
||||||
}else{
|
|
||||||
STrialConfig sTrialConfig = STrialConfig.sTrialConfigMap.get(floor);
|
|
||||||
drop = getBoxReward(sTrialConfig.getBoxPosition(),sTrialConfig.getBoxReward(),user,curXY,type);
|
drop = getBoxReward(sTrialConfig.getBoxPosition(),sTrialConfig.getBoxReward(),user,curXY,type);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if(drop==null){
|
if(drop==null){
|
||||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -176,32 +176,36 @@ public class TowerMap extends AbstractMap {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int floor = mapManager.getTrialInfo().getFloor();
|
int floor = mapManager.getTrialInfo().getFloor();
|
||||||
|
STrialConfig sTrialConfig;
|
||||||
if(floor>10000){
|
if(floor>10000){
|
||||||
int realFloor = floor%10000;
|
// int realFloor = floor%10000;
|
||||||
Map<Integer,STrialwelfareConfig> welfareMap = STableManager.getConfig(STrialwelfareConfig.class);
|
// Map<Integer,STrialwelfareConfig> welfareMap = STableManager.getConfig(STrialwelfareConfig.class);
|
||||||
STrialwelfareConfig useConfig = null;
|
// STrialwelfareConfig useConfig = null;
|
||||||
for(STrialwelfareConfig config :welfareMap.values()){
|
// for(STrialwelfareConfig config :welfareMap.values()){
|
||||||
int[] section = config.getSection();
|
// int[] section = config.getSection();
|
||||||
if(realFloor>section[0]&&realFloor<=section[1]){
|
// if(realFloor>section[0]&&realFloor<=section[1]){
|
||||||
useConfig = config;
|
// useConfig = config;
|
||||||
break;
|
// break;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// Map<Integer, Cell> newMap = new HashMap<>();
|
||||||
|
// if(useConfig!=null&&useConfig.getBoxPosition()!=null){
|
||||||
|
// for(int[] position:useConfig.getBoxPosition()){
|
||||||
|
// int cellXY = CellUtil.xy2Pos(position[0], position[1]);
|
||||||
|
// Cell cell = new Cell(cellXY,0,STrialSetting.sTrialSetting.getBoxPointId());
|
||||||
|
// newMap.put(cellXY,cell);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// //生成普通传送门
|
||||||
|
|
||||||
|
// mapManager.setMapInfo(newMap);
|
||||||
|
// return;
|
||||||
|
|
||||||
|
TreeMap<Integer,STrialConfig> sTrialConfigMap = (TreeMap<Integer,STrialConfig>) STrialConfig.sTrialConfigMap;
|
||||||
|
sTrialConfig = sTrialConfigMap.ceilingEntry(floor).getValue();
|
||||||
|
}else{
|
||||||
|
sTrialConfig = STrialConfig.sTrialConfigMap.get(floor);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
Map<Integer, Cell> newMap = new HashMap<>();
|
|
||||||
if(useConfig!=null&&useConfig.getBoxPosition()!=null){
|
|
||||||
for(int[] position:useConfig.getBoxPosition()){
|
|
||||||
int cellXY = CellUtil.xy2Pos(position[0], position[1]);
|
|
||||||
Cell cell = new Cell(cellXY,0,STrialSetting.sTrialSetting.getBoxPointId());
|
|
||||||
newMap.put(cellXY,cell);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//生成普通传送门
|
|
||||||
Cell transport = createTransport(floor);
|
|
||||||
newMap.put(transport.getCellId(),transport);
|
|
||||||
mapManager.setMapInfo(newMap);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
STrialConfig sTrialConfig = STrialConfig.sTrialConfigMap.get(floor);
|
|
||||||
if (sTrialConfig == null) {
|
if (sTrialConfig == null) {
|
||||||
LOGGER.info("initTrialMap() uid=>{} sTrialConfig == null =>{} ", user.getId(), floor);
|
LOGGER.info("initTrialMap() uid=>{} sTrialConfig == null =>{} ", user.getId(), floor);
|
||||||
return;
|
return;
|
||||||
|
@ -277,14 +281,11 @@ public class TowerMap extends AbstractMap {
|
||||||
}
|
}
|
||||||
} else if (scMap1.getEvent() == 3) {
|
} else if (scMap1.getEvent() == 3) {
|
||||||
//初始化商店
|
//初始化商店
|
||||||
int storeIndex = MathUtils.randomFromWeight(STrialConfig.sTrialConfigMap.get(mapManager.getTrialInfo().getFloor()).getRandomStore());
|
int storeIndex = MathUtils.randomFromWeight(sTrialConfig.getRandomStore());
|
||||||
StoreLogic.initOrUpdateOneStore(user,8,storeIndex);
|
StoreLogic.initOrUpdateOneStore(user,8,storeIndex);
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (cellMap3.size() < sTrialConfig.getGameCount()[2]) {
|
while (cellMap3.size() < sTrialConfig.getGameCount()[2]) {
|
||||||
i++;
|
i++;
|
||||||
if (i >= 10000) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
int randomIndex = random.nextInt(scMap1.getGroups().length);
|
int randomIndex = random.nextInt(scMap1.getGroups().length);
|
||||||
int x = scMap1.getGroups()[randomIndex][0];
|
int x = scMap1.getGroups()[randomIndex][0];
|
||||||
int y = scMap1.getGroups()[randomIndex][1];
|
int y = scMap1.getGroups()[randomIndex][1];
|
||||||
|
@ -331,6 +332,11 @@ public class TowerMap extends AbstractMap {
|
||||||
newMap.putAll(cellMap3);
|
newMap.putAll(cellMap3);
|
||||||
newMap.putAll(cellMap4);
|
newMap.putAll(cellMap4);
|
||||||
}
|
}
|
||||||
|
//大于10000要生成传送门
|
||||||
|
if(floor>10000){
|
||||||
|
Cell transport = createTransport(floor);
|
||||||
|
newMap.put(transport.getCellId(),transport);
|
||||||
|
}
|
||||||
SChallengeMapConfig challengeMapConfig = STableManager.getConfig(SChallengeMapConfig.class).get(sTrialConfig.getMapId());
|
SChallengeMapConfig challengeMapConfig = STableManager.getConfig(SChallengeMapConfig.class).get(sTrialConfig.getMapId());
|
||||||
int xy = CellUtil.xy2Pos(challengeMapConfig.getPosition()[0], challengeMapConfig.getPosition()[1]);
|
int xy = CellUtil.xy2Pos(challengeMapConfig.getPosition()[0], challengeMapConfig.getPosition()[1]);
|
||||||
mapManager.setCurXY(xy);
|
mapManager.setCurXY(xy);
|
||||||
|
@ -465,7 +471,7 @@ public class TowerMap extends AbstractMap {
|
||||||
private Cell createTransport(int floor){
|
private Cell createTransport(int floor){
|
||||||
int transportPoint;
|
int transportPoint;
|
||||||
//是否为5层整数倍
|
//是否为5层整数倍
|
||||||
if(floor%5==0&&floor<10000){
|
if(floor%2==0&&floor<10000){
|
||||||
//如果是则进行随机
|
//如果是则进行随机
|
||||||
int[] treasureProbability = STrialSetting.sTrialSetting.getTreasureProbability();
|
int[] treasureProbability = STrialSetting.sTrialSetting.getTreasureProbability();
|
||||||
int[] transportPointId= STrialSetting.sTrialSetting.getTransportPoint();
|
int[] transportPointId= STrialSetting.sTrialSetting.getTransportPoint();
|
||||||
|
|
|
@ -654,6 +654,10 @@ public class PlayerLogic {
|
||||||
}
|
}
|
||||||
builder.setForce(HeroLogic.getInstance().calForce(heroNotBufferAttribute));
|
builder.setForce(HeroLogic.getInstance().calForce(heroNotBufferAttribute));
|
||||||
builder.setHero(CBean2Proto.getHero(hero));
|
builder.setHero(CBean2Proto.getHero(hero));
|
||||||
|
Map<Integer, Integer> guildSkill = userInMem.getGuildMyInfo().getGuildSkill();
|
||||||
|
int profession = SCHero.getsCHero().get(hero.getTemplateId()).getProfession();
|
||||||
|
Integer skill = guildSkill.getOrDefault(profession, 0);
|
||||||
|
builder.setGuildSkill(skill);
|
||||||
MessageUtil.sendMessage(session,1,resMsgId,builder.build(),true);
|
MessageUtil.sendMessage(session,1,resMsgId,builder.build(),true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,69 +0,0 @@
|
||||||
package config;
|
|
||||||
|
|
||||||
import manager.STableManager;
|
|
||||||
import manager.Table;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@Table(name ="TrialwelfareConfig")
|
|
||||||
public class STrialwelfareConfig implements BaseConfig {
|
|
||||||
|
|
||||||
private int id;
|
|
||||||
|
|
||||||
private int[] section;
|
|
||||||
|
|
||||||
private int mapId;
|
|
||||||
|
|
||||||
private int[][] randomMonsterType;
|
|
||||||
|
|
||||||
private int[] monsterCount;
|
|
||||||
|
|
||||||
private int[][][] boxReward;
|
|
||||||
|
|
||||||
private int[][] boxPosition;
|
|
||||||
|
|
||||||
public static Map<Integer,STrialwelfareConfig> sTrialwelfareConfigMap = new HashMap<>();
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void init() throws Exception {
|
|
||||||
Map<Integer, STrialwelfareConfig> config = STableManager.getConfig(STrialwelfareConfig.class);
|
|
||||||
for(STrialwelfareConfig value:config.values()){
|
|
||||||
int[] section = value.getSection();
|
|
||||||
for(int i = section[0];i <= section[1];i++){
|
|
||||||
sTrialwelfareConfigMap.put(i,value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public int getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int[] getSection() {
|
|
||||||
return section;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getMapId() {
|
|
||||||
return mapId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int[][] getRandomMonsterType() {
|
|
||||||
return randomMonsterType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int[] getMonsterCount() {
|
|
||||||
return monsterCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int[][][] getBoxReward() {
|
|
||||||
return boxReward;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int[][] getBoxPosition() {
|
|
||||||
return boxPosition;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in New Issue