mirror of
https://github.com/VickScarlet/lifeRestart.git
synced 2026-08-29 18:14:41 +08:00
fix: talent
This commit is contained in:
@@ -69,8 +69,12 @@ export function pull(
|
|||||||
talentRateWithAddition(options.rate, profile).entries(),
|
talentRateWithAddition(options.rate, profile).entries(),
|
||||||
)
|
)
|
||||||
const result = []
|
const result = []
|
||||||
if (profile.lockedTalent) result.push(profile.lockedTalent)
|
|
||||||
const map = new Map(Grades.map(g => [g, new Set(GradeMap.get(g))]))
|
const map = new Map(Grades.map(g => [g, new Set(GradeMap.get(g))]))
|
||||||
|
if (profile.lockedTalent) {
|
||||||
|
result.push(profile.lockedTalent)
|
||||||
|
const { grade } = talents.get(profile.lockedTalent)!
|
||||||
|
map.get(grade)!.delete(profile.lockedTalent)
|
||||||
|
}
|
||||||
for (let i = options.count - result.length; i > 0; i--) {
|
for (let i = options.count - result.length; i > 0; i--) {
|
||||||
const grade = pickWeight(rate, rng)! ?? 0
|
const grade = pickWeight(rate, rng)! ?? 0
|
||||||
const set = map.get(grade)!
|
const set = map.get(grade)!
|
||||||
@@ -105,12 +109,16 @@ function chainReplace(t: Talent['id'], ts: Set<Talent['id']>, rng?: RNG) {
|
|||||||
if (!r) return null
|
if (!r) return null
|
||||||
let picked: Talent['id'] | null = null
|
let picked: Talent['id'] | null = null
|
||||||
if (r.talent) {
|
if (r.talent) {
|
||||||
const filtered = r.talent.filter(([id]) => exclude(id, ts) == null)
|
const filtered = r.talent.filter(([id]) => {
|
||||||
|
if (ts.has(id)) return false
|
||||||
|
return exclude(id, ts) == null
|
||||||
|
})
|
||||||
picked = pickWeight(filtered, rng)
|
picked = pickWeight(filtered, rng)
|
||||||
} else if (r.grade) {
|
} else if (r.grade) {
|
||||||
const filtered = GradeMap.get(r.grade)!.filter(
|
const filtered = GradeMap.get(r.grade)!.filter(id => {
|
||||||
id => exclude(id, ts) == null,
|
if (ts.has(id)) return false
|
||||||
)
|
return exclude(id, ts) == null
|
||||||
|
})
|
||||||
picked = pick(filtered, rng)
|
picked = pick(filtered, rng)
|
||||||
}
|
}
|
||||||
if (!picked) return null
|
if (!picked) return null
|
||||||
|
|||||||
Reference in New Issue
Block a user