diff --git a/src/classes/action/switch_weapon.py b/src/classes/action/switch_weapon.py index cf2dc50..ae330aa 100644 --- a/src/classes/action/switch_weapon.py +++ b/src/classes/action/switch_weapon.py @@ -13,11 +13,16 @@ class SwitchWeapon(InstantAction): 熟练度重置为0。 """ - COMMENT = "切换到指定类型的凡品兵器。当前兵器会丧失,熟练度会重置为0。适用于想要更换兵器类型或从头修炼新兵器的情况。" + COMMENT = "切换到指定类型的凡品兵器,或卸下兵器。当前兵器会丧失,熟练度会重置为0。适用于想要更换兵器类型或从头修炼新兵器的情况。" DOABLES_REQUIREMENTS = "无前置条件" PARAMS = {"weapon_type_name": "str"} def _execute(self, weapon_type_name: str) -> None: + # 处理卸下兵器的情况 + if weapon_type_name in ["无", "None", "none", ""]: + self.avatar.change_weapon(None) + return + # 规范化兵器类型名称 normalized_type = normalize_weapon_type(weapon_type_name) @@ -44,6 +49,12 @@ class SwitchWeapon(InstantAction): # AI调用:总是可以切换兵器 return True, "" + # 处理卸下兵器的情况 + if weapon_type_name in ["无", "None", "none", ""]: + if self.avatar.weapon is None: + return False, "当前已处于无兵器状态" + return True, "" + # 规范化并验证兵器类型 normalized_type = normalize_weapon_type(weapon_type_name) target_weapon_type = None @@ -53,10 +64,11 @@ class SwitchWeapon(InstantAction): break if target_weapon_type is None: - return False, f"未知兵器类型: {weapon_type_name}(支持的类型:剑/刀/枪/棍/扇/鞭/琴/笛/暗器)" + return False, f"未知兵器类型: {weapon_type_name}(支持的类型:剑/刀/枪/棍/扇/鞭/琴/笛/暗器/无)" # 检查是否已经是该类型的凡品兵器 - if self.avatar.weapon.weapon_type == target_weapon_type and \ + if self.avatar.weapon is not None and \ + self.avatar.weapon.weapon_type == target_weapon_type and \ self.avatar.weapon.name == f"凡品{target_weapon_type.value}": return False, f"已经装备了凡品{target_weapon_type.value}" @@ -68,6 +80,13 @@ class SwitchWeapon(InstantAction): return True, "" def start(self, weapon_type_name: str) -> Event: + if weapon_type_name in ["无", "None", "none", ""]: + return Event( + self.world.month_stamp, + f"{self.avatar.name} 卸下了兵器", + related_avatars=[self.avatar.id] + ) + normalized_type = normalize_weapon_type(weapon_type_name) return Event( self.world.month_stamp, diff --git a/src/utils/effect_desc.py b/src/utils/effect_desc.py index fc5004e..164d1f9 100644 --- a/src/utils/effect_desc.py +++ b/src/utils/effect_desc.py @@ -75,12 +75,15 @@ def translate_condition(condition: str) -> str: vars_map = { "avatar.weapon.type": "武器类型", "avatar.weapon.weapon_type.value": "武器类型", + "avatar.weapon.proficiency": "兵器熟练度", + "avatar.weapon": "兵器", "avatar.cultivation_progress.realm.value": "境界等级", "avatar.cultivation.level": "修为等级", "avatar.alignment": "立场", "avatar.age": "年龄", "avatar.spirit_animal": "灵兽", - "avatar.weapon.proficiency": "兵器熟练度", + "avatar.sect": "宗门", + "avatar.auxiliary": "辅助装备", } # 2. 枚举值映射 diff --git a/static/game_configs/persona.csv b/static/game_configs/persona.csv index ae906a7..31ef459 100644 --- a/static/game_configs/persona.csv +++ b/static/game_configs/persona.csv @@ -29,7 +29,7 @@ id,name,exclusion_names,desc,rarity,condition,effects 27,腼腆,开放,你对待和他人结为道侣或者双修比较谨慎,N, 28,舔狗,孤僻;淡漠;刻薄;腼腆,你对异性中外貌出众者格外友善,倾向主动接近、帮助与合作。,N, 29,嫉妒,友爱;热情,你对在修为、外貌或财富等方面远超于你的人容易产生敌意,更倾向对其冷淡、挑衅或打压。,N, -30,穿越者,,你来自现代社会,怀念现代社会的一切,你的思考(thinking)必须是现代化的思考,SR, +30,穿越者,,你来自现代社会,怀念现代社会的一切,你的思考都还是现代化的思考模式,SR, 31,气运之子,,天生气运加身,更易遇到奇遇,战斗力也略有提升,SSR,,"{extra_fortune_probability: 0.05, extra_battle_strength_points: 2, extra_breakthrough_success_rate: 0.05}" 32,剑痴,怠惰;胆小,以剑入道,剑即是命。你认为剑道至上,战力强悍,但对剑道之外的事物兴趣寥寥。,SR,,"[{when: 'avatar.weapon.type == WeaponType.SWORD', extra_weapon_proficiency_gain: 1.0, extra_battle_strength_points: 3}]" 33,心机深沉,鲁莽;热情;外向,深藏不露,行事谨慎,善于算计。你不轻易暴露实力和想法,观察力敏锐,总在暗中盘算。,R, @@ -37,7 +37,7 @@ id,name,exclusion_names,desc,rarity,condition,effects 35,狠辣,友爱;热情;胆小,行事果决狠辣,不留后患,斩草必除根。你认为心慈手软只会害了自己。,N, 36,重生者,无常;随性,经历过一世,对未来有模糊预知,行事更有目的性。你比常人更清楚什么重要,什么是陷阱。,SSR, 37,疑心重,热情;外向;友爱,对任何人都保持怀疑,不轻易信任,时刻警惕他人可能的背叛和算计。,N, -38,体修,惜命;胆小,专注肉身淬炼,体魄强健,近战无敌。你相信肉身才是修行的根本,法术只是旁门左道。,R, +38,体修,惜命;胆小,专注肉身淬炼,体魄强健,近战无敌。你相信肉身才是修行的根本,法术只是旁门左道。,R,,"[{when: 'avatar.weapon is None', extra_battle_strength_points: 5}]" 39,炼丹师,好斗,精通丹道,对灵药敏感,擅长炼制丹药。你认为丹药是修行的关键,战斗并非你的专长。,R, 40,福缘深厚,,天生福运,逢凶化吉。虽不如气运之子,但也常有小幸运眷顾。,SR,,{extra_fortune_probability: 0.02} 41,剑修,怠惰,对剑道有着深厚的兴趣和独特的天赋,持剑修炼时事半功倍。,R,,"[{when: 'avatar.weapon.type == WeaponType.SWORD', extra_weapon_proficiency_gain: 0.5, extra_battle_strength_points: 1}]" diff --git a/web/src/components/panels/EventPanel.vue b/web/src/components/panels/EventPanel.vue index 3029004..a255908 100644 --- a/web/src/components/panels/EventPanel.vue +++ b/web/src/components/panels/EventPanel.vue @@ -1,10 +1,11 @@