aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author简律纯 <i@jyunko.cn>2024-07-08 07:42:12 +0800
committer简律纯 <i@jyunko.cn>2024-07-08 07:42:12 +0800
commitb06a62cb0527338b584f9a87ccb75844cbfd35fe (patch)
treef7e90db58a1642a1c4d8c7704a6b64ff40c15b80
parentc6f28bd75141da583bdd95e86d37ae5884276c55 (diff)
downloadHydroRollCore-b06a62cb0527338b584f9a87ccb75844cbfd35fe.tar.gz
HydroRollCore-b06a62cb0527338b584f9a87ccb75844cbfd35fe.zip
style(examples): ruff format code
-rw-r--r--examples/rules/COC7/Command.py1
-rw-r--r--examples/rules/COC7/__init__.py16
-rw-r--r--hrc/rule/__init__.py4
3 files changed, 12 insertions, 9 deletions
diff --git a/examples/rules/COC7/Command.py b/examples/rules/COC7/Command.py
new file mode 100644
index 0000000..9819841
--- /dev/null
+++ b/examples/rules/COC7/Command.py
@@ -0,0 +1 @@
+class Command: ... \ No newline at end of file
diff --git a/examples/rules/COC7/__init__.py b/examples/rules/COC7/__init__.py
index 128c312..65f40ab 100644
--- a/examples/rules/COC7/__init__.py
+++ b/examples/rules/COC7/__init__.py
@@ -6,17 +6,18 @@ from hrc.dependencies import Depends
from .Character import Attributes
from .Wiki import Wiki
+from .Command import Command
core = Core()
class COC7(Rule):
-
+
# 规则、指令、词条,必须至少实现任意一个
- attr: Attributes = Depends() # CharacterCard.Attribute
- wiki: Wiki = Depends() # Wiki
- cmd: Command = Depends() # Command
-
+ attr: Attributes = Depends() # CharacterCard.Attribute
+ wiki: Wiki = Depends() # Wiki
+ cmd: Command = Depends() # Command # noqa: F821
+
@core.event_postprocessor_hook
async def auto_card(self):
if self.session and self.session.gid and self.ac:
@@ -26,7 +27,8 @@ class COC7(Rule):
)
async def overview_card(self):
- max_hp = math.floor((self.pc.get("CON", 0) + self.pc.get("SIZ", 0) / 10))
+ max_hp = math.floor(
+ (self.pc.get("CON", 0) + self.pc.get("SIZ", 0) / 10))
max_san = math.floor(99 - self.pc.get("CM", 0))
mp = self.pc.get("MP", 0)
mp_show = (
@@ -47,4 +49,4 @@ class COC7(Rule):
+ mp_show
+ " DEX"
+ str(self.pc.get("DEX", "?"))
- ) \ No newline at end of file
+ )
diff --git a/hrc/rule/__init__.py b/hrc/rule/__init__.py
index 8923f9e..ecced24 100644
--- a/hrc/rule/__init__.py
+++ b/hrc/rule/__init__.py
@@ -145,7 +145,7 @@ class Rule(ABC, Generic[EventT, StateT, ConfigT]):
async def handle(self) -> None:
"""Method to handle events. iamai will call this method when the ``rule()`` method returns ``True``. Each plugin must implement this method."""
raise NotImplementedError
-
+
@abstractmethod
async def rule(self) -> bool:
"""Method to match the event. When the event is processed, this method will be called in sequence according to the priority of the plugin. When this method returns ``True``, the event will be handed over to this plugin for processing. Each plugin must implement this method.
@@ -162,4 +162,4 @@ class Rule(ABC, Generic[EventT, StateT, ConfigT]):
func._ignore_case = ignore_case
return func
- return decorator \ No newline at end of file
+ return decorator