aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/examples/COC7
diff options
context:
space:
mode:
author简律纯 <i@jyunko.cn>2024-07-06 09:14:35 +0800
committer简律纯 <i@jyunko.cn>2024-07-06 09:14:35 +0800
commit9558df091151d58aa7433c79ac3b8e050674c6fc (patch)
treebfec4b888660354235cc4ff37c193d4182fe667c /examples/COC7
parent0ed10486f719c23ab7e0e84d2e119a7fa5f70475 (diff)
downloadHydroRollCore-9558df091151d58aa7433c79ac3b8e050674c6fc.tar.gz
HydroRollCore-9558df091151d58aa7433c79ac3b8e050674c6fc.zip
chore: move COC7 folder into rules folder
Diffstat (limited to 'examples/COC7')
-rw-r--r--examples/COC7/Character.py132
-rw-r--r--examples/COC7/Wiki.py3
-rw-r--r--examples/COC7/__init__.py48
3 files changed, 0 insertions, 183 deletions
diff --git a/examples/COC7/Character.py b/examples/COC7/Character.py
deleted file mode 100644
index bb30661..0000000
--- a/examples/COC7/Character.py
+++ /dev/null
@@ -1,132 +0,0 @@
-# MyRule
-import math
-
-from typing import Union
-from dataclasses import dataclass
-
-from hrc.rule import Rule
-from hrc.rule.BaseRule import CharacterCard
-
-aliases = Rule.aliases
-
-@dataclass
-class Attributes(CharacterCard.Attribute):
-
- @aliases(["luck", "运气"], ignore_case=True)
- def LUK(self) -> Union[str, int, None]: ...
-
- @aliases(["伤害加值", "DamageBonus"], ignore_case=True)
- def DB(self) -> Union[str, int, None]:
- sum = self.STR() + self.SIZ()
- return (
- str(math.ceil((sum - 164) / 80)) + "D6"
- if sum > 164
- else "1D4"
- if sum > 124
- else "0"
- if sum > 84
- else "-1"
- if sum > 64
- else "-2"
- if sum > 0
- else None
- )
-
- @aliases(["年龄", "age"], ignore_case=True)
- def AGE(self) -> Union[str, int, None]: ...
-
- @aliases(["HitPoints", "生命值", "生命"], ignore_case=True)
- def HP(self) -> Union[str, int, None]:
- return self.MAX_HP
-
- @aliases(["最大生命值", "HitPointTotal", "总生命值"], ignore_case=True)
- def MAX_HP(self) -> Union[str, int, None]:
- if hasattr(self, "CON") and hasattr(self, "SIZ"):
- return (self.CON() + self.SIZ()) // 10
- else:
- return None
-
- @aliases(["理智", "Sanity", "SanityPoint", "理智值", "san值"], ignore_case=True)
- def SAN(self) -> Union[str, int, None]:
- return self.POW()
-
- @aliases(["最大理智值", "MaximumSanity"], ignore_case=True)
- def MAX_SAN(self) -> Union[str, int, None]:
- return 99 - self.player_card.CM()
-
- @aliases(["魔法", "魔法值", "MagicPoints"], ignore_case=True)
- def MP(self) -> Union[str, int, None]:
- if hasattr(self, "POW"):
- return math.floor(self.POW() / 5)
- else:
- return None
-
- @aliases(["伤害加值", "DamageBonus"], ignore_case=True)
- def DB(self) -> Union[int, str, None]: # noqa: F811
- sum = self.STR() + self.SIZ()
- return (
- str(math.ceil((sum - 164) / 80)) + "D6"
- if sum > 164
- else "1D4"
- if sum > 124
- else "0"
- if sum > 84
- else "-1"
- if sum > 64
- else "-2"
- if sum > 0
- else None
- )
-
- @aliases(["体格", "build"], ignore_case=True)
- def BUILD(self) -> Union[str, int, None]:
- sum = self.STR() + self.SIZ()
- return (
- math.ceil((sum - 84) / 80)
- if sum > 164
- else 1
- if sum > 124
- else 0
- if sum > 84
- else -1
- if sum > 64
- else -2
- if sum > 0
- else None
- )
-
- @aliases(["移动速度"], ignore_case=True)
- def MOV(self) -> Union[str, int, None]:
- mov = 8
- siz = self.player_card.SIZ()
- str_val = self.player_card.STR()
- dex = self.player_card.DEX()
- age = self.AGE()
-
- if age >= 40:
- mov -= math.floor(age / 10 - 3)
-
- if str_val > siz and dex > siz:
- mov += 1
- elif siz > str_val and siz > dex:
- mov -= 1
-
- return mov
-
- @aliases(["兴趣技能点", "PersonalInterests"], ignore_case=True)
- def PI(self) -> Union[str, int, None]:
- return self.player_card.INT() * 2
-
- @aliases(["闪避", "Dodge"], ignore_case=True)
- def DODGE(self) -> Union[str, int, None]:
- if hasattr(self.player_card, "DEX"):
- return math.floor(self.player_card.DEX / 2)
- return None
-
- @aliases(["锁匠", "开锁", "撬锁", "Locksmith"], ignore_case=True)
- def LOCKSMITH(self) -> Union[str, int, None]:
- return 1
-
- @aliases(["动物驯养", "驯兽", "AnimalHandling"], ignore_case=True)
- def ANIMAL_HANDLING(self) -> Union[str, int, None]:
- return 1
diff --git a/examples/COC7/Wiki.py b/examples/COC7/Wiki.py
deleted file mode 100644
index b97f717..0000000
--- a/examples/COC7/Wiki.py
+++ /dev/null
@@ -1,3 +0,0 @@
-# MyRule
-
-class Wiki(): ... \ No newline at end of file
diff --git a/examples/COC7/__init__.py b/examples/COC7/__init__.py
deleted file mode 100644
index 25acdaa..0000000
--- a/examples/COC7/__init__.py
+++ /dev/null
@@ -1,48 +0,0 @@
-import math
-
-from hrc.core import Core
-from hrc.rule import Rule, BaseRule # noqa: F401
-from hrc.dependencies import Depends
-
-from .Character import Attributes
-from .Wiki import Wiki
-
-core = Core()
-
-
-class COC7(Rule):
-
- attr: Attributes = Depends() # 必须实现一个继承自 Character.Attribute 的子类
- wiki: Wiki = Depends() # 可选实现一个 Wiki 类
-
- @core.event_postprocessor_hook
- async def auto_card(self):
- if self.session and self.session.gid and self.ac:
- if hasattr(self.pc.trans, "生命") or hasattr(self.pc.trans, "理智"):
- self.event.call_back(
- "set_group_card", self.pc.gid, f"card#{self.pc.uid}", await self.overview_card()
- )
-
- async def overview_card(self):
- 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 = (
- " mp" + str(mp) + "/" + str(math.floor(self.pc.get("POW", 0) / 5))
- if mp and mp != math.floor(self.pc.get("POW", 0) / 5)
- else ""
- )
- return (
- self.pc.get("__Name", "")
- + " hp"
- + str(self.pc.get("HP", max_hp))
- + "/"
- + str(max_hp)
- + " san"
- + str(self.pc.get("SAN", "?"))
- + "/"
- + str(max_san)
- + mp_show
- + " DEX"
- + str(self.pc.get("DEX", "?"))
- ) \ No newline at end of file