mirror of
https://github.com/Walter-Sparrow/lunar-tear.git
synced 2026-07-02 05:43:41 +03:00
Share exp-cap helper across enhance flows; fix quest-reward rebirth
Build and Push Docker images to Docker Hub / build-and-push (push) Has been cancelled
Build and Push Docker images to Docker Hub / build-and-push (push) Has been cancelled
This commit is contained in:
@@ -32,9 +32,10 @@ type QuestHandler struct {
|
||||
Granter *store.PossessionGranter
|
||||
SideStoryChapterByEventQuestId map[int32]int32
|
||||
Campaigns *campaign.Catalog
|
||||
CharacterRebirth *masterdata.CharacterRebirthCatalog
|
||||
}
|
||||
|
||||
func NewQuestHandler(catalog *masterdata.QuestCatalog, config *masterdata.GameConfig, sideStory *masterdata.SideStoryCatalog, campaigns *campaign.Catalog) *QuestHandler {
|
||||
func NewQuestHandler(catalog *masterdata.QuestCatalog, config *masterdata.GameConfig, sideStory *masterdata.SideStoryCatalog, campaigns *campaign.Catalog, characterRebirth *masterdata.CharacterRebirthCatalog) *QuestHandler {
|
||||
granter := BuildGranter(catalog)
|
||||
var sideStoryChapters map[int32]int32
|
||||
if sideStory != nil {
|
||||
@@ -46,6 +47,7 @@ func NewQuestHandler(catalog *masterdata.QuestCatalog, config *masterdata.GameCo
|
||||
Granter: granter,
|
||||
SideStoryChapterByEventQuestId: sideStoryChapters,
|
||||
Campaigns: campaigns,
|
||||
CharacterRebirth: characterRebirth,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -197,8 +197,10 @@ func (h *QuestHandler) applyExpRewards(user *store.UserState, questId int32, now
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
var maxLevel int32
|
||||
if maxLevelFunc, hasMax := h.CostumeMaxLevelByRarity[cm.RarityType]; hasMax {
|
||||
maxLevel := maxLevelFunc.Evaluate(row.LimitBreakCount)
|
||||
maxLevel = maxLevelFunc.Evaluate(row.LimitBreakCount) +
|
||||
h.CharacterRebirth.CostumeLevelLimitUp(cm.CharacterId, user.CharacterRebirths[cm.CharacterId].RebirthCount)
|
||||
if row.Level >= maxLevel {
|
||||
log.Printf("[applyExpRewards] questId=%d costume=%d (key=%s): at max level %d, skipping", questId, row.CostumeId, key, row.Level)
|
||||
continue
|
||||
@@ -206,14 +208,7 @@ func (h *QuestHandler) applyExpRewards(user *store.UserState, questId int32, now
|
||||
}
|
||||
row.Exp += questDef.CostumeExp
|
||||
if thresholds, ok := h.CostumeExpByRarity[cm.RarityType]; ok {
|
||||
row.Level, row.Exp = gameutil.LevelAndCap(row.Exp, thresholds)
|
||||
if maxLevelFunc, hasMax := h.CostumeMaxLevelByRarity[cm.RarityType]; hasMax {
|
||||
maxLevel := maxLevelFunc.Evaluate(row.LimitBreakCount)
|
||||
if row.Level > maxLevel && int(maxLevel) < len(thresholds) {
|
||||
row.Level = maxLevel
|
||||
row.Exp = thresholds[maxLevel]
|
||||
}
|
||||
}
|
||||
row.Level, row.Exp = gameutil.ApplyExpWithMaxLevel(row.Exp, thresholds, maxLevel)
|
||||
}
|
||||
user.Costumes[key] = row
|
||||
log.Printf("[applyExpRewards] questId=%d costume=%d (key=%s): +%d exp -> total=%d level=%d", questId, row.CostumeId, key, questDef.CostumeExp, row.Exp, row.Level)
|
||||
|
||||
Reference in New Issue
Block a user