伤害数字
This commit is contained in:
parent
0db618ef69
commit
1e6e99de9a
@ -30,6 +30,7 @@ BattleConst.HURT_STATE_CRIT = 1 -- 暴击
|
|||||||
BattleConst.EFFECT_COLOR_RED = 1
|
BattleConst.EFFECT_COLOR_RED = 1
|
||||||
BattleConst.EFFECT_COLOR_GREEN = 2
|
BattleConst.EFFECT_COLOR_GREEN = 2
|
||||||
BattleConst.EFFECT_COLOR_BLUE = 3
|
BattleConst.EFFECT_COLOR_BLUE = 3
|
||||||
|
BattleConst.EFFECT_COLOR_WHILTE = 4
|
||||||
BattleConst.EFFECT_TYPE_MOVE_L = 1
|
BattleConst.EFFECT_TYPE_MOVE_L = 1
|
||||||
BattleConst.EFFECT_TYPE_MOVE_R = 2
|
BattleConst.EFFECT_TYPE_MOVE_R = 2
|
||||||
BattleConst.EFFECT_TYPE_CRIT = 3
|
BattleConst.EFFECT_TYPE_CRIT = 3
|
||||||
@ -193,6 +194,7 @@ BattleConst.EFFECT_TYPE = {
|
|||||||
BattleConst.SPECIAL_DAMAGE_OR_CURE_TYPE = {
|
BattleConst.SPECIAL_DAMAGE_OR_CURE_TYPE = {
|
||||||
ROUND_BEGIN_HEAL = "round_begin_heal",
|
ROUND_BEGIN_HEAL = "round_begin_heal",
|
||||||
KILL_MAX_ELEMENT_AND_HEAL = "kill_max_element_and_heal",
|
KILL_MAX_ELEMENT_AND_HEAL = "kill_max_element_and_heal",
|
||||||
|
BE_SUCKED = "be_sucked",
|
||||||
}
|
}
|
||||||
|
|
||||||
BattleConst.SKILL_RECORD_DATA_NAME = {
|
BattleConst.SKILL_RECORD_DATA_NAME = {
|
||||||
|
|||||||
@ -1407,19 +1407,34 @@ function BattleUnitComp:takeDamageOrCure(atker, num, effectType, effectStatus, d
|
|||||||
if effectStatus == HURT_STATE_CRIT then
|
if effectStatus == HURT_STATE_CRIT then
|
||||||
self:showEffectNumber(BattleConst.EFFECT_COLOR_RED, BattleConst.EFFECT_TYPE_CRIT, "c" .. damage, x, y, delayTime)
|
self:showEffectNumber(BattleConst.EFFECT_COLOR_RED, BattleConst.EFFECT_TYPE_CRIT, "c" .. damage, x, y, delayTime)
|
||||||
else
|
else
|
||||||
if self.side == BattleConst.SIDE_ATK then
|
local effectColor = BattleConst.EFFECT_COLOR_RED
|
||||||
self:showEffectNumber(BattleConst.EFFECT_COLOR_RED, BattleConst.EFFECT_TYPE_MOVE_L, damage, x, y, delayTime)
|
local damageStr = damage
|
||||||
|
local direction = BattleConst.EFFECT_TYPE_MOVE_R
|
||||||
|
local elementType = BattleHelper:getDamageOrCureType2MatchType(damageOrCureType)
|
||||||
|
local weekNessValue = self.unitEntity:getWeakness(elementType)
|
||||||
|
if weekNessValue > 0 then
|
||||||
|
damageStr = "a" .. damage
|
||||||
else
|
else
|
||||||
self:showEffectNumber(BattleConst.EFFECT_COLOR_RED, BattleConst.EFFECT_TYPE_MOVE_R, damage, x, y, delayTime)
|
local decGmgValue = self.unitEntity:getDecDmg(elementType)
|
||||||
|
if decGmgValue > 0 then
|
||||||
|
effectColor = BattleConst.EFFECT_COLOR_WHILTE
|
||||||
|
damageStr = "d" .. damage
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if self.side == BattleConst.SIDE_ATK then
|
||||||
|
direction = BattleConst.EFFECT_TYPE_MOVE_L
|
||||||
|
end
|
||||||
|
|
||||||
|
self:showEffectNumber(effectColor, direction, damageStr, x, y, delayTime)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
if effectType == EFFECT_TYPE.DIRECT then
|
if effectType == EFFECT_TYPE.DIRECT then
|
||||||
if hp > 0 and self.unitEntity:getShieldRebound() then -- 伤害反弹
|
if hp > 0 and self.unitEntity:getShieldRebound() then -- 伤害反弹
|
||||||
atker:takeDamageOrCure(self, num*self.unitEntity:getShieldRebound() // DEFAULT_FACTOR, EFFECT_TYPE.REBOUND, 0, BattleConst.BUFF_NAME.SHIELD_REBOUND_200)
|
atker:takeDamageOrCure(self, num*self.unitEntity:getShieldRebound() // DEFAULT_FACTOR, EFFECT_TYPE.REBOUND, 0, BattleConst.BUFF_NAME.SHIELD_REBOUND_200)
|
||||||
end
|
end
|
||||||
if self.unitEntity:getBeSucked() > 0 then -- 吸血
|
if self.unitEntity:getBeSucked() > 0 then -- 吸血
|
||||||
atker:takeDamageOrCure(self, -num*self.unitEntity:getBeSucked() // DEFAULT_FACTOR, EFFECT_TYPE.HEAL, 0, BattleConst.ATTR_NAME.BE_SUCKED)
|
atker:takeDamageOrCure(self, -num*self.unitEntity:getBeSucked() // DEFAULT_FACTOR, EFFECT_TYPE.HEAL, 0, BattleConst.SPECIAL_DAMAGE_OR_CURE_TYPE.BE_SUCKED)
|
||||||
end
|
end
|
||||||
if self.unitEntity:getIsLethargy() then -- 移除昏睡
|
if self.unitEntity:getIsLethargy() then -- 移除昏睡
|
||||||
self:removeBuffByName(BattleConst.BUFF_NAME.LETHARGY)
|
self:removeBuffByName(BattleConst.BUFF_NAME.LETHARGY)
|
||||||
|
|||||||
@ -297,7 +297,8 @@ function BattleController:prepareFight()
|
|||||||
self.battleUI:addLoadUICompleteListener(function()
|
self.battleUI:addLoadUICompleteListener(function()
|
||||||
BattleHelper:setEffectTextCache(self.battleUI:getBattleNumberRed(),
|
BattleHelper:setEffectTextCache(self.battleUI:getBattleNumberRed(),
|
||||||
self.battleUI:getBattleNumberGreen(),
|
self.battleUI:getBattleNumberGreen(),
|
||||||
self.battleUI:getBattleNumberBlue())
|
self.battleUI:getBattleNumberBlue(),
|
||||||
|
self.battleUI:getBattleNumberWhite())
|
||||||
self:initAtkUnits(onPreloadFinished)
|
self:initAtkUnits(onPreloadFinished)
|
||||||
self:initDefUnits(onPreloadFinished)
|
self:initDefUnits(onPreloadFinished)
|
||||||
self.battleUI:refreshChessBoard(self:getChessBoardBgName())
|
self.battleUI:refreshChessBoard(self:getChessBoardBgName())
|
||||||
|
|||||||
@ -20,6 +20,7 @@ function BattleHelper:init()
|
|||||||
self.seed = tonumber(tostring(os.time()):reverse():sub(1,6))
|
self.seed = tonumber(tostring(os.time()):reverse():sub(1,6))
|
||||||
self.baseOrder = 0
|
self.baseOrder = 0
|
||||||
self.skillSoundPath = {}
|
self.skillSoundPath = {}
|
||||||
|
self.damageOrCureType2MatchType = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
function BattleHelper:setBaseOrder(baseOrder)
|
function BattleHelper:setBaseOrder(baseOrder)
|
||||||
@ -175,13 +176,14 @@ function BattleHelper:addSpineBoneFollowerGraphic(effectObj)
|
|||||||
return boneFollower
|
return boneFollower
|
||||||
end
|
end
|
||||||
|
|
||||||
function BattleHelper:setEffectTextCache(cache1, cache2, cache3)
|
function BattleHelper:setEffectTextCache(cache1, cache2, cache3, cache4)
|
||||||
if self.effectTextCacheList == nil then
|
if self.effectTextCacheList == nil then
|
||||||
self.effectTextCacheList = {}
|
self.effectTextCacheList = {}
|
||||||
end
|
end
|
||||||
self.effectTextCacheList[1] = cache1
|
self.effectTextCacheList[1] = cache1
|
||||||
self.effectTextCacheList[2] = cache2
|
self.effectTextCacheList[2] = cache2
|
||||||
self.effectTextCacheList[3] = cache3
|
self.effectTextCacheList[3] = cache3
|
||||||
|
self.effectTextCacheList[4] = cache4
|
||||||
end
|
end
|
||||||
|
|
||||||
function BattleHelper:getEffectText(parent, colorType)
|
function BattleHelper:getEffectText(parent, colorType)
|
||||||
@ -256,6 +258,30 @@ function BattleHelper:playSkillSound(name, delay)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function BattleHelper:getDamageOrCureType2MatchType(damageOrCureType)
|
||||||
|
if not damageOrCureType then
|
||||||
|
return GConst.BattleConst.ELEMENT_TYPE.NONE
|
||||||
|
end
|
||||||
|
|
||||||
|
if not self.damageOrCureType2MatchType[damageOrCureType] then
|
||||||
|
local elementType = GConst.BattleConst.ELEMENT_TYPE.NONE
|
||||||
|
if string.match(damageOrCureType, "red") then
|
||||||
|
elementType = GConst.BattleConst.ELEMENT_TYPE.RED
|
||||||
|
elseif string.match(damageOrCureType, "yellow") then
|
||||||
|
elementType = GConst.BattleConst.ELEMENT_TYPE.YELLOW
|
||||||
|
elseif string.match(damageOrCureType, "green") then
|
||||||
|
elementType = GConst.BattleConst.ELEMENT_TYPE.GREEN
|
||||||
|
elseif string.match(damageOrCureType, "blue") then
|
||||||
|
elementType = GConst.BattleConst.ELEMENT_TYPE.BLUE
|
||||||
|
elseif string.match(damageOrCureType, "purple") then
|
||||||
|
elementType = GConst.BattleConst.ELEMENT_TYPE.PURPLE
|
||||||
|
end
|
||||||
|
self.damageOrCureType2MatchType[damageOrCureType] = elementType
|
||||||
|
end
|
||||||
|
|
||||||
|
return self.damageOrCureType2MatchType[damageOrCureType]
|
||||||
|
end
|
||||||
|
|
||||||
function BattleHelper:performDurationDelay(delay, func)
|
function BattleHelper:performDurationDelay(delay, func)
|
||||||
return BattleScheduler:performWithDelayGlobal(func, delay)
|
return BattleScheduler:performWithDelayGlobal(func, delay)
|
||||||
end
|
end
|
||||||
|
|||||||
@ -384,6 +384,7 @@ function BattleUI:initNumberNode()
|
|||||||
self.battleNumberRed = self.uiMap["battle_ui.cache_node.battle_number_red"]
|
self.battleNumberRed = self.uiMap["battle_ui.cache_node.battle_number_red"]
|
||||||
self.battleNumberGreen = self.uiMap["battle_ui.cache_node.battle_number_green"]
|
self.battleNumberGreen = self.uiMap["battle_ui.cache_node.battle_number_green"]
|
||||||
self.battleNumberBlue = self.uiMap["battle_ui.cache_node.battle_number_blue"]
|
self.battleNumberBlue = self.uiMap["battle_ui.cache_node.battle_number_blue"]
|
||||||
|
self.battleNumberWhite = self.uiMap["battle_ui.cache_node.battle_number_white"]
|
||||||
end
|
end
|
||||||
|
|
||||||
function BattleUI:getNumberNode()
|
function BattleUI:getNumberNode()
|
||||||
@ -402,6 +403,10 @@ function BattleUI:getBattleNumberBlue()
|
|||||||
return self.battleNumberBlue
|
return self.battleNumberBlue
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function BattleUI:getBattleNumberWhite()
|
||||||
|
return self.battleNumberWhite
|
||||||
|
end
|
||||||
|
|
||||||
function BattleUI:initComboNode()
|
function BattleUI:initComboNode()
|
||||||
self.comboNode = self.uiMap["battle_ui.top_node.combo"]
|
self.comboNode = self.uiMap["battle_ui.top_node.combo"]
|
||||||
self.comboAnimator = self.comboNode:getComponent(GConst.TYPEOF_UNITY_CLASS.ANIMATOR)
|
self.comboAnimator = self.comboNode:getComponent(GConst.TYPEOF_UNITY_CLASS.ANIMATOR)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user