Skip to content

Commit

Permalink
refactor(filetree): rename package's namespace as hrc
Browse files Browse the repository at this point in the history
  • Loading branch information
HsiangNianian committed Jun 20, 2024
1 parent 2e5b7e8 commit a2477b2
Show file tree
Hide file tree
Showing 28 changed files with 81 additions and 18 deletions.
Binary file added hrc/LibCore.py
Binary file not shown.
2 changes: 1 addition & 1 deletion hydro_roll_core/libcore.pyi → hrc/LibCore.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class libcore(object):
class LibCore(object):
"""Core library for hydro roll"""

def __init__(self, name: str = ""): ...
Expand Down
2 changes: 2 additions & 0 deletions hrc/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from .LibCore import *
from . import rules
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -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):
Expand Down
Original file line number Diff line number Diff line change
@@ -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):
Expand Down
1 change: 1 addition & 0 deletions hrc/rules/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import BaseRule
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion hydro_roll_core/__init__.py

This file was deleted.

Empty file removed hydro_roll_core/rules/__init__.py
Empty file.
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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 = [
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
Expand Down
69 changes: 69 additions & 0 deletions tests/test_BaseRule.py
Original file line number Diff line number Diff line change
@@ -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):
...
7 changes: 2 additions & 5 deletions tests/test_corelib.py
Original file line number Diff line number Diff line change
@@ -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__":
Expand Down

0 comments on commit a2477b2

Please sign in to comment.