Android build v1.0.36

This commit is contained in:
Warren H
2026-06-20 16:57:03 -04:00
parent 2300973164
commit 753bba581a
6 changed files with 139 additions and 44 deletions
+23 -4
View File
@@ -1866,6 +1866,13 @@ function talentEffectCapacity(level) {
return Math.min(4, Math.max(0, Math.floor(level / 5)))
}
function talentEffectSource(effectType) {
if (effectType.startsWith('mend_')) return 'Mend'
if (effectType.startsWith('radiance_')) return 'Radiance'
if (effectType.startsWith('shield_') || effectType.startsWith('shielded_')) return 'Shield'
return effectType
}
function allocateTalent(database, characterId, talentId) {
const character = database.prepare(`
SELECT class_id AS classId, level, talent_points AS talentPoints
@@ -1880,7 +1887,8 @@ function allocateTalent(database, characterId, talentId) {
max_rank AS maxRank,
tier,
prerequisite_talent_id AS prerequisiteTalentId,
prerequisite_rank AS prerequisiteRank
prerequisite_rank AS prerequisiteRank,
effect_type AS effectType
FROM talents
WHERE id = ?
`).get(talentId)
@@ -1905,14 +1913,25 @@ function allocateTalent(database, characterId, talentId) {
} else {
const capacity = talentEffectCapacity(character.level)
if (capacity <= 0) throw new Error('Spell effects unlock at level 5.')
const activeCount = database.prepare(`
SELECT COUNT(*) AS count
const activeTalents = database.prepare(`
SELECT
talents.id,
talents.name,
talents.effect_type AS effectType
FROM character_talents
JOIN talents ON talents.id = character_talents.talent_id
WHERE character_talents.character_id = ?
AND talents.class_id = ?
AND character_talents.rank > 0
`).get(characterId, character.classId).count
`).all(characterId, character.classId)
const source = talentEffectSource(talent.effectType)
const sourceConflict = activeTalents.find(
(candidate) => candidate.id !== talentId && talentEffectSource(candidate.effectType) === source,
)
if (sourceConflict) {
throw new Error(`Only one ${source} spell effect can be active.`)
}
const activeCount = activeTalents.length
if (activeCount >= capacity) {
throw new Error(`Level ${character.level} allows ${capacity} active spell effect${capacity === 1 ? '' : 's'}.`)
}