xiyou_sanguo
zhangjiannan 2025-12-29 18:46:10 +08:00
parent 033c0c6384
commit d6b66729f3
8 changed files with 967 additions and 907 deletions

View File

@ -25,6 +25,8 @@ ServerConfigManager.SettingConfig = {
IS_NO_NOTICE = "IS_NO_NOTICE", -- 是否禁用公告
INNER_WEB_CONTROL = "INNER_WEB_CONTROL", -- 是否使用内置浏览器
IS_NULL = "IS_NULL", -- 使用C#判断物体是否销毁
SHOW_EMAIL_SETTING = "SHOW_EMAIL_SETTING", -- 设置显示反馈邮箱
SHOW_EMAIL_LOGIN = "SHOW_EMAIL_LOGIN", -- 登录显示反馈邮箱
}

View File

@ -9,12 +9,25 @@ local max = math.max
local min = math.min
function RoleLogic.New()
local instance = {uid=0,roleData=0,data=RoleData.New(),camp=0,name=0,aiIndex=1,position=0,sp=0,spPass=0,
shield=BattleList.New(),
exCalDmgList=BattleList.New(),
proTranList=BattleList.New(),
buffFilter=BattleList.New(),
Event = BattleEvent:New(),passiveList={},isDead=false,IsDebug=false}
local instance = {
uid = 0,
roleData = 0,
data = RoleData.New(),
camp = 0,
name = 0,
aiIndex = 1,
position = 0,
sp = 0,
spPass = 0,
shield = BattleList.New(),
exCalDmgList = BattleList.New(),
proTranList = BattleList.New(),
buffFilter = BattleList.New(),
Event = BattleEvent:New(),
passiveList = {},
isDead = false,
IsDebug = false
}
setmetatable(instance, RoleLogic)
return instance
end
@ -24,157 +37,157 @@ function RoleLogic:Init(uid, data, position)
self.uid = uid
self.position = position
self.roleData = data
self.roleId=data.roleId
self.roleId = data.roleId
self.data:Init(self, data.property)
self.isDead = self:GetRoleData(RoleDataName.Hp) <= 0
self.isRealDead = self.isDead
self.killDamage = 0 --致死伤害
self.killDamage = 0 --致死伤害
self.deadRage = 0
self.teamDamage = data.teamDamage --最高战斗力
self.superSkillDamage = 0 --技能伤害
self.killRole=nil --击杀英雄
self.camp = data.camp --阵营 0我方 1敌方
self.superSkillDamage = 0 --技能伤害
self.killRole = nil --击杀英雄
self.camp = data.camp --阵营 0我方 1敌方
self.name = data.name
self.element = data.element
self.professionId = data.professionId
self.job=data.job
self.job = data.job
self.star = data.star or 1
-- LogError("英雄uid".. self.roleId .." " .. self.star)
self.shield:Clear() --护盾列表
self.shield:Clear() --护盾列表
self.exCalDmgList:Clear() --额外计算伤害列表
self.buffFilter:Clear() --buff屏蔽列表
self.proTranList:Clear() --属性转换列表
self.buffFilter:Clear() --buff屏蔽列表
self.proTranList:Clear() --属性转换列表
self.isHaveNoDead = false --是否有不灭
self.Event:ClearEvent()
self.skill = data.skill
if self.skill then
self.skill[1] = tonumber(self.skill[1])
self.skill[1] = tonumber(self.skill[1])
else
self.skill={}
self.skill = {}
self.skill[1] = 0
end
self.superSkill = data.superSkill
if self.superSkill then
self.superSkill[1] = tonumber(self.superSkill[1])
else
self.superSkill={}
self.superSkill = {}
self.superSkill[1] = 0
end
self.superSkill[1] = tonumber(self.superSkill[1])
--首次读条时间=速度/20*(等级+10
self.sp = 0
local time = self:GetRoleData(RoleDataName.Speed)/(20*(self:GetRoleData(RoleDataName.Level)+10))
self.spPass = floor( BattleUtil.ErrorCorrection(time) * BattleLogic.GameFrameRate)
local time = self:GetRoleData(RoleDataName.Speed) / (20 * (self:GetRoleData(RoleDataName.Level) + 10))
self.spPass = floor(BattleUtil.ErrorCorrection(time) * BattleLogic.GameFrameRate)
-- 初始化怒气值默认2
self.Rage = 2
self.RageGrow = 2 -- 普通技能怒气成长
self.SuperSkillRage = 4 -- 技能需要释放的怒气值默认为4
self.NoRageRate = 0 -- 不消耗怒气值的概率
self.isImmuneReduceRage=false --是否免疫减怒
self.RageGrow = 2 -- 普通技能怒气成长
self.SuperSkillRage = 4 -- 技能需要释放的怒气值默认为4
self.NoRageRate = 0 -- 不消耗怒气值的概率
self.isImmuneReduceRage = false --是否免疫减怒
self.aiOrder = data.ai
self.aiIndex = 1
self.aiTempCount = 0
self.RoundMaxSubRage=0 --每回合最多减少怒气
self.AllSubRage =0 -- 每回合减少的怒气
self.RoundMaxSubRage = 0 --每回合最多减少怒气
self.AllSubRage = 0 -- 每回合减少的怒气
self.IsDebug = false
self.enemyType = EnemyType.normal
self.lockTarget = nil --嘲讽
self.ctrl_lock = false --是否被嘲讽
self.ctrl_dizzy = false --眩晕 不能释放所有技能
self.ctrl_slient = false --沉默 只能1技能
self.ctrl_palsy = false --麻痹 只能2技能
self.ctrl_noheal = false --禁疗
self.ctrl_blind = false --致盲
self.ctrl_chaos = false --混乱
self.deadFilter = true -- 控制死亡置为false则角色暂时无法死亡
self.lockTarget = nil --嘲讽
self.ctrl_lock = false --是否被嘲讽
self.ctrl_dizzy = false --眩晕 不能释放所有技能
self.ctrl_slient = false --沉默 只能1技能
self.ctrl_palsy = false --麻痹 只能2技能
self.ctrl_noheal = false --禁疗
self.ctrl_blind = false --致盲
self.ctrl_chaos = false --混乱
self.deadFilter = true -- 控制死亡置为false则角色暂时无法死亡
self.isSuppress = false
self.notAction = false --无法行动
self.isExile = false --是否放逐
self.reliveFilter = true -- 控制复活的标志位置为false角色将不再享受复活效果
self.isExile = false --是否放逐
self.reliveFilter = true -- 控制复活的标志位置为false角色将不再享受复活效果
self.reliveHPF = 1
self.reliveCaster = nil
self.bloodShield = nil
self.IsCanAddSkill = true -- 是否可以追加技能
self.mustHit=false --必定命中
self.beMustHit=false --必定被命中
self.mustCrit=false --必定暴击
self.isBanBlood=false --是否禁止上御甲
self.IsCanAddSkill = true -- 是否可以追加技能
self.mustHit = false --必定命中
self.beMustHit = false --必定被命中
self.mustCrit = false --必定暴击
self.isBanBlood = false --是否禁止上御甲
self.isImmuneAllReduceShield = false --免疫敌方无敌盾(敌方无敌盾对自己无效)
self.ignoreShara = false --忽略敌方分摊
self.ignoreShara = false --忽略敌方分摊
self.type = BattleUnitType.Role
self.addAttack=0 --添加的攻击
self.isNormalAttackAddRage=true --普攻是否回复怒气
self.curMainTarget=nil --当前主目标
self.isAllBurn = false --是否视敌方全体为燃烧
self.sunTime = 0 --顺风次数
self.addAttack = 0 --添加的攻击
self.isNormalAttackAddRage = true --普攻是否回复怒气
self.curMainTarget = nil --当前主目标
self.isAllBurn = false --是否视敌方全体为燃烧
self.sunTime = 0 --顺风次数
self.sunMaxTime = 0
self.niTime = 0 --逆风次数
self.niTime = 0 --逆风次数
self.niMaxTime = 0
self.suppressTime = 0 --被压制的次数
self.suppressTime = 0 --被压制的次数
self.passiveList = {}
if data.passivity and #data.passivity > 0 then
--排序363类型的排在前面
table.sort(data.passivity,function(a,b)
if a[3]==b[3] then
return a[1] < b[1]
else
if a[3]==363 then
return true
--排序363类型的排在前面
table.sort(data.passivity, function(a, b)
if a[3] == b[3] then
return a[1] < b[1]
else
if a[3] == 363 then
return true
end
if b[3] == 363 then
return false
end
end
if b[3]==363 then
return false
end
end
return a[1] < b[1]
end)
local coverPass={}
return a[1] < b[1]
end)
local coverPass = {}
for i = 1, #data.passivity do
local v = data.passivity[i]
local v = data.passivity[i]
local passivityId = tonumber(v[1])
local judge=v[2]
local judge = v[2]
local id = tonumber(v[3])
local args = {}
for j = 4, #v do
args[j-3] = v[j]
args[j - 3] = v[j]
end
--如果时363类型得被动就存起来
if id==363 then
if id == 363 then
if coverPass[args[1]] then
table.insert(coverPass[args[1]],args)
table.insert(coverPass[args[1]], args)
else
coverPass[args[1]]={}
table.insert(coverPass[args[1]],args)
coverPass[args[1]] = {}
table.insert(coverPass[args[1]], args)
end
else
--如果有363修改的被动就修改
if coverPass[passivityId] then
local list=coverPass[passivityId]
for i = 1, #list do
local coverArgs=list[i]
local len=floor((#coverArgs-1)/2)
for i = 1, len do
local id=0
if #coverArgs>i+i then
id=coverArgs[i+i]
end
local value=0
if #coverArgs>=i+i+1 then
value=coverArgs[i+i+1]
end
if id~=0 and #args>=id and args[id] then
args[id]=value
--如果有363修改的被动就修改
if coverPass[passivityId] then
local list = coverPass[passivityId]
for i = 1, #list do
local coverArgs = list[i]
local len = floor((#coverArgs - 1) / 2)
for i = 1, len do
local id = 0
if #coverArgs > i + i then
id = coverArgs[i + i]
end
local value = 0
if #coverArgs >= i + i + 1 then
value = coverArgs[i + i + 1]
end
if id ~= 0 and #args >= id and args[id] then
args[id] = value
end
end
end
end
end
end
end
if BattleUtil.Passivity[id] then
BattleUtil.Passivity[id](self, args,passivityId,judge)
BattleUtil.Passivity[id](self, args, passivityId, judge)
BattleLogManager.Log(
"Add Passive",
"id", tostring(id),
@ -184,30 +197,30 @@ function RoleLogic:Init(uid, data, position)
"judge", tostring(judge)
)
-- 加入被动列表
table.insert(self.passiveList, {id, args,passivityId})
table.insert(self.passiveList, { id, args, passivityId })
end
end
end
-- 初始怒气值放在被动之后计算,使被动对初始怒气的影响生效
self.Rage = self.Rage + self:GetRoleData(RoleDataName.InitRage)-- 当前怒气值
-- 初始怒气值放在被动之后计算,使被动对初始怒气的影响生效
self.Rage = self.Rage + self:GetRoleData(RoleDataName.InitRage) -- 当前怒气值
end
-- 根据被动id添加被动
function RoleLogic:AddPassiveById(id)
local config=ConfigManager.GetConfigData(ConfigName.PassiveSkillLogicConfig,id)
local config = ConfigManager.GetConfigData(ConfigName.PassiveSkillLogicConfig, id)
if not config then
return
return
end
local value=config.Value
local value = config.Value
if not value then
return
return
end
-- 被动生效
BattleUtil.Passivity[config.Type](self,value,id,config.Judge)
BattleUtil.Passivity[config.Type](self, value, id, config.Judge)
-- 加入被动列表
table.insert(self.passiveList, {id, value,id,config.judge})
table.insert(self.passiveList, { id, value, id, config.judge })
end
-- 添加一个被动技能
function RoleLogic:AddPassive(id, args, isRepeat)
--判断是否可以叠加
@ -215,17 +228,17 @@ function RoleLogic:AddPassive(id, args, isRepeat)
-- 不可以叠加, 如果重复则不再加入
for _, pst in ipairs(self.passiveList) do
if pst[1] == id then
return
return
end
end
end
-- 被动生效
BattleUtil.Passivity[id](self, args)
-- 加入被动列表
table.insert(self.passiveList, {id, args})
table.insert(self.passiveList, { id, args })
end
--
--
function RoleLogic:CanCastSkill()
return self.sp >= self.spPass and not self.IsDebug
end
@ -233,12 +246,12 @@ end
--检测是否有某被动类型
function RoleLogic:CheckHavePassive(id)
if self.passiveList then
for index, value in ipairs(self.passiveList) do
if value and value[1] and value[1]==id then
return true
end
end
return false
for index, value in ipairs(self.passiveList) do
if value and value[1] and value[1] == id then
return true
end
end
return false
end
return false
end
@ -246,12 +259,12 @@ end
--检测是否有某被动
function RoleLogic:CheckHavePassiveId(id)
if self.passiveList then
for index, value in ipairs(self.passiveList) do
if value and value[3] and value[3]==id then
return true
end
end
return false
for index, value in ipairs(self.passiveList) do
if value and value[3] and value[3] == id then
return true
end
end
return false
end
return false
end
@ -270,7 +283,7 @@ function RoleLogic:AddSkillCD(value, type)
local cdTotal = self.spPass
local delta = 0
if type == 1 then --加算
if type == 1 then --加算
delta = floor(value * BattleLogic.GameFrameRate)
elseif type == 2 then --乘加算(百分比属性加算)
delta = floor(value * cdTotal)
@ -282,7 +295,7 @@ function RoleLogic:AddSkillCD(value, type)
if delta > 0 then --加cd加cd最大值
self.spPass = self.spPass + delta
else --减cd减cd当前值
else --减cd减cd当前值
delta = -delta
self.sp = min(self.sp + delta, self.spPass)
end
@ -291,7 +304,7 @@ end
-- 改变怒气值
function RoleLogic:AddRage(value, type)
local delta = 0
if type == 1 then --加算
if type == 1 then --加算
delta = value
elseif type == 2 then --乘加算(百分比属性加算)
delta = floor(value * self.SuperSkillRage)
@ -300,7 +313,7 @@ function RoleLogic:AddRage(value, type)
elseif type == 4 then --乘减算(百分比属性减算)
delta = -floor(value * self.SuperSkillRage)
end
self.Event:DispatchEvent(BattleEventName.RoleRageChange, delta,self.Rage)
self.Event:DispatchEvent(BattleEventName.RoleRageChange, delta, self.Rage)
--怒气值不可为负值
self.Rage = max(self.Rage + delta, 0)
@ -309,12 +322,15 @@ end
function RoleLogic:GetRoleData(property)
local tarPro = self.data:GetData(property)
if property == 4 then
LogError("bbbbbbbbbbbbbbbbbbb" .. tarPro)
end
local item
for i=1, self.proTranList.size do
for i = 1, self.proTranList.size do
item = self.proTranList.buffer[i]
if item.proName == property then
local value
if item.changeType == 1 then --加算
if item.changeType == 1 then --加算
value = item.tranFactor
elseif item.changeType == 2 then --乘加算(百分比属性加算)
value = BattleUtil.ErrorCorrection(self.data:GetData(item.tranProName) * item.tranFactor)
@ -332,16 +348,17 @@ end
--proA替换的属性factor系数proB被替换的属性, duration持续时间
--读取proB属性时得到的值为proB + proA * factor
function RoleLogic:AddPropertyTransfer(proA, factor, proB, ct, duration)
local proTran = {proName = proB, tranProName = proA, tranFactor = factor, changeType = ct}
local proTran = { proName = proB, tranProName = proA, tranFactor = factor, changeType = ct }
self.proTranList:Add(proTran)
local index = self.proTranList.size
if duration then
BattleLogic.WaitForTrigger(duration, function ()
BattleLogic.WaitForTrigger(duration, function()
self:RemovePropertyTransfer(index, proTran)
end)
end
return index, proTran
end
-- 删除临时属性
function RoleLogic:RemovePropertyTransfer(index, tran)
if index <= self.proTranList.size and tran == self.proTranList.buffer[index] then
@ -350,27 +367,26 @@ function RoleLogic:RemovePropertyTransfer(index, tran)
end
-- 是否为指定id指定星级的英雄 by:王振兴 2020/07/29
function RoleLogic:IsAssignHeroAndHeroStar(id,star)
if self.roleId==id and self.star==star then
function RoleLogic:IsAssignHeroAndHeroStar(id, star)
if self.roleId == id and self.star == star then
return true
end
return false
end
function RoleLogic:AddBuff(buff,_ignorePro)
function RoleLogic:AddBuff(buff, _ignorePro)
if self:IsRealDead() then
BattleLogic.BuffMgr:PutBuff(buff)
return
end
local isBan=false
local isBan = false
local function banCallBack(_isBan)
isBan=_isBan
isBan = _isBan
end
BattleLogic.Event:DispatchEvent(BattleEventName.RoleAddBuffCheckBan,banCallBack,self,buff)
BattleLogic.Event:DispatchEvent(BattleEventName.RoleAddBuffCheckBan, banCallBack, self, buff)
if isBan then
self.Event:DispatchEvent(BattleEventName.ShowHintText, BattleArtFontType.Blood)
return
return
end
-- buff的miss率
local missF = 0
@ -378,7 +394,7 @@ function RoleLogic:AddBuff(buff,_ignorePro)
local cl = {}
local function _CallBack(v, ct)
if v then
table.insert(cl, {v, ct})
table.insert(cl, { v, ct })
end
end
BattleLogic.Event:DispatchEvent(BattleEventName.RoleAddBuffMiss, _CallBack, self, buff)
@ -389,31 +405,30 @@ function RoleLogic:AddBuff(buff,_ignorePro)
"missF", missF)
-- 如果概率为0 或者没有miss
if missF == 0 or not BattleUtil.RandomAction(missF, function() BattleLogic.BuffMgr:PutBuff(buff) end) then
--概率忽略免疫
local ignoreProb=0
local ignoreProb = 0
if _ignorePro then
ignoreProb=_ignorePro
ignoreProb = _ignorePro
end
local changeIgnore=function(v1,ct)
ignoreProb=BattleUtil.CountValue(ignoreProb,v1,ct)
local changeIgnore = function(v1, ct)
ignoreProb = BattleUtil.CountValue(ignoreProb, v1, ct)
end
buff.caster.Event:DispatchEvent(BattleEventName.PassiveChangeIgnoreImmuneValue,changeIgnore,buff)
local isIgnor=BattleUtil.RandomAction(ignoreProb,function()end)
buff.caster.Event:DispatchEvent(BattleEventName.PassiveChangeIgnoreImmuneValue, changeIgnore, buff)
local isIgnor = BattleUtil.RandomAction(ignoreProb, function() end)
if not isIgnor then
for i=1, self.buffFilter.size do
local isImm,immCaster=self.buffFilter.buffer[i](buff,self)
for i = 1, self.buffFilter.size do
local isImm, immCaster = self.buffFilter.buffer[i](buff, self)
if isImm then
BattleLogManager.Log(
"Buff Filter",
"camp", buff.caster.camp,
"position", buff.caster.position,
"id", buff.id,
"camp", buff.caster.camp,
"position", buff.caster.position,
"id", buff.id,
"type", buff.type)
BattleLogic.BuffMgr:PutBuff(buff)
self.Event:DispatchEvent(BattleEventName.ShowHintText, BattleArtFontType.Immune)
BattleLogic.Event:DispatchEvent(BattleEventName.ImmuneDebuffSuccess,buff,self,immCaster)
BattleLogic.Event:DispatchEvent(BattleEventName.RoleAddBuffFail,buff,self)
BattleLogic.Event:DispatchEvent(BattleEventName.ImmuneDebuffSuccess, buff, self, immCaster)
BattleLogic.Event:DispatchEvent(BattleEventName.RoleAddBuffFail, buff, self)
return
end
end
@ -422,29 +437,28 @@ function RoleLogic:AddBuff(buff,_ignorePro)
BattleLogic.AddRoundTriggerTime()
end
end
function RoleLogic:Dispose()
end
function RoleLogic:Dispose()
end
-- 判断角色是否可以释放技能
function RoleLogic:IsAvailable(skill)
if skill and skill.effectCaster then
--放技能前判断是否有目标,没有就不会放技能,直接执行技能回调 by 王振兴 2021/09/17
--放技能前判断是否有目标,没有就不会放技能,直接执行技能回调 by 王振兴 2021/09/17
--为解决攻击目标只剩被放逐的单位导致我方不放技能扣除怒气
skill.effectCaster:ChooseTarget()
local targets=BattleUtil.LengthOfTable(skill.effectCaster:GetDirectTargetsNoExile())
if targets==0 then
return false
local targets = BattleUtil.LengthOfTable(skill.effectCaster:GetDirectTargetsNoExile())
if targets == 0 then
return false
end
end
if self.isExile then
return false
return false
end
--角色没有真正死亡 在 被眩晕/沉默的 情况下 任然能释放死亡技能
--(self.ctrl_dizzy or self.ctrl_slient) and
if self:IsDead() and skill and skill.type==BattleSkillType.DeadSkill then
if self:IsDead() and skill and skill.type == BattleSkillType.DeadSkill then
return true
end
-- 眩晕 -- 死亡
@ -467,23 +481,21 @@ end
-- 释放技能
function RoleLogic:SkillCast(skill, func)
local _CastDone = function()
if func then
func()
if func then
func()
end
end
-- 角色不可用直接结束技能释放
if not skill or not self:IsAvailable(skill) then
self.Event:DispatchEvent(BattleEventName.ActionOperateAngerAfter,self)
self.Event:DispatchEvent(BattleEventName.ActionOperateAngerAfter, self)
_CastDone()
return
end
self.Event:DispatchEvent(BattleEventName.ActionOperateAngerBefore,self)
self.Event:DispatchEvent(BattleEventName.ActionOperateAngerBefore, self)
-- 没有麻痹,释放普通攻击
if (skill.type == BattleSkillType.Normal or skill.type ==BattleSkillType.ChaosNormal) and not self.ctrl_palsy then
if (skill.type == BattleSkillType.Normal or skill.type == BattleSkillType.ChaosNormal) and not self.ctrl_palsy then
local function _CheckRage()
-- 后成长怒气 判断普攻是否会回复怒气
if skill.isRage and self.isNormalAttackAddRage then
@ -493,23 +505,23 @@ function RoleLogic:SkillCast(skill, func)
grow = finalGrow
end
self.Event:DispatchEvent(BattleEventName.RoleRageGrow, grow, _RageGrowPassivity)
--
--
self.Rage = self.Rage + grow
end
-- 释放完成
self.Event:DispatchEvent(BattleEventName.ActionOperateAngerAfter,self)
self.Event:DispatchEvent(BattleEventName.ActionOperateAngerAfter, self)
_CastDone()
end
-- 释放普技
skill:Cast(_CheckRage)
-- 没有沉默,释放大技能
elseif (skill.type == BattleSkillType.Special or skill.type==BattleSkillType.Extra or skill.type==BattleSkillType.DeadSkill) and (not self.ctrl_slient or skill.type==BattleSkillType.DeadSkill) then
-- 没有沉默,释放大技能
elseif (skill.type == BattleSkillType.Special or skill.type == BattleSkillType.Extra or skill.type == BattleSkillType.DeadSkill) and (not self.ctrl_slient or skill.type == BattleSkillType.DeadSkill) then
-- 先消耗怒气
if skill.isRage then
if self.Rage < self.SuperSkillRage then
-- 怒气值不足不能释放技能
self.Event:DispatchEvent(BattleEventName.ActionOperateAngerAfter,self)
self.Event:DispatchEvent(BattleEventName.ActionOperateAngerAfter, self)
_CastDone()
return
end
@ -520,61 +532,59 @@ function RoleLogic:SkillCast(skill, func)
noRageRate = noRageRate + rate
costRage = costRage + cost
end
self.Event:DispatchEvent(BattleEventName.RoleRageCost, costRage, noRageRate, _RageCostPassivity,skill)
self.Event:DispatchEvent(BattleEventName.RoleRageCost, costRage, noRageRate, _RageCostPassivity, skill)
-- 计算消耗怒气的概率,并消耗怒气
local costRate = 1 - noRageRate
costRate = costRate > 1 and 1 or costRate
costRate = costRate < 0 and 0 or costRate
skill.costRage=0
skill.costRage = 0
BattleUtil.RandomAction(costRate, function()
self.Rage = self.Rage - costRage
self.Event:DispatchEvent(BattleEventName.SkillCastCostRageEnd,costRage)
skill.costRage=costRage
self.Event:DispatchEvent(BattleEventName.SkillCastCostRageEnd, costRage)
skill.costRage = costRage
end)
end
self.Event:DispatchEvent(BattleEventName.ActionOperateAngerAfter,self)
self.Event:DispatchEvent(BattleEventName.ActionOperateAngerAfter, self)
-- 释放绝技
skill:Cast(_CastDone)
-- 没有符合条件的技能直接进入下一个技能检测
-- 没有符合条件的技能直接进入下一个技能检测
else
self.Event:DispatchEvent(BattleEventName.ActionOperateAngerAfter,self)
self.Event:DispatchEvent(BattleEventName.ActionOperateAngerAfter, self)
_CastDone()
end
end
-- 加入一个技能
-- type 加入的技能类型
-- targets 指定目标
-- isAdd 是否是追加技能
-- isRage 是否正常操作怒气值
function RoleLogic:AddSkill(type, isRage, isAdd, targets,isTrigger,isLoop)
if not self.IsCanAddSkill and isAdd then return end
function RoleLogic:AddSkill(type, isRage, isAdd, targets, isTrigger, isLoop)
if not self.IsCanAddSkill and isAdd then return end
local effectData = type == BattleSkillType.Normal and self.skill or self.superSkill
--角色被混乱后
local isTriggerJudge=true
if isTrigger~=nil then
isTriggerJudge=isTrigger
local isTriggerJudge = true
if isTrigger ~= nil then
isTriggerJudge = isTrigger
end
if self.ctrl_chaos then
type=BattleSkillType.ChaosNormal
type = BattleSkillType.ChaosNormal
--混乱普攻使用普攻特效
effectData={self.skill[1],self.skill[2],self.skill[3],self.skill[4],{100001,{1,1,1}}}
isTriggerJudge=false
effectData = { self.skill[1], self.skill[2], self.skill[3], self.skill[4], { 100001, { 1, 1, 1 } } }
isTriggerJudge = false
end
if self.ctrl_lock then
type=BattleSkillType.ChaosNormal
type = BattleSkillType.ChaosNormal
--嘲讽普攻使用普攻特效
effectData={self.skill[1],self.skill[2],self.skill[3],self.skill[4],{200221,{1,1,1}}}
isTriggerJudge=false
effectData = { self.skill[1], self.skill[2], self.skill[3], self.skill[4], { 200221, { 1, 1, 1 } } }
isTriggerJudge = false
end
SkillManager.AddSkill(self, effectData, type, targets, isAdd, isRage,isTriggerJudge,isLoop)
--
SkillManager.AddSkill(self, effectData, type, targets, isAdd, isRage, isTriggerJudge, isLoop)
--
end
-- 加入一个技能
@ -582,90 +592,89 @@ end
-- targets 指定目标
-- isAdd 是否是追加技能
-- isRage 是否正常操作怒气值
function RoleLogic:AddSuperSkill(isRage, isAdd, targets,isTrigger,isLoop,scale)
if not self.IsCanAddSkill and isAdd then return end
function RoleLogic:AddSuperSkill(isRage, isAdd, targets, isTrigger, isLoop, scale)
if not self.IsCanAddSkill and isAdd then return end
local effectData = self.superSkill
--角色被混乱后
local isTriggerJudge=true
if isTrigger~=nil then
isTriggerJudge=isTrigger
local isTriggerJudge = true
if isTrigger ~= nil then
isTriggerJudge = isTrigger
end
local type=BattleSkillType.Special
local type = BattleSkillType.Special
if self.ctrl_chaos then
type=BattleSkillType.ChaosNormal
type = BattleSkillType.ChaosNormal
--混乱普攻使用普攻特效
effectData={self.skill[1],self.skill[2],self.skill[3],self.skill[4],{100001,{1,1,1}}}
isTriggerJudge=false
effectData = { self.skill[1], self.skill[2], self.skill[3], self.skill[4], { 100001, { 1, 1, 1 } } }
isTriggerJudge = false
end
if self.ctrl_lock then
type=BattleSkillType.ChaosNormal
type = BattleSkillType.ChaosNormal
--嘲讽普攻使用普攻特效
effectData={self.skill[1],self.skill[2],self.skill[3],self.skill[4],{200221,{1,1,1}}}
isTriggerJudge=false
effectData = { self.skill[1], self.skill[2], self.skill[3], self.skill[4], { 200221, { 1, 1, 1 } } }
isTriggerJudge = false
end
local skill=SkillManager.AddSkill(self, effectData, type, targets, isAdd, isRage,isTriggerJudge,isLoop)
skill.AttactScale=scale
--
local skill = SkillManager.AddSkill(self, effectData, type, targets, isAdd, isRage, isTriggerJudge, isLoop)
skill.AttactScale = scale
--
end
--加入额外技能,用于额外释放技能 by:王振兴
function RoleLogic:InsertExtraSkill(id,type)
local effectData=BattleUtil.GetExtraSkillbyId(id)
effectData[1]=self.superSkill[1]
effectData[2]=self.superSkill[2]
effectData[3]=self.superSkill[3]
effectData[4]=self.superSkill[4]
-- local effectData2={role.,role.superSkill[2],role.superSkill[3],role.superSkill[4],{targets,{1,f1,f2}}}
function RoleLogic:InsertExtraSkill(id, type)
local effectData = BattleUtil.GetExtraSkillbyId(id)
effectData[1] = self.superSkill[1]
effectData[2] = self.superSkill[2]
effectData[3] = self.superSkill[3]
effectData[4] = self.superSkill[4]
-- local effectData2={role.,role.superSkill[2],role.superSkill[3],role.superSkill[4],{targets,{1,f1,f2}}}
if effectData then
local skillType=BattleSkillType.Extra
local skillType = BattleSkillType.Extra
--如果type为1则按绝技处理,不为1的话按额外技能处理额外技能因为被动判断会判断是否是绝技类型所以不会触发
local isTrigger=true
if type==1 then
skillType=BattleSkillType.Special
local isTrigger = true
if type == 1 then
skillType = BattleSkillType.Special
else
isTrigger=false
isTrigger = false
end
--和老史,佳琦确认果 附加技能算绝技 被沉默无法释放 可以套娃 递归触发 by:王振兴
local insertSkill=SkillManager.InsertSkill(self, effectData, skillType, nil, true, false,isTrigger)
local insertSkill = SkillManager.InsertSkill(self, effectData, skillType, nil, true, false, isTrigger)
return insertSkill
end
end
-- 插入一个技能
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
SkillManager.InsertSkill(self, effectData, type, targets, isAdd, isRage)
end
-- 设置是否可以追加技能
function RoleLogic:SetIsCanAddSkill(isCan)
self.IsCanAddSkill = isCan
end
-- 正常触发技能
function RoleLogic:CastSkill(func)
function RoleLogic:CastSkill(func)
-- 设置轮转方法
-- SkillManager.SetTurnRoundFunc(func)
if not self:IsAvailable() then
return
return
end
--如果当前怒气不足以释放绝技
if self.Rage<self.SuperSkillRage then
BattleLogic.Event:DispatchEvent(BattleEventName.RoleCastSkillBefore,self)
end
if self.Rage < self.SuperSkillRage then
BattleLogic.Event:DispatchEvent(BattleEventName.RoleCastSkillBefore, self)
end
-- 没有沉默
if not self.ctrl_slient and self.Rage >= self.SuperSkillRage then
-- 释放大技能
self:AddSkill(BattleSkillType.Special, true, false, nil)
return
return
end
-- 没有麻痹 释放普通技能
if not self.ctrl_palsy then
self:AddSkill(BattleSkillType.Normal, true, false, nil)
return
return
end
end
@ -674,18 +683,17 @@ end
-- targets 追加技能的目标 nil则自动选择目标
-- func 追加技能释放完成回调
function RoleLogic:ForceCastSkill(type, targets, func)
-- 清除技能控制
self.ctrl_dizzy = false --眩晕 不能释放技能
self.ctrl_slient = false --沉默 只能1技能
self.ctrl_palsy = false --麻痹 只能2技能
self.ctrl_dizzy = false --眩晕 不能释放技能
self.ctrl_slient = false --沉默 只能1技能
self.ctrl_palsy = false --麻痹 只能2技能
-- 设置轮转方法
SkillManager.SetTurnRoundFunc(func)
-- 释放技能
if type == 1 and self.skill then
self:AddSkill(BattleSkillType.Normal, true, false, nil)
elseif type == 2 and self.superSkill then
elseif type == 2 and self.superSkill then
if self.Rage < self.SuperSkillRage then
self.Rage = self.SuperSkillRage
end
@ -693,11 +701,10 @@ function RoleLogic:ForceCastSkill(type, targets, func)
end
end
-- 判断是否可以去死了
function RoleLogic:IsCanDead()
-- 暂时不能死
if not self.deadFilter then
if not self.deadFilter then
return false
end
-- 还有我的技能没有释放,不能死啊
@ -709,10 +716,10 @@ end
-- 真的去死
function RoleLogic:GoDead()
if self:IsCanDead() then
self.isRealDead = true
if self:IsCanDead() then
self.isRealDead = true
self.Rage = 0
self.curMainTarget=nil
self.curMainTarget = nil
BattleLogic.BuffMgr:ClearBuff(self)
self.Event:DispatchEvent(BattleEventName.RoleRealDead, self)
BattleLogic.Event:DispatchEvent(BattleEventName.RoleRealDead, self)
@ -725,21 +732,23 @@ end
function RoleLogic:SetDeadFilter(filter)
self.deadFilter = filter
end
-- 要死了
function RoleLogic:SetDead(damage)
function RoleLogic:SetDead(damage)
self.isDead = true
self.killDamage=damage
self.deadRage=self.Rage
RoleManager.AddDeadRole(self)
self.killDamage = damage
self.deadRage = self.Rage
RoleManager.AddDeadRole(self)
end
-- 判断是否死亡
function RoleLogic:IsDead()
return self.isDead
end
function RoleLogic:IsRealDead()
return self.isRealDead
end
function RoleLogic:IsRealDead()
return self.isRealDead
end
-- 是否可以复活
function RoleLogic:IsCanRelive()
@ -751,6 +760,7 @@ function RoleLogic:IsCanRelive()
end
return true
end
-- 复活吧, 真的去世后才能复活
function RoleLogic:Relive()
if self:IsCanRelive() then
@ -763,17 +773,19 @@ function RoleLogic:Relive()
-- 发送复活事件
self.Event:DispatchEvent(BattleEventName.RoleRelive, self)
--BattleLogic.Event:DispatchEvent(BattleEventName.RoleRelive, self)
self.reliveCaster.Event:DispatchEvent(BattleEventName.ReliveRole,self)
self.reliveCaster.Event:DispatchEvent(BattleEventName.ReliveRole, self)
-- 复活的血量算做加血
BattleLogic.Event:DispatchEvent(BattleEventName.RecordTreat, self.reliveCaster or self, self, reHp)
return true
end
return false
end
-- 设置是否可以死亡
function RoleLogic:SetReliveFilter(filter)
self.reliveFilter = filter
end
--,hpf 复活时拥有的血量的百分比
function RoleLogic:SetRelive(hpf, caster)
-- 判断是否可以复活
@ -795,7 +807,6 @@ function RoleLogic:SetRelive(hpf, caster)
return false
end
function RoleLogic:Update()
end
end

View File

@ -54,7 +54,12 @@ function this:InitComponent()
this.btnAgeTip:SetActive(IsUserProtoActive)
this.btnAgeTipPosition = this.btnAgeTip:GetComponent("RectTransform").localPosition
this.btnNotice:SetActive(IsShowNotice)
--反馈邮箱
this.fankui = Util.GetGameObject(this.loginPart, "fankui")
if this.fankui then
local fankuiText = this.fankui:GetComponent("Text")
fankuiText.text = ServerConfigManager.GetSettingValue(ServerConfigManager.SettingConfig.SHOW_EMAIL_LOGIN) or ""
end
---selectServerPart
this.serverSelectPart = Util.GetGameObject(this.loginPart, "serverSelect")
@ -180,7 +185,7 @@ function this:BindEvent()
"complete_change_server",
roleCreateTime = "server_name_after|" ..
tostring(this.serverList[index].server_id ..
"|server_name_before|" .. tostring(PlayerManager.serverInfo.server_id))
"|server_name_before|" .. tostring(PlayerManager.serverInfo.server_id))
})
LogError("server_name_before:" .. PlayerManager.serverInfo.name)
LogError("server_name_after:" .. tostring(this.serverList[index].name))
@ -234,7 +239,7 @@ function this:BindEvent()
end)
Util.AddClick(this.beianBtn, function()
OpenWeb("https://beian.miit.gov.cn/#/home")
OpenWeb("https://beian.miit.gov.cn/#/Integrated/index")
end)
Util.AddClick(this.ConfirmBtn, function()
local confirm = PlayerPrefs.GetInt("IHaveConfirmProtos")
@ -757,7 +762,8 @@ function this.ExecuteLoading()
"|server_id|" .. tostring(PlayerManager.serverInfo
.server_id)
})
LogError("**************************server_name|" ..tostring(PlayerManager.serverInfo.name) .."|server_id|" .. tostring(PlayerManager.serverInfo.server_id))
LogError("**************************server_name|" ..
tostring(PlayerManager.serverInfo.name) .. "|server_id|" .. tostring(PlayerManager.serverInfo.server_id))
end, --太初密卷
--[[[49] =]] function() NetManager.CrossYuXuLunDaoGetInfoRequest(2, LoadingPanel.OnStep) end, --玉虚论道红点
--[[[50] =]] function() NetManager.GetLikeableDataRequest(LoadingPanel.OnStep) end, --好感度

View File

@ -231,11 +231,14 @@ function GodsWayTowerPanel:OnShow()
curId = ActivityGiftManager.GetActivityIdByType(ActivityTypeDef.godsWayTowerTreasure_two)
this.becomeAGodText1.gameObject:SetActive(true)
this.becomeAGodText.gameObject:SetActive(false)
this.btnRank.gameObject:SetActive(true)
elseif curType == 2 then
curId = ActivityGiftManager.GetActivityIdByType(ActivityTypeDef.godsWayTowerTreasure_three)
this.becomeAGodText1.gameObject:SetActive(true)
this.becomeAGodText.gameObject:SetActive(false)
this.btnRank.gameObject:SetActive(true)
else
this.btnRank.gameObject:SetActive(false)
curId = 0
this.becomeAGodText1.gameObject:SetActive(false)
this.becomeAGodText.gameObject:SetActive(true)

View File

@ -15,6 +15,12 @@ function SettingInfo:InitComponent(gameObject, rootPanel)
this.head = Util.GetGameObject(gameObject, "playerInfo/head")
this.headpos = Util.GetGameObject(gameObject, "playerInfo/head/pos")
this.headRedpot = Util.GetGameObject(gameObject, "playerInfo/head/redpot")
--反馈邮箱
this.fankui = Util.GetGameObject(gameObject, "other/fankui")
if this.fankui then
local fankuiText = this.fankui:GetComponent("Text")
fankuiText.text = ServerConfigManager.GetSettingValue(ServerConfigManager.SettingConfig.SHOW_EMAIL_SETTING) or ""
end
this.name = Util.GetGameObject(gameObject, "playerInfo/name/Text")
this.btnChangeName = Util.GetGameObject(gameObject, "playerInfo/name/Image/btn")

View File

@ -36,6 +36,7 @@ function SettingPanel:InitComponent()
this.settingPlayerBg = Util.GetGameObject(self.transform, "layout/settingPlayerBgImage")
this.settingPlayerBg:SetActive(true)
--预设赋值
this.layout = Util.GetGameObject(self.transform, "layout")
for i = 1, #this.contents do

View File

@ -17,7 +17,7 @@ local lastLive2d
this.boyRes = "live2d_npc_boy"
--- 女主立绘
this.bitchRes = "live2d_npc_girl"
this.bitchRes = "live2d_npc_girl"
function this.Initialize()
@ -32,7 +32,7 @@ function this.EventTrigger(eventId, callBack)
return
end
local showType = chapterDataConfig[eventId].ShowType
local showValues = GetLanguageStrById(chapterDataConfig[eventId].ShowValues)
local options = chapterDataConfig[eventId].Option
@ -41,7 +41,7 @@ function this.EventTrigger(eventId, callBack)
-- LogError("showtype "..showType.." showvalue "..showValues)
-- 如果是第一次打开,则打开开幕界面
if showType == 11 then -- 对话界面
if callBack then
if callBack then
UIManager.OpenPanel(UIName.StoryDialoguePanel, eventId, false, callBack)
else
UIManager.OpenPanel(UIName.StoryDialoguePanel, eventId, false)
@ -63,9 +63,6 @@ function this.EventTrigger(eventId, callBack)
local panel = UIManager.OpenPanel(UIName.GuideBattlePanel, testFightData, function()
StoryManager.StoryJumpType(options[3], nil, callBack)
end, options[2])
elseif showType == 15 then -- 播放转场特效
SwitchPanel.PlayTransEffect(function()
this.StoryJumpType(options[1], nil, callBack)
@ -86,10 +83,10 @@ function this.DialogueTrigger(eventId, callback)
end
local showType = chapterDataConfig[eventId].ShowType
--- 对话弹窗
if showType == 13 then
if callback then
if showType == 13 then
if callback then
UIManager.OpenPanel(UIName.DialoguePopup, eventId, callback)
else
UIManager.OpenPanel(UIName.DialoguePopup, eventId)
@ -102,14 +99,14 @@ end
function this.StoryJumpType(optionId, panel, callBack)
local jumpType = chapterOptionData[optionId].JumpType
if jumpType then
if jumpType == 4 then -- 关闭所有界面,结束对话
if jumpType == 4 then -- 关闭所有界面,结束对话
if panel then
panel:ClosePanel()
end
if UIManager.IsOpen(UIName.StoryDialoguePanel) then
UIManager.ClosePanel(UIName.StoryDialoguePanel)
end
--
--
if callBack then
callBack()
end
@ -126,27 +123,25 @@ function this.StoryJumpType(optionId, panel, callBack)
if UIManager.IsOpen(UIName.StoryDialoguePanel) then
UIManager.ClosePanel(UIName.StoryDialoguePanel)
end
elseif jumpType == 1 then -- 继续对话,往下跳转
local nextEventId = chapterOptionData[optionId].JumpTypeValues
local nextEventShowType = chapterDataConfig[nextEventId].ShowType
if nextEventShowType ~= 13 then
this.EventTrigger(nextEventId, callBack)
else
this.DialogueTrigger(nextEventId,callBack)
this.DialogueTrigger(nextEventId, callBack)
end
end
end
end
-- 返回当前关卡的标题
function this.GetTitle()
local str = ""
str = chapterTitleData[this.curAreaID].Title
return str
end
-- ============================= 人物对话控制 =================================== --
-- 加载人物立绘并设置初始状态, 是否需要加载一次立绘
function this.InitLive2dState(setId, resPath, live2dRoot, effectRoot, isNeedLoad, dialoguePanel)
@ -163,27 +158,33 @@ function this.SetLive2dState(setData, isNeedLoad, resPath, live2dRoot, effectRoo
ClearChild(live2dRoot)
-- 立绘的位置大小
local scale = 0
local position = Vector3.New(0,0,0)
local position = Vector3.New(0, 0, 0)
if resPath == this.bitchRes then
if resPath == this.bitchRes then
setData = dialogueSetData[5402]
-- position = Vector3.New(0, -250, 0)
-- position = Vector3.New(0, -250, 0)
-- scale = 0.5
end
if not setData then return end
scale = setData.Scale
position = Vector3(setData.Position[1], setData.Position[2], 0)
position = Vector3(setData.Position[1], setData.Position[2], 0)
-- 设置立绘最终大小位置
local go
if not resPath or resPath == "" then Log(Language[12880]) return end
if not resPath or resPath == "" then
Log(Language[12880])
return
end
go = poolManager:LoadLive(resPath, live2dRoot.transform, Vector3.one * scale, position)
if not go then Log(Language[12881]) return end
if not go then
Log(Language[12881])
return
end
lastLive2d = go
-- 是否播放入场动画
local isPlay = true
if isNeedLoad then
if isNeedLoad then
isPlay = setData.isSkipShow == 1
local shakeTime = setData.ShakeTime
local shakeDis = setData.ShakeScale
@ -192,20 +193,20 @@ function this.SetLive2dState(setData, isNeedLoad, resPath, live2dRoot, effectRoo
this.InitAnim(go)
if isPlay and isNeedShake then -- 震动,入场动画
PlayUIAnim(live2dRoot, function ()
this.SetShake(go, shakeTime, shakeDis[1], shakeDis[2], function ()
if isPlay and isNeedShake then -- 震动,入场动画
PlayUIAnim(live2dRoot, function()
this.SetShake(go, shakeTime, shakeDis[1], shakeDis[2], function()
this.SetLive2dAnim(go, ainIndex, 0, setData, effectRoot, dialoguePanel)
Log("振动入场动画")
end)
end)
elseif isPlay and not isNeedShake then -- 入场动画无震动
PlayUIAnim(live2dRoot, function ()
PlayUIAnim(live2dRoot, function()
this.SetLive2dAnim(go, ainIndex, 0, setData, effectRoot, dialoguePanel)
Log("入场动画")
end)
elseif not isPlay and isNeedShake then -- 震动无入场动画
this.SetShake(go, shakeTime, shakeDis[1], shakeDis[2], function ()
this.SetShake(go, shakeTime, shakeDis[1], shakeDis[2], function()
this.SetLive2dAnim(go, ainIndex, 0, setData, effectRoot, dialoguePanel)
Log("振动")
end)
@ -272,10 +273,9 @@ function this.PlayEffect(setData, effectRoot, dialoguePanel)
local img = Util.GetGameObject(effect, "kuang")
img.transform.localRotation = Vector4.New(0, dir, 0, 1)
else
effect.transform.localRotation = Vector4.New(0, dir, 0, 1)
end
effect:GetComponent("RectTransform").anchoredPosition = pos
effect:GetComponent("RectTransform").anchoredPosition = pos
-- 设置特效层级
Util.AddParticleSortLayer(effectRoot, dialoguePanel.sortingOrder + preLayer)
@ -293,12 +293,11 @@ function this.SetShake(object, timeScale, dx, dy, callBack)
dy = 10
end
object:GetComponent("RectTransform"):DOShakeAnchorPos(timeScale, Vector2.New(dx, dy),
500, 90, true, true):OnComplete(function ()
500, 90, true, true):OnComplete(function()
if callBack then callBack() end
end)
end
-- 设置立绘动作
function this.SetLive2dAnim(object, ainIndex, delayTime, setData, effectRoot, dialoguePanel)
-- 木有立绘资源
@ -312,7 +311,10 @@ function this.SetLive2dAnim(object, ainIndex, delayTime, setData, effectRoot, di
[4] = "touch",
}
if not delayTime then delayTime = 0 end
if not skeletonAnim then Log(Language[12882]) return end
if not skeletonAnim then
Log(Language[12882])
return
end
if animName[ainIndex] and ainIndex > 1 then -- idel状态不做处理
skeletonAnim.AnimationState:SetAnimation(delayTime, animName[ainIndex], false)
@ -345,4 +347,4 @@ function this.UnLoadEffect(resName, res)
poolManager:UnLoadAsset(resName, res, PoolManager.AssetType.GameObject)
end
return this
return this