feat: add XP levels and progression points

This commit is contained in:
goose
2026-10-03 19:09:47 -04:00
parent e520708d0a
commit 36f2f62271
22 changed files with 527 additions and 13 deletions
+6 -8
View File
@@ -9,6 +9,7 @@ class Stance:
const SUPPORT: StringName = &"support"
const ActorStateType = preload("res://scripts/domain/actor_state.gd")
const ExperienceType = preload("res://scripts/domain/progression/experience.gd")
const VALID_STANCES: Array[StringName] = [Stance.FOLLOW, Stance.DEFEND, Stance.SUPPORT]
var choice_id: StringName
@@ -39,11 +40,8 @@ func share_xp(player: ActorState, amount: int) -> Dictionary:
var reward := maxi(0, amount)
if player == null or reward == 0:
return {"player_xp": 0, "companion_xp": 0}
if not is_alive():
player.xp += reward
return {"player_xp": reward, "companion_xp": 0}
var player_share := (reward + 1) / 2
var companion_share := reward / 2
player.xp += player_share
actor.xp += companion_share
return {"player_xp": player_share, "companion_xp": companion_share}
var allocation := ExperienceType.split_reward(reward, is_alive())
player.grant_xp(allocation.player_xp)
if allocation.companion_xp > 0:
actor.grant_xp(allocation.companion_xp)
return allocation