From 6dfe2f4a87362a27fe2e97a154daac2f11883284 Mon Sep 17 00:00:00 2001 From: 简律纯 Date: Fri, 28 Jun 2024 18:25:40 +0800 Subject: style: ruff format code --- examples/COC7/__init__.py | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) (limited to 'examples/COC7/__init__.py') diff --git a/examples/COC7/__init__.py b/examples/COC7/__init__.py index ecd2091..01efe57 100644 --- a/examples/COC7/__init__.py +++ b/examples/COC7/__init__.py @@ -6,19 +6,36 @@ core = Core() @core.event_post_processor_hook -async def auto_card(_event='T_Event'): +async def auto_card(_event="T_Event"): g = core.session pc = player_card if g and core.session.gid and g.ac: - if hasattr(pc.trans, '生命') or hasattr(pc.trans, '理智'): - core.session.call("set_group_card", pc.gid, f"card#{pc.uid}", await overview_card(pc.char)) + if hasattr(pc.trans, "生命") or hasattr(pc.trans, "理智"): + core.session.call( + "set_group_card", pc.gid, f"card#{pc.uid}", await overview_card(pc.char) + ) async def overview_card(pc: player_card): - max_hp = math.floor((pc.get('CON', 0) + pc.get('SIZ', 0) / 10)) - max_san = math.floor(99 - pc.get('CM', 0)) - mp = pc.get('MP', 0) - mp_show = " mp" + str(mp) + "/" + str( - math.floor(pc.get('POW', 0) / 5) - ) if mp and mp != math.floor(pc.get('POW', 0) / 5) else "" - return pc.get('__Name', "") + " hp" + str(pc.get('HP', max_hp)) + "/" + str(max_hp) + " san" + str(pc.get('SAN', "?")) + "/" + str(max_san) + mp_show + " DEX" + str(pc.get('DEX', "?")) + max_hp = math.floor((pc.get("CON", 0) + pc.get("SIZ", 0) / 10)) + max_san = math.floor(99 - pc.get("CM", 0)) + mp = pc.get("MP", 0) + mp_show = ( + " mp" + str(mp) + "/" + str(math.floor(pc.get("POW", 0) / 5)) + if mp and mp != math.floor(pc.get("POW", 0) / 5) + else "" + ) + return ( + pc.get("__Name", "") + + " hp" + + str(pc.get("HP", max_hp)) + + "/" + + str(max_hp) + + " san" + + str(pc.get("SAN", "?")) + + "/" + + str(max_san) + + mp_show + + " DEX" + + str(pc.get("DEX", "?")) + ) -- cgit v1.2.3-70-g09d2