From b7dda49394041ed5a83c88d6aedf9d7f78089cfb Mon Sep 17 00:00:00 2001 From: xiekaidong Date: Wed, 10 May 2023 15:17:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BB=E5=8A=A8=E6=8A=80=E8=83=BD=E4=BC=A4?= =?UTF-8?q?=E5=AE=B3=E5=A2=9E=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/module/battle/battle_const.lua | 3 +++ lua/app/module/battle/helper/battle_formula.lua | 9 +++++++-- lua/app/userdata/battle/skill/battle_buff_entity.lua | 7 ++++++- lua/app/userdata/battle/skill/battle_skill_entity.lua | 6 +++--- lua/app/userdata/battle/team/battle_team_entity.lua | 4 ++++ lua/app/userdata/battle/team/battle_unit_entity.lua | 4 ++++ 6 files changed, 27 insertions(+), 6 deletions(-) diff --git a/lua/app/module/battle/battle_const.lua b/lua/app/module/battle/battle_const.lua index dd8e4a9c..e8b2e7c8 100644 --- a/lua/app/module/battle/battle_const.lua +++ b/lua/app/module/battle/battle_const.lua @@ -252,6 +252,7 @@ local BUFF_NAME = { THORNS = "thorns", FIRST_HAND = "first_hand", COUNTER_ATTACK = "counterattack", + SKILL_HURT_ADD = "skill_hurt_add", } BattleConst.BUFF_NAME = BUFF_NAME @@ -301,6 +302,7 @@ local ATTR_NAME = { THORNS = "thorns", FIRST_HAND = "first_hand", COUNTER_ATTACK = "counterattack", + SKILL_HURT = "skill_hurt", } BattleConst.ATTR_NAME = ATTR_NAME @@ -343,6 +345,7 @@ BattleConst.BUFF_NAME_TO_ATTR = { [BUFF_NAME.THORNS] = {ATTR_NAME.THORNS, false}, [BUFF_NAME.FIRST_HAND] = {ATTR_NAME.FIRST_HAND, false}, [BUFF_NAME.COUNTER_ATTACK] = {ATTR_NAME.COUNTER_ATTACK, false}, + [BUFF_NAME.SKILL_HURT_ADD] = {ATTR_NAME.SKILL_HURT, false}, } ---- 格子类型 diff --git a/lua/app/module/battle/helper/battle_formula.lua b/lua/app/module/battle/helper/battle_formula.lua index ec7c4c7b..a2a48839 100644 --- a/lua/app/module/battle/helper/battle_formula.lua +++ b/lua/app/module/battle/helper/battle_formula.lua @@ -15,11 +15,16 @@ function BattleFormula:getDamageOrCureResult(unitComp, buff, targetUnitComp) end BattleFormula.calculateFormula = { - -- (攻击)*技能倍率*(1+(攻击者元素伤害增加+所有伤害增加)(攻击者)- (攻击者元素伤害降低+所有伤害降低) +(受到元素伤害增加+受到所有伤害增加(受击)-受到元素伤害降低-受到所有伤害降低(受击)*暴击伤害 + -- (攻击)*技能倍率*(1+(攻击者元素伤害增加+所有伤害增加)(攻击者)- (攻击者元素伤害降低+所有伤害降低) +(受到元素伤害增加+受到所有伤害增加(受击)-受到元素伤害降低-受到所有伤害降低(受击) + 主动技能增伤)*暴击伤害 [1] = function(unitComp, buff, targetUnit) + local skillHurtAdd = 0 + local hostSkill = buff:getHostSkill() + if hostSkill and hostSkill:getIsActiveType() and unitComp.unitEntity:getSkillHurt() > 0 then -- 是主动技能携带的buff,且拥有技能伤害加成 + skillHurtAdd = unitComp.unitEntity:getSkillHurt() + end local matchType = unitComp.unitEntity:getMatchType() local result = unitComp.unitEntity:getAtk() * buff:getEffectNum() // DEFAULT_FACTOR * - (DEFAULT_FACTOR + unitComp.unitEntity:getDmgAddition() - unitComp.unitEntity:getDmgDec() + targetUnit.unitEntity:getWeakness(matchType) - targetUnit.unitEntity:getDecDmg(matchType)) // DEFAULT_FACTOR + (DEFAULT_FACTOR + unitComp.unitEntity:getDmgAddition() - unitComp.unitEntity:getDmgDec() + targetUnit.unitEntity:getWeakness(matchType) - targetUnit.unitEntity:getDecDmg(matchType) + skillHurtAdd) // DEFAULT_FACTOR local hurtState = 0 local crit = unitComp.unitEntity:getCrit() if crit > 0 then diff --git a/lua/app/userdata/battle/skill/battle_buff_entity.lua b/lua/app/userdata/battle/skill/battle_buff_entity.lua index b99a40ca..31a0cd1d 100644 --- a/lua/app/userdata/battle/skill/battle_buff_entity.lua +++ b/lua/app/userdata/battle/skill/battle_buff_entity.lua @@ -6,12 +6,13 @@ local BUFF_TYPE_DIRECT_HURT = BattleConst.BUFF_TYPE.DIRECT_HURT function BattleBuffEntity:ctor() end -function BattleBuffEntity:init(effectParams, owner) +function BattleBuffEntity:init(effectParams, owner, hostSkill) self.name = effectParams.type self.effectNum = effectParams.num self.round = effectParams.round self.ratio = effectParams.ratio self.owner = owner + self.hostSkill = hostSkill self.targetSide = nil self.buffInfo = ConfigManager:getConfigWithOtherKey("buff", "name")[self.name] self.buffType = self.buffInfo.buff_type @@ -25,6 +26,10 @@ function BattleBuffEntity:getName() return self.name end +function BattleBuffEntity:getHostSkill() + return self.hostSkill +end + function BattleBuffEntity:getDesc() if self.desc == nil then local buff18NInfo = I18N:getConfigWithOtherKey("buff", "name")[self.name] diff --git a/lua/app/userdata/battle/skill/battle_skill_entity.lua b/lua/app/userdata/battle/skill/battle_skill_entity.lua index b8645253..c305830c 100644 --- a/lua/app/userdata/battle/skill/battle_skill_entity.lua +++ b/lua/app/userdata/battle/skill/battle_skill_entity.lua @@ -37,7 +37,7 @@ function BattleSkillEntity:initSkillEffect() if self.skillInfo.effect then for k, v in ipairs(self.skillInfo.effect) do local buffEntity = BattleBuffEntity:create() - buffEntity:init(v, self.owner) + buffEntity:init(v, self.owner, self) if buffEntity:getIsHurtType() then self.isHurtType = true end @@ -89,7 +89,7 @@ function BattleSkillEntity:addSkillEffectParams(effect) end if not buffEntity then buffEntity = BattleBuffEntity:create() - buffEntity:init(effect, self.owner) + buffEntity:init(effect, self.owner, self) table.insert(self.effectList, buffEntity) else buffEntity:setEffectNum(buffEntity:getEffectNum() + effect.num) @@ -106,7 +106,7 @@ function BattleSkillEntity:addSkillEffectRound(effect) end if not buffEntity then buffEntity = BattleBuffEntity:create() - buffEntity:init(effect, self.owner) + buffEntity:init(effect, self.owner, self) table.insert(self.effectList, buffEntity) else buffEntity:setRound(buffEntity:getRound() + effect.round) diff --git a/lua/app/userdata/battle/team/battle_team_entity.lua b/lua/app/userdata/battle/team/battle_team_entity.lua index 86b8058c..6648d596 100644 --- a/lua/app/userdata/battle/team/battle_team_entity.lua +++ b/lua/app/userdata/battle/team/battle_team_entity.lua @@ -269,6 +269,10 @@ function BattleTeamEntity:getCounterAttack() return self.attr.counterattack or 0 end +function BattleTeamEntity:getSkillHurt() + return self.attr.skill_hurt or 0 +end + function BattleTeamEntity:takeDamageOrCure(num) if self.isDead then return 0 diff --git a/lua/app/userdata/battle/team/battle_unit_entity.lua b/lua/app/userdata/battle/team/battle_unit_entity.lua index d9f321da..9114a753 100644 --- a/lua/app/userdata/battle/team/battle_unit_entity.lua +++ b/lua/app/userdata/battle/team/battle_unit_entity.lua @@ -318,6 +318,10 @@ function BattleUnitEntity:getCounterAttack() return self.team:getCounterAttack() end +function BattleUnitEntity:getSkillHurt() + return self.team:getSkillHurt() +end + function BattleUnitEntity:addLimit(name, buffEffect) self.team:addLimit(name, buffEffect) end