This commit is contained in:
bridge
2025-11-22 16:09:40 +08:00
parent c25b652fbe
commit c6d1814263
4 changed files with 20 additions and 3 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 213 KiB

After

Width:  |  Height:  |  Size: 214 KiB

View File

@@ -42,6 +42,11 @@ class Age:
self.base_max_lifespan = max(base, self.age + 1)
self.max_lifespan = self.base_max_lifespan
def update_realm(self, new_realm: Realm) -> None:
"""当境界提升时调用,更新寿命上限"""
# 提升基础寿命上限,确保不低于新境界的基准
self.ensure_max_lifespan_at_least_realm_base(new_realm)
def ensure_max_lifespan_at_least_realm_base(self, realm: Realm) -> None:
"""确保基础最大寿元至少达到 max(该境界基线, 当前年龄+1)。"""
base = self.get_base_expected_lifespan(realm)

View File

@@ -866,12 +866,20 @@ class Avatar(AvatarSaveMixin, AvatarLoadMixin):
# 计算新的最大值
new_max_hp = base_max_hp + extra_max_hp
new_max_mp = base_max_mp + extra_max_mp
new_max_lifespan = self.age.base_max_lifespan + extra_max_lifespan
# 更新最大值
self.hp.max = new_max_hp
self.mp.max = new_max_mp
self.age.max_lifespan = new_max_lifespan
# 更新寿命
# 如果 effects 中有额外寿命加成,需要加到 base_max_lifespan 上吗?
# 不base_max_lifespan 是基于境界和年龄计算的基础值(裸值)。
# max_lifespan 是最终值,应该是 base + extra。
# 但是 Age 类内部逻辑是set_base -> update max (max = base)。
# 所以我们需要显式设置 max_lifespan = base + extra
if self.age:
self.age.max_lifespan = self.age.base_max_lifespan + extra_max_lifespan
# 调整当前值(不超过新的最大值)
if self.hp.cur > new_max_hp:

View File

@@ -15,7 +15,11 @@ const ELEMENT_MAP: Record<string, string> = {
'Water': '水',
'Fire': '火',
'Earth': '土',
'None': '无'
'None': '无',
// Map internal key names if they leak (e.g. GOLD from RootElement)
'gold': '金',
'Gold': '金',
'GOLD': '金'
};
export function translateElement(type: string): string {