diff options
| author | 2024-06-21 04:47:16 +0800 | |
|---|---|---|
| committer | 2024-06-21 04:47:16 +0800 | |
| commit | a2477b28057251c4685dbf0b56359dee7b595bfa (patch) | |
| tree | b1dcd4df60dfcfcc1113d9ee4cd3926a25ca158e | |
| parent | 2e5b7e8ab75e0d80066d1ef5619d10fe827fd5a8 (diff) | |
| download | HydroRollCore-a2477b28057251c4685dbf0b56359dee7b595bfa.tar.gz HydroRollCore-a2477b28057251c4685dbf0b56359dee7b595bfa.zip | |
refactor(filetree): rename package's namespace as `hrc`
| -rw-r--r-- | hrc/LibCore.py | bin | 0 -> 437248 bytes | |||
| -rw-r--r-- | hrc/LibCore.pyi (renamed from hydro_roll_core/libcore.pyi) | 2 | ||||
| -rw-r--r-- | hrc/__init__.py | 2 | ||||
| -rw-r--r-- | hrc/cli.py (renamed from hydro_roll_core/cli.py) | 0 | ||||
| -rw-r--r-- | hrc/config.py (renamed from hydro_roll_core/config.py) | 0 | ||||
| -rw-r--r-- | hrc/const.py (renamed from hydro_roll_core/const.py) | 0 | ||||
| -rw-r--r-- | hrc/core.py (renamed from hydro_roll_core/core.py) | 0 | ||||
| -rw-r--r-- | hrc/dependencies.py (renamed from hydro_roll_core/dependencies.py) | 0 | ||||
| -rw-r--r-- | hrc/development/__init__.py (renamed from hydro_roll_core/development/__init__.py) | 0 | ||||
| -rw-r--r-- | hrc/development/character.py (renamed from hydro_roll_core/development/character.py) | 0 | ||||
| -rw-r--r-- | hrc/document/__init__.py (renamed from hydro_roll_core/document/__init__.py) | 0 | ||||
| -rw-r--r-- | hrc/exceptions.py (renamed from hydro_roll_core/exceptions.py) | 0 | ||||
| -rw-r--r-- | hrc/feature/__init__.py (renamed from hydro_roll_core/feature/__init__.py) | 0 | ||||
| -rw-r--r-- | hrc/log.py (renamed from hydro_roll_core/log.py) | 0 | ||||
| -rw-r--r-- | hrc/performance/__init__.py (renamed from hydro_roll_core/performance/__init__.py) | 0 | ||||
| -rw-r--r-- | hrc/py.typed (renamed from hydro_roll_core/py.typed) | 0 | ||||
| -rw-r--r-- | hrc/rule_package.py (renamed from hydro_roll_core/rule_package.py) | 0 | ||||
| -rw-r--r-- | hrc/rules/BaseRule/JudgeRule.py (renamed from hydro_roll_core/rules/BaseRule/JudgeRule.py) | 7 | ||||
| -rw-r--r-- | hrc/rules/BaseRule/__init__.py (renamed from hydro_roll_core/rules/BaseRule/__init__.py) | 2 | ||||
| -rw-r--r-- | hrc/rules/__init__.py | 1 | ||||
| -rw-r--r-- | hrc/typing.py (renamed from hydro_roll_core/typing.py) | 0 | ||||
| -rw-r--r-- | hrc/utils.py (renamed from hydro_roll_core/utils.py) | 0 | ||||
| -rw-r--r-- | hydro_roll_core/__init__.py | 1 | ||||
| -rw-r--r-- | hydro_roll_core/rules/__init__.py | 0 | ||||
| -rw-r--r-- | pyproject.toml | 6 | ||||
| -rw-r--r-- | src/lib.rs | 2 | ||||
| -rw-r--r-- | tests/test_BaseRule.py | 69 | ||||
| -rw-r--r-- | tests/test_corelib.py | 7 |
28 files changed, 81 insertions, 18 deletions
diff --git a/hrc/LibCore.py b/hrc/LibCore.py Binary files differnew file mode 100644 index 0000000..d85d03a --- /dev/null +++ b/hrc/LibCore.py diff --git a/hydro_roll_core/libcore.pyi b/hrc/LibCore.pyi index 09cfc3d..aa88747 100644 --- a/hydro_roll_core/libcore.pyi +++ b/hrc/LibCore.pyi @@ -1,4 +1,4 @@ -class libcore(object): +class LibCore(object): """Core library for hydro roll""" def __init__(self, name: str = ""): ... diff --git a/hrc/__init__.py b/hrc/__init__.py new file mode 100644 index 0000000..6c6b22c --- /dev/null +++ b/hrc/__init__.py @@ -0,0 +1,2 @@ +from .LibCore import * +from . import rules diff --git a/hydro_roll_core/cli.py b/hrc/cli.py index 55758bc..55758bc 100644 --- a/hydro_roll_core/cli.py +++ b/hrc/cli.py diff --git a/hydro_roll_core/config.py b/hrc/config.py index e69de29..e69de29 100644 --- a/hydro_roll_core/config.py +++ b/hrc/config.py diff --git a/hydro_roll_core/const.py b/hrc/const.py index e69de29..e69de29 100644 --- a/hydro_roll_core/const.py +++ b/hrc/const.py diff --git a/hydro_roll_core/core.py b/hrc/core.py index 020ccb9..020ccb9 100644 --- a/hydro_roll_core/core.py +++ b/hrc/core.py diff --git a/hydro_roll_core/dependencies.py b/hrc/dependencies.py index e69de29..e69de29 100644 --- a/hydro_roll_core/dependencies.py +++ b/hrc/dependencies.py diff --git a/hydro_roll_core/development/__init__.py b/hrc/development/__init__.py index b3e76b3..b3e76b3 100644 --- a/hydro_roll_core/development/__init__.py +++ b/hrc/development/__init__.py diff --git a/hydro_roll_core/development/character.py b/hrc/development/character.py index c883e45..c883e45 100644 --- a/hydro_roll_core/development/character.py +++ b/hrc/development/character.py diff --git a/hydro_roll_core/document/__init__.py b/hrc/document/__init__.py index e69de29..e69de29 100644 --- a/hydro_roll_core/document/__init__.py +++ b/hrc/document/__init__.py diff --git a/hydro_roll_core/exceptions.py b/hrc/exceptions.py index e69de29..e69de29 100644 --- a/hydro_roll_core/exceptions.py +++ b/hrc/exceptions.py diff --git a/hydro_roll_core/feature/__init__.py b/hrc/feature/__init__.py index e69de29..e69de29 100644 --- a/hydro_roll_core/feature/__init__.py +++ b/hrc/feature/__init__.py diff --git a/hydro_roll_core/log.py b/hrc/log.py index e69de29..e69de29 100644 --- a/hydro_roll_core/log.py +++ b/hrc/log.py diff --git a/hydro_roll_core/performance/__init__.py b/hrc/performance/__init__.py index e69de29..e69de29 100644 --- a/hydro_roll_core/performance/__init__.py +++ b/hrc/performance/__init__.py diff --git a/hydro_roll_core/py.typed b/hrc/py.typed index e69de29..e69de29 100644 --- a/hydro_roll_core/py.typed +++ b/hrc/py.typed diff --git a/hydro_roll_core/rule_package.py b/hrc/rule_package.py index e69de29..e69de29 100644 --- a/hydro_roll_core/rule_package.py +++ b/hrc/rule_package.py diff --git a/hydro_roll_core/rules/BaseRule/JudgeRule.py b/hrc/rules/BaseRule/JudgeRule.py index 20e1989..20d28a2 100644 --- a/hydro_roll_core/rules/BaseRule/JudgeRule.py +++ b/hrc/rules/BaseRule/JudgeRule.py @@ -1,14 +1,9 @@ import dataclasses from dataclasses import dataclass from typing import Literal, Optional, Union -from typing_extensions import override @dataclass -class JudgeRule(object): - """判定规则""" - property: type - -class Custom(JudgeRule): +class Custom(object): ... class Attribute(Custom): diff --git a/hydro_roll_core/rules/BaseRule/__init__.py b/hrc/rules/BaseRule/__init__.py index 5730aa8..4d3bc9d 100644 --- a/hydro_roll_core/rules/BaseRule/__init__.py +++ b/hrc/rules/BaseRule/__init__.py @@ -1,8 +1,8 @@ import dataclasses from dataclasses import dataclass from typing import Literal, Optional, Union -from typing_extensions import override +from . import JudgeRule @dataclass class CharacterCard(object): diff --git a/hrc/rules/__init__.py b/hrc/rules/__init__.py new file mode 100644 index 0000000..be96d47 --- /dev/null +++ b/hrc/rules/__init__.py @@ -0,0 +1 @@ +from . import BaseRule
\ No newline at end of file diff --git a/hydro_roll_core/typing.py b/hrc/typing.py index e69de29..e69de29 100644 --- a/hydro_roll_core/typing.py +++ b/hrc/typing.py diff --git a/hydro_roll_core/utils.py b/hrc/utils.py index e69de29..e69de29 100644 --- a/hydro_roll_core/utils.py +++ b/hrc/utils.py diff --git a/hydro_roll_core/__init__.py b/hydro_roll_core/__init__.py deleted file mode 100644 index 1bd4ab1..0000000 --- a/hydro_roll_core/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from .libcore import * diff --git a/hydro_roll_core/rules/__init__.py b/hydro_roll_core/rules/__init__.py deleted file mode 100644 index e69de29..0000000 --- a/hydro_roll_core/rules/__init__.py +++ /dev/null diff --git a/pyproject.toml b/pyproject.toml index 1bc6d03..f053b75 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,8 +20,8 @@ repository = "https://github.com/HydroRoll-Team/HydroRollCore" documentation = "https://core.hydroroll.team/" [project.scripts] -hrc = "hydro_roll_core.cli:Cli" -hydrorollcore = "hydro_roll_core.cli:Cli" +hrc = "hrc.cli:Cli" +hydrorollcore = "hrc.cli:Cli" [tool.ruff] # Exclude a variety of commonly ignored directories. @@ -87,7 +87,7 @@ skip-magic-trailing-comma = false line-ending = "auto" [tool.maturin] -module-name = "hydro_roll_core.libcore" +module-name = "hrc.LibCore" [tool.pdm.dev-dependencies] docs = [ @@ -9,7 +9,7 @@ fn process_rule_pack(rule_pack: &str) -> PyResult<String> { /// A Python module implemented in Rust. #[pymodule] -#[pyo3(name = "libcore")] +#[pyo3(name = "LibCore")] fn libcore(_py: Python, m: &PyModule) -> PyResult<()> { m.add_function(wrap_pyfunction!(process_rule_pack, m)?)?; Ok(()) diff --git a/tests/test_BaseRule.py b/tests/test_BaseRule.py new file mode 100644 index 0000000..f450c28 --- /dev/null +++ b/tests/test_BaseRule.py @@ -0,0 +1,69 @@ +__rule_book__ = "BASIC ROLEPLAYING" + +# General Rule Pack Standard(GRPSv1) + +# 规则书剖析 + +# 共有的大类 +# ============================ +# judge role - 判定规则 +# - 事件判定规则 +# character card - 人物卡(属性) +# playing time* - * + + +# 可选的大类 +# ---------------------------- +# settings - 背景设定 +# custom rule - 自定义规则 +# - 特殊胜利手段(意外死亡、看月亮看死的等) +# expansion rule - 拓展规则 +# - coc 中的伤害价值、调整 +# - 装备中的盾牌 +# - 药水、符文等各种各样时尚小垃圾 + +# 不同的大类(举例) +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +# + + +# 规则包剖析 + +# 根据细类区分 + +# 词条 - Wiki +# 查询条目 - Query +# 规定算法 - Algorithm + +# 游戏时长 - Duration +# 战斗轮、追逐轮、行动轮 +# 回合 +# 幕间 +# 战役 +# 模组 + +# 判定规则 +# - 属性|判定 规则 +# - 技能判定规则 +# - 自定义类判定规则 + +# 人物卡 +# - 属性列表* +# - 技能列表* +# - 人物塑造 +# - 姓名、年龄、种族、阵营 + + +# ============================================== + +# MyRule +from hrc.rules.BaseRule import JudgeRule + +class JudgeAttr(JudgeRule.Attribute): + """来自判定规则 - 属性判定 + + 属性判定规则(模式)""" + + +class JudgeCustom(JudgeRule.Custom): + ... diff --git a/tests/test_corelib.py b/tests/test_corelib.py index 38c2ef9..64b11ce 100644 --- a/tests/test_corelib.py +++ b/tests/test_corelib.py @@ -1,15 +1,12 @@ -from hydro_roll_core import libcore +from hrc import LibCore -cb = libcore +cb = LibCore def main(): rule_pack = "example_rule_pack" result = cb.process_rule_pack(rule_pack) print(result) - print(cb.name) - cb.name = "a" - print(cb.name) if __name__ == "__main__": |
