修复一些bug
This commit is contained in:
parent
4bda42441f
commit
6c9483b1aa
@ -1414,7 +1414,6 @@ function BattleController:getRandomSkillList(getCount)
|
|||||||
return table.remove(fixedList, 1)
|
return table.remove(fixedList, 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
getCount = getCount or BattleConst.SKILL_SELECT_COUNT
|
getCount = getCount or BattleConst.SKILL_SELECT_COUNT
|
||||||
local result = {}
|
local result = {}
|
||||||
local cfg = ConfigManager:getConfig("skill_rogue")
|
local cfg = ConfigManager:getConfig("skill_rogue")
|
||||||
@ -1424,10 +1423,13 @@ function BattleController:getRandomSkillList(getCount)
|
|||||||
local count = 0
|
local count = 0
|
||||||
local newSkillPool = {}
|
local newSkillPool = {}
|
||||||
local skillWeight = {}
|
local skillWeight = {}
|
||||||
for _, skillId in ipairs(skillPool) do
|
for elementType, list in pairs(skillPool) do -- 先遍历一下未解锁的技能
|
||||||
|
if not self.battleData:isUnlockedSkillElementType(elementType) then
|
||||||
|
local skillEntity = self.battleData:getSkillEntityByElement(elementType)
|
||||||
|
if skillEntity then
|
||||||
|
local skillId = skillEntity:getUnlockId()
|
||||||
|
if skillId and not map[skillId] then
|
||||||
local skillCfg = cfg[skillId]
|
local skillCfg = cfg[skillId]
|
||||||
if skillCfg and (not skillCfg.limit_times or self.battleData:getSkillCount(skillId) < skillCfg.limit_times) then
|
|
||||||
if not map[skillId] then
|
|
||||||
table.insert(newSkillPool, skillId)
|
table.insert(newSkillPool, skillId)
|
||||||
table.insert(skillWeight, skillCfg.weight)
|
table.insert(skillWeight, skillCfg.weight)
|
||||||
count = count + 1
|
count = count + 1
|
||||||
@ -1435,6 +1437,22 @@ function BattleController:getRandomSkillList(getCount)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if count >= 3 then -- 如果未解锁的技能大于等于3,则直接返回三个解锁技能
|
||||||
|
for i = 1, 3 do
|
||||||
|
local index = GFunc.getRandomIndex(skillWeight)
|
||||||
|
local skillId = table.remove(newSkillPool, index)
|
||||||
|
table.remove(skillWeight, index)
|
||||||
|
count = count - 1
|
||||||
|
table.insert(result, skillId)
|
||||||
|
if count <= 0 then
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return table.shuffle(result)
|
||||||
|
end
|
||||||
|
|
||||||
for elementType, list in pairs(skillPool) do
|
for elementType, list in pairs(skillPool) do
|
||||||
if self.battleData:isUnlockedSkillElementType(elementType) then
|
if self.battleData:isUnlockedSkillElementType(elementType) then
|
||||||
@ -1449,18 +1467,6 @@ function BattleController:getRandomSkillList(getCount)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
|
||||||
local skillEntity = self.battleData:getSkillEntityByElement(elementType)
|
|
||||||
if skillEntity then
|
|
||||||
local skillId = skillEntity:getUnlockId()
|
|
||||||
if skillId and not map[skillId] then
|
|
||||||
local skillCfg = cfg[skillId]
|
|
||||||
table.insert(newSkillPool, skillId)
|
|
||||||
table.insert(skillWeight, skillCfg.weight)
|
|
||||||
count = count + 1
|
|
||||||
map[skillId] = true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -10,17 +10,7 @@ function HeroManager:upgradeHero(heroId, heroEntity)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local materials = heroEntity:getLvUpMaterials()
|
if not heroEntity:canLvUp(true) then
|
||||||
if not materials or not materials[2] then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local fragmentCost = materials[1] or 0
|
|
||||||
if not GFunc.checkCost(heroEntity:getFragmentId(), fragmentCost, true) then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
if not heroEntity:canLvUp() then
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -71,12 +71,12 @@ function ServerHeroData:tryUnlockHeroByChapterId(maxChapterId)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function ServerHeroData:upgradeHero(heroId)
|
function ServerHeroData:upgradeHero(heroId, lv)
|
||||||
local idStr = tostring(heroId)
|
local idStr = tostring(heroId)
|
||||||
if not self.data.heroes[idStr] then
|
if not self.data.heroes[idStr] then
|
||||||
self:addHero(heroId, 0)
|
self:addHero(heroId, 0)
|
||||||
end
|
end
|
||||||
self.data.heroes[idStr].lv = self.data.heroes[idStr].lv + 1
|
self.data.heroes[idStr].lv = lv
|
||||||
end
|
end
|
||||||
|
|
||||||
return ServerHeroData
|
return ServerHeroData
|
||||||
@ -50,7 +50,7 @@ function ServerHeroManager:onUpgradeHero(params, callback)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ServerGameData.HeroData:upgradeHero(heroId)
|
ServerGameData.HeroData:upgradeHero(heroId, lv)
|
||||||
result.heroId = heroId
|
result.heroId = heroId
|
||||||
result.lv = lv
|
result.lv = lv
|
||||||
result.costs = ServerGameData:addCosts(costs)
|
result.costs = ServerGameData:addCosts(costs)
|
||||||
|
|||||||
@ -62,6 +62,8 @@ function HeroComp:init()
|
|||||||
self.heroBgSpineObj[index]:playAnim("idle", true, false)
|
self.heroBgSpineObj[index]:playAnim("idle", true, false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
self.uiMap["hero_ui.top_bg.title_bg_img.title_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.MAIN_BTN_2))
|
||||||
end
|
end
|
||||||
|
|
||||||
function HeroComp:refresh()
|
function HeroComp:refresh()
|
||||||
@ -162,7 +164,7 @@ function HeroComp:onClickHero(cell, heroId)
|
|||||||
|
|
||||||
local entity = DataManager.HeroData:getHeroById(heroId)
|
local entity = DataManager.HeroData:getHeroById(heroId)
|
||||||
if entity then
|
if entity then
|
||||||
if entity:isActived() then
|
if entity:isActived() and not DataManager.FormationData:heroInFormation(GConst.BattleConst.BATTLE_TYPE.STAGE, heroId) then
|
||||||
local targetPos = cell:getBaseObject():getTransform().position
|
local targetPos = cell:getBaseObject():getTransform().position
|
||||||
local sPoint = UIManager:getUICameraComponent():WorldToScreenPoint(targetPos)
|
local sPoint = UIManager:getUICameraComponent():WorldToScreenPoint(targetPos)
|
||||||
targetPos = CS.BF.Utils.RectTransformScreenPointToLocalPointInRectangle(self.content:getTransform(), sPoint.x, sPoint.y, UIManager:getUICameraComponent())
|
targetPos = CS.BF.Utils.RectTransformScreenPointToLocalPointInRectangle(self.content:getTransform(), sPoint.x, sPoint.y, UIManager:getUICameraComponent())
|
||||||
|
|||||||
@ -36,6 +36,20 @@ function FormationData:upHeroToFormation(formationType, matchType, heroId)
|
|||||||
self:setDirty()
|
self:setDirty()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function FormationData:heroInFormation(formationType, heroId)
|
||||||
|
local formation = self:getFormation(formationType)
|
||||||
|
if not formation then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
for matchType, id in pairs(formation) do
|
||||||
|
if id == heroId then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
function FormationData:setDirty()
|
function FormationData:setDirty()
|
||||||
self.data.dirty = not self.data.dirty
|
self.data.dirty = not self.data.dirty
|
||||||
end
|
end
|
||||||
|
|||||||
@ -138,7 +138,7 @@ function HeroEntity:getMaxLv()
|
|||||||
return self.maxLv
|
return self.maxLv
|
||||||
end
|
end
|
||||||
|
|
||||||
function HeroEntity:canLvUp()
|
function HeroEntity:canLvUp(showToast)
|
||||||
if self:isMaxLv() then
|
if self:isMaxLv() then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
@ -149,11 +149,11 @@ function HeroEntity:canLvUp()
|
|||||||
end
|
end
|
||||||
|
|
||||||
local fragmentCost = cost[1] or 0
|
local fragmentCost = cost[1] or 0
|
||||||
if not GFunc.checkCost(self:getFragmentId(), fragmentCost, false) then
|
if not GFunc.checkCost(self:getFragmentId(), fragmentCost, showToast) then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
local goldCost = cost[2] or 0
|
local goldCost = cost[2] or 0
|
||||||
if not GFunc.checkCost(GConst.ItemConst.ITEM_ID_GOLD, goldCost, false) then
|
if not GFunc.checkCost(GConst.ItemConst.ITEM_ID_GOLD, goldCost, showToast) then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user