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:
@@ -17,3 +17,16 @@ func LevelAndCap(exp int32, thresholds []int32) (level, capped int32) {
|
||||
}
|
||||
return level, exp
|
||||
}
|
||||
|
||||
// ApplyExpWithMaxLevel runs LevelAndCap and then clamps the resulting
|
||||
// level to the per-instance maxLevel (e.g. limit break + awaken for
|
||||
// weapons, limit break + rebirth for costumes). A maxLevel <= 0 means
|
||||
// "no per-instance cap" and the result is identical to LevelAndCap.
|
||||
func ApplyExpWithMaxLevel(exp int32, thresholds []int32, maxLevel int32) (level, capped int32) {
|
||||
level, capped = LevelAndCap(exp, thresholds)
|
||||
if maxLevel > 0 && level > maxLevel && int(maxLevel) < len(thresholds) {
|
||||
level = maxLevel
|
||||
capped = thresholds[maxLevel]
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user