diff options
| author | 2024-06-27 21:14:04 +0800 | |
|---|---|---|
| committer | 2024-06-27 21:14:04 +0800 | |
| commit | a0ebfdc2cf5f37c40caedcd1dfdcef9660b08f69 (patch) | |
| tree | 8b58231bfc896e546c6716ac0f46a61db43529db | |
| parent | 94d6725582f862031d6573fa0c7c68f495bcca9c (diff) | |
| download | HydroRollCore-a0ebfdc2cf5f37c40caedcd1dfdcef9660b08f69.tar.gz HydroRollCore-a0ebfdc2cf5f37c40caedcd1dfdcef9660b08f69.zip | |
feat(BaseRule): add Character.py
| -rw-r--r-- | docs/_static/.$Structures.svg.dtmp | 4 | ||||
| -rw-r--r-- | docs/_static/Structures.svg | 2 | ||||
| -rw-r--r-- | examples/COC7/Character.py | 127 | ||||
| -rw-r--r-- | examples/COC7/Wiki.py | 12 | ||||
| -rw-r--r-- | examples/COC7/__init__.py | 24 | ||||
| -rw-r--r-- | hrc/rules/BaseRule/JudgeRule.py | 13 | ||||
| -rw-r--r-- | hrc/rules/BaseRule/Wiki.py | 0 | ||||
| -rw-r--r-- | hrc/rules/__init__.py | 3 | ||||
| -rw-r--r-- | hrc/rules/config.py | 4 | ||||
| -rw-r--r-- | pdm.lock | 105 | ||||
| -rw-r--r-- | pyproject.toml | 1 | ||||
| -rw-r--r-- | tests/test_BaseRule.py | 45 |
12 files changed, 279 insertions, 61 deletions
diff --git a/docs/_static/.$Structures.svg.dtmp b/docs/_static/.$Structures.svg.dtmp deleted file mode 100644 index 26247d9..0000000 --- a/docs/_static/.$Structures.svg.dtmp +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- Do not edit this file with editors other than draw.io --> -<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> -<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="571px" height="301px" viewBox="-0.5 -0.5 571 301" content="<mxfile host="Electron" modified="2024-06-26T01:01:45.575Z" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/24.6.1 Chrome/124.0.6367.207 Electron/30.0.6 Safari/537.36" version="24.6.1" etag="pZS_4PXEmtHSB9fLTIs3" type="device" pages="2"> <diagram id="prtHgNgQTEPvFCAcTncT" name="Page-1"> <mxGraphModel dx="1877" dy="649" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0"> <root> <mxCell id="0" /> <mxCell id="1" parent="0" /> <mxCell id="dNxyNK7c78bLwvsdeMH5-11" value="Orgchart" style="swimlane;html=1;startSize=20;horizontal=1;containerType=tree;glass=0;" parent="1" vertex="1"> <mxGeometry x="-40" y="150" width="710" height="290" as="geometry" /> </mxCell> <UserObject label="%name%&lt;br&gt;&lt;i style=&quot;color: gray&quot;&gt;%position%&lt;/i&gt;&lt;br&gt;&lt;a href=&quot;mailto:%email%&quot;&gt;Email&lt;/a&gt;" name="Tessa Miller" position="CFO" location="Office 1" email="me@example.com" placeholders="1" link="https://www.draw.io" id="dNxyNK7c78bLwvsdeMH5-12"> <mxCell style="label;image=https://cdn3.iconfinder.com/data/icons/user-avatars-1/512/users-3-128.png;whiteSpace=wrap;html=1;rounded=0;glass=0;treeMoving=1;treeFolding=1;" parent="dNxyNK7c78bLwvsdeMH5-11" vertex="1"> <mxGeometry x="260" y="50" width="180" height="70" as="geometry" /> </mxCell> </UserObject> <mxCell id="dNxyNK7c78bLwvsdeMH5-13" value="" style="endArrow=blockThin;endFill=1;fontSize=11;edgeStyle=elbowEdgeStyle;elbow=vertical;rounded=0;" parent="dNxyNK7c78bLwvsdeMH5-11" source="dNxyNK7c78bLwvsdeMH5-12" target="dNxyNK7c78bLwvsdeMH5-14" edge="1"> <mxGeometry relative="1" as="geometry" /> </mxCell> <UserObject label="%name%&lt;br&gt;&lt;i style=&quot;color: gray&quot;&gt;%position%&lt;/i&gt;&lt;br&gt;&lt;a href=&quot;mailto:%email%&quot;&gt;Email&lt;/a&gt;" name="Edward Morrison" position="Brand Manager" location="Office 2" email="me@example.com" placeholders="1" link="https://www.draw.io" id="dNxyNK7c78bLwvsdeMH5-14"> <mxCell style="label;image=https://cdn3.iconfinder.com/data/icons/user-avatars-1/512/users-10-3-128.png;whiteSpace=wrap;html=1;rounded=0;glass=0;treeFolding=1;treeMoving=1;" parent="dNxyNK7c78bLwvsdeMH5-11" vertex="1"> <mxGeometry x="40" y="180" width="180" height="80" as="geometry" /> </mxCell> </UserObject> <mxCell id="dNxyNK7c78bLwvsdeMH5-15" value="" style="endArrow=blockThin;endFill=1;fontSize=11;edgeStyle=elbowEdgeStyle;elbow=vertical;rounded=0;" parent="dNxyNK7c78bLwvsdeMH5-11" source="dNxyNK7c78bLwvsdeMH5-12" target="dNxyNK7c78bLwvsdeMH5-16" edge="1"> <mxGeometry relative="1" as="geometry" /> </mxCell> <UserObject label="%name%&lt;br&gt;&lt;i style=&quot;color: gray&quot;&gt;%position%&lt;/i&gt;&lt;br&gt;&lt;a href=&quot;mailto:%email%&quot;&gt;Email&lt;/a&gt;" name="Evan Valet" position="HR Director" location="Office 4" email="me@example.com" placeholders="1" link="https://www.draw.io" id="dNxyNK7c78bLwvsdeMH5-16"> <mxCell style="label;image=https://cdn3.iconfinder.com/data/icons/user-avatars-1/512/users-9-2-128.png;whiteSpace=wrap;html=1;rounded=0;glass=0;treeFolding=1;treeMoving=1;" parent="dNxyNK7c78bLwvsdeMH5-11" vertex="1"> <mxGeometry x="260" y="180" width="180" height="80" as="geometry" /> </mxCell> </UserObject> <mxCell id="dNxyNK7c78bLwvsdeMH5-17" value="" style="endArrow=blockThin;endFill=1;fontSize=11;edgeStyle=elbowEdgeStyle;elbow=vertical;rounded=0;" parent="dNxyNK7c78bLwvsdeMH5-11" source="dNxyNK7c78bLwvsdeMH5-12" target="dNxyNK7c78bLwvsdeMH5-18" edge="1"> <mxGeometry relative="1" as="geometry" /> </mxCell> <UserObject label="%name%&lt;br&gt;&lt;i style=&quot;color: gray&quot;&gt;%position%&lt;/i&gt;&lt;br&gt;&lt;a href=&quot;mailto:%email%&quot;&gt;Email&lt;/a&gt;" name="Alison Donovan" position="System Admin" location="Office 3" email="me@example.com" placeholders="1" link="https://www.draw.io" id="dNxyNK7c78bLwvsdeMH5-18"> <mxCell style="label;image=https://cdn3.iconfinder.com/data/icons/user-avatars-1/512/users-2-128.png;whiteSpace=wrap;html=1;rounded=0;glass=0;" parent="dNxyNK7c78bLwvsdeMH5-11" vertex="1"> <mxGeometry x="490" y="180" width="180" height="80" as="geometry" /> </mxCell> </UserObject> </root> </mxGraphModel> </diagram> <diagram name="Page-1 的副本" id="QUBPRxTMLXw4AuhHwJvm"> <mxGraphModel dx="840" dy="519" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0"> <root> <mxCell id="tazqR-jlQMPDV_MZ-rYC-0" /> <mxCell id="tazqR-jlQMPDV_MZ-rYC-1" parent="tazqR-jlQMPDV_MZ-rYC-0" /> <mxCell id="VPFQTBCB0J-yRa51enEa-0" value="" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="tazqR-jlQMPDV_MZ-rYC-1"> <mxGeometry x="140" y="660" width="570" height="300" as="geometry" /> </mxCell> </root> </mxGraphModel> </diagram> </mxfile> "><defs/><g><g data-cell-id="tazqR-jlQMPDV_MZ-rYC-0"><g data-cell-id="tazqR-jlQMPDV_MZ-rYC-1"><g data-cell-id="VPFQTBCB0J-yRa51enEa-0"><g><rect x="0" y="0" width="570" height="300" fill="rgb(24, 20, 29)" stroke="rgb(240, 240, 240)" pointer-events="all"/></g></g></g></g></g></svg>
\ No newline at end of file diff --git a/docs/_static/Structures.svg b/docs/_static/Structures.svg index 674f55e..b42566b 100644 --- a/docs/_static/Structures.svg +++ b/docs/_static/Structures.svg @@ -1,4 +1,4 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- Do not edit this file with editors other than draw.io --> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> -<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="711px" height="291px" viewBox="-0.5 -0.5 711 291" content="<mxfile host="Electron" modified="2024-06-25T13:25:08.853Z" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/24.6.1 Chrome/124.0.6367.207 Electron/30.0.6 Safari/537.36" version="24.6.1" etag="ly8nYDkHCcTHrMA4GDsg" type="device" pages="2"> <diagram id="prtHgNgQTEPvFCAcTncT" name="Page-1"> <mxGraphModel dx="1877" dy="649" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0"> <root> <mxCell id="0" /> <mxCell id="1" parent="0" /> <mxCell id="dNxyNK7c78bLwvsdeMH5-11" value="Orgchart" style="swimlane;html=1;startSize=20;horizontal=1;containerType=tree;glass=0;" parent="1" vertex="1"> <mxGeometry x="-40" y="150" width="710" height="290" as="geometry" /> </mxCell> <UserObject label="%name%&lt;br&gt;&lt;i style=&quot;color: gray&quot;&gt;%position%&lt;/i&gt;&lt;br&gt;&lt;a href=&quot;mailto:%email%&quot;&gt;Email&lt;/a&gt;" name="Tessa Miller" position="CFO" location="Office 1" email="me@example.com" placeholders="1" link="https://www.draw.io" id="dNxyNK7c78bLwvsdeMH5-12"> <mxCell style="label;image=https://cdn3.iconfinder.com/data/icons/user-avatars-1/512/users-3-128.png;whiteSpace=wrap;html=1;rounded=0;glass=0;treeMoving=1;treeFolding=1;" parent="dNxyNK7c78bLwvsdeMH5-11" vertex="1"> <mxGeometry x="260" y="50" width="180" height="70" as="geometry" /> </mxCell> </UserObject> <mxCell id="dNxyNK7c78bLwvsdeMH5-13" value="" style="endArrow=blockThin;endFill=1;fontSize=11;edgeStyle=elbowEdgeStyle;elbow=vertical;rounded=0;" parent="dNxyNK7c78bLwvsdeMH5-11" source="dNxyNK7c78bLwvsdeMH5-12" target="dNxyNK7c78bLwvsdeMH5-14" edge="1"> <mxGeometry relative="1" as="geometry" /> </mxCell> <UserObject label="%name%&lt;br&gt;&lt;i style=&quot;color: gray&quot;&gt;%position%&lt;/i&gt;&lt;br&gt;&lt;a href=&quot;mailto:%email%&quot;&gt;Email&lt;/a&gt;" name="Edward Morrison" position="Brand Manager" location="Office 2" email="me@example.com" placeholders="1" link="https://www.draw.io" id="dNxyNK7c78bLwvsdeMH5-14"> <mxCell style="label;image=https://cdn3.iconfinder.com/data/icons/user-avatars-1/512/users-10-3-128.png;whiteSpace=wrap;html=1;rounded=0;glass=0;treeFolding=1;treeMoving=1;" parent="dNxyNK7c78bLwvsdeMH5-11" vertex="1"> <mxGeometry x="40" y="180" width="180" height="80" as="geometry" /> </mxCell> </UserObject> <mxCell id="dNxyNK7c78bLwvsdeMH5-15" value="" style="endArrow=blockThin;endFill=1;fontSize=11;edgeStyle=elbowEdgeStyle;elbow=vertical;rounded=0;" parent="dNxyNK7c78bLwvsdeMH5-11" source="dNxyNK7c78bLwvsdeMH5-12" target="dNxyNK7c78bLwvsdeMH5-16" edge="1"> <mxGeometry relative="1" as="geometry" /> </mxCell> <UserObject label="%name%&lt;br&gt;&lt;i style=&quot;color: gray&quot;&gt;%position%&lt;/i&gt;&lt;br&gt;&lt;a href=&quot;mailto:%email%&quot;&gt;Email&lt;/a&gt;" name="Evan Valet" position="HR Director" location="Office 4" email="me@example.com" placeholders="1" link="https://www.draw.io" id="dNxyNK7c78bLwvsdeMH5-16"> <mxCell style="label;image=https://cdn3.iconfinder.com/data/icons/user-avatars-1/512/users-9-2-128.png;whiteSpace=wrap;html=1;rounded=0;glass=0;treeFolding=1;treeMoving=1;" parent="dNxyNK7c78bLwvsdeMH5-11" vertex="1"> <mxGeometry x="260" y="180" width="180" height="80" as="geometry" /> </mxCell> </UserObject> <mxCell id="dNxyNK7c78bLwvsdeMH5-17" value="" style="endArrow=blockThin;endFill=1;fontSize=11;edgeStyle=elbowEdgeStyle;elbow=vertical;rounded=0;" parent="dNxyNK7c78bLwvsdeMH5-11" source="dNxyNK7c78bLwvsdeMH5-12" target="dNxyNK7c78bLwvsdeMH5-18" edge="1"> <mxGeometry relative="1" as="geometry" /> </mxCell> <UserObject label="%name%&lt;br&gt;&lt;i style=&quot;color: gray&quot;&gt;%position%&lt;/i&gt;&lt;br&gt;&lt;a href=&quot;mailto:%email%&quot;&gt;Email&lt;/a&gt;" name="Alison Donovan" position="System Admin" location="Office 3" email="me@example.com" placeholders="1" link="https://www.draw.io" id="dNxyNK7c78bLwvsdeMH5-18"> <mxCell style="label;image=https://cdn3.iconfinder.com/data/icons/user-avatars-1/512/users-2-128.png;whiteSpace=wrap;html=1;rounded=0;glass=0;" parent="dNxyNK7c78bLwvsdeMH5-11" vertex="1"> <mxGeometry x="490" y="180" width="180" height="80" as="geometry" /> </mxCell> </UserObject> </root> </mxGraphModel> </diagram> <diagram name="Page-1 的副本" id="QUBPRxTMLXw4AuhHwJvm"> <mxGraphModel dx="840" dy="519" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0"> <root> <mxCell id="tazqR-jlQMPDV_MZ-rYC-0" /> <mxCell id="tazqR-jlQMPDV_MZ-rYC-1" parent="tazqR-jlQMPDV_MZ-rYC-0" /> <mxCell id="VPFQTBCB0J-yRa51enEa-0" value="" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="tazqR-jlQMPDV_MZ-rYC-1"> <mxGeometry x="140" y="660" width="570" height="300" as="geometry" /> </mxCell> </root> </mxGraphModel> </diagram> </mxfile> "><defs/><g><g data-cell-id="0"><g data-cell-id="1"><g data-cell-id="dNxyNK7c78bLwvsdeMH5-11"><g><path d="M 0 20 L 0 0 L 710 0 L 710 20" fill="rgb(24, 20, 29)" stroke="rgb(240, 240, 240)" stroke-miterlimit="10" pointer-events="all"/><path d="M 0 20 L 0 290 L 710 290 L 710 20" fill="none" stroke="rgb(240, 240, 240)" stroke-miterlimit="10" pointer-events="none"/><path d="M 0 20 L 710 20" fill="none" stroke="rgb(240, 240, 240)" stroke-miterlimit="10" pointer-events="none"/></g><g><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 1px; height: 1px; padding-top: 10px; margin-left: 355px;"><div data-drawio-colors="color: rgb(240, 240, 240); " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(240, 240, 240); line-height: 1.2; pointer-events: all; font-weight: bold; white-space: nowrap;">Orgchart</div></div></div></foreignObject><text x="355" y="14" fill="rgb(240, 240, 240)" font-family=""Helvetica"" font-size="12px" text-anchor="middle" font-weight="bold">Orgchart</text></switch></g></g><g data-cell-id="dNxyNK7c78bLwvsdeMH5-12"><a xlink:href="https://www.draw.io"><g><rect x="260" y="50" width="180" height="70" fill="rgb(24, 20, 29)" stroke="rgb(240, 240, 240)" pointer-events="all"/><image x="266.5" y="63.5" width="42" height="42" xlink:href="https://cdn3.iconfinder.com/data/icons/user-avatars-1/512/users-3-128.png" preserveAspectRatio="none"/></g><g><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe flex-start; width: 126px; height: 1px; padding-top: 85px; margin-left: 314px;"><div data-drawio-colors="color: rgb(240, 240, 240); " style="box-sizing: border-box; font-size: 0px; text-align: left;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(240, 240, 240); line-height: 1.2; pointer-events: all; font-weight: bold; white-space: normal; overflow-wrap: normal;">Tessa Miller<br /><i style="color: gray">CFO</i><br /><a href="mailto:me@example.com">Email</a></div></div></div></foreignObject><text x="314" y="89" fill="rgb(240, 240, 240)" font-family=""Helvetica"" font-size="12px" font-weight="bold">Tessa Miller...</text></switch></g></g></a></g><g data-cell-id="dNxyNK7c78bLwvsdeMH5-13"><g><path d="M 350 120 L 350 150 L 130 150 L 130 171.88" fill="none" stroke="rgb(240, 240, 240)" stroke-miterlimit="10" pointer-events="stroke"/><path d="M 130 178.88 L 127.67 171.88 L 132.33 171.88 Z" fill="rgb(240, 240, 240)" stroke="rgb(240, 240, 240)" stroke-miterlimit="10" pointer-events="all"/></g></g><g data-cell-id="dNxyNK7c78bLwvsdeMH5-14"><a xlink:href="https://www.draw.io"><g><rect x="40" y="180" width="180" height="80" fill="rgb(24, 20, 29)" stroke="rgb(240, 240, 240)" pointer-events="all"/><image x="46.5" y="198.5" width="42" height="42" xlink:href="https://cdn3.iconfinder.com/data/icons/user-avatars-1/512/users-10-3-128.png" preserveAspectRatio="none"/></g><g><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe flex-start; width: 126px; height: 1px; padding-top: 220px; margin-left: 94px;"><div data-drawio-colors="color: rgb(240, 240, 240); " style="box-sizing: border-box; font-size: 0px; text-align: left;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(240, 240, 240); line-height: 1.2; pointer-events: all; font-weight: bold; white-space: normal; overflow-wrap: normal;">Edward Morrison<br /><i style="color: gray">Brand Manager</i><br /><a href="mailto:me@example.com">Email</a></div></div></div></foreignObject><text x="94" y="224" fill="rgb(240, 240, 240)" font-family=""Helvetica"" font-size="12px" font-weight="bold">Edward Morrison...</text></switch></g></g></a></g><g data-cell-id="dNxyNK7c78bLwvsdeMH5-15"><g><path d="M 350 120 L 350 150 L 350 171.88" fill="none" stroke="rgb(240, 240, 240)" stroke-miterlimit="10" pointer-events="stroke"/><path d="M 350 178.88 L 347.67 171.88 L 352.33 171.88 Z" fill="rgb(240, 240, 240)" stroke="rgb(240, 240, 240)" stroke-miterlimit="10" pointer-events="all"/></g></g><g data-cell-id="dNxyNK7c78bLwvsdeMH5-16"><a xlink:href="https://www.draw.io"><g><rect x="260" y="180" width="180" height="80" fill="rgb(24, 20, 29)" stroke="rgb(240, 240, 240)" pointer-events="all"/><image x="266.5" y="198.5" width="42" height="42" xlink:href="https://cdn3.iconfinder.com/data/icons/user-avatars-1/512/users-9-2-128.png" preserveAspectRatio="none"/></g><g><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe flex-start; width: 126px; height: 1px; padding-top: 220px; margin-left: 314px;"><div data-drawio-colors="color: rgb(240, 240, 240); " style="box-sizing: border-box; font-size: 0px; text-align: left;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(240, 240, 240); line-height: 1.2; pointer-events: all; font-weight: bold; white-space: normal; overflow-wrap: normal;">Evan Valet<br /><i style="color: gray">HR Director</i><br /><a href="mailto:me@example.com">Email</a></div></div></div></foreignObject><text x="314" y="224" fill="rgb(240, 240, 240)" font-family=""Helvetica"" font-size="12px" font-weight="bold">Evan Valet...</text></switch></g></g></a></g><g data-cell-id="dNxyNK7c78bLwvsdeMH5-17"><g><path d="M 350 120 L 350 150 L 580 150 L 580 171.88" fill="none" stroke="rgb(240, 240, 240)" stroke-miterlimit="10" pointer-events="stroke"/><path d="M 580 178.88 L 577.67 171.88 L 582.33 171.88 Z" fill="rgb(240, 240, 240)" stroke="rgb(240, 240, 240)" stroke-miterlimit="10" pointer-events="all"/></g></g><g data-cell-id="dNxyNK7c78bLwvsdeMH5-18"><a xlink:href="https://www.draw.io"><g><rect x="490" y="180" width="180" height="80" fill="rgb(24, 20, 29)" stroke="rgb(240, 240, 240)" pointer-events="all"/><image x="496.5" y="198.5" width="42" height="42" xlink:href="https://cdn3.iconfinder.com/data/icons/user-avatars-1/512/users-2-128.png" preserveAspectRatio="none"/></g><g><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe flex-start; width: 126px; height: 1px; padding-top: 220px; margin-left: 544px;"><div data-drawio-colors="color: rgb(240, 240, 240); " style="box-sizing: border-box; font-size: 0px; text-align: left;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(240, 240, 240); line-height: 1.2; pointer-events: all; font-weight: bold; white-space: normal; overflow-wrap: normal;">Alison Donovan<br /><i style="color: gray">System Admin</i><br /><a href="mailto:me@example.com">Email</a></div></div></div></foreignObject><text x="544" y="224" fill="rgb(240, 240, 240)" font-family=""Helvetica"" font-size="12px" font-weight="bold">Alison Donovan...</text></switch></g></g></a></g></g></g></g></g><switch><g requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"/><a transform="translate(0,-5)" xlink:href="https://www.drawio.com/doc/faq/svg-export-text-problems" target="_blank"><text text-anchor="middle" font-size="10px" x="50%" y="100%">Text is not SVG - cannot display</text></a></switch></svg>
\ No newline at end of file +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="711px" height="291px" viewBox="-0.5 -0.5 711 291" content="<mxfile host="Electron" modified="2024-06-26T06:58:36.732Z" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/24.6.1 Chrome/124.0.6367.207 Electron/30.0.6 Safari/537.36" version="24.6.1" etag="jsh3je75ImQiPwudZv7c" type="device" pages="2"> <diagram id="prtHgNgQTEPvFCAcTncT" name="Page-1"> <mxGraphModel dx="1877" dy="649" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0"> <root> <mxCell id="0" /> <mxCell id="1" parent="0" /> <mxCell id="dNxyNK7c78bLwvsdeMH5-11" value="Orgchart" style="swimlane;html=1;startSize=20;horizontal=1;containerType=tree;glass=0;" parent="1" vertex="1"> <mxGeometry x="-40" y="150" width="710" height="290" as="geometry" /> </mxCell> <UserObject label="%name%&lt;br&gt;&lt;i style=&quot;color: gray&quot;&gt;%position%&lt;/i&gt;&lt;br&gt;&lt;a href=&quot;mailto:%email%&quot;&gt;Email&lt;/a&gt;" name="Tessa Miller" position="CFO" location="Office 1" email="me@example.com" placeholders="1" link="https://www.draw.io" id="dNxyNK7c78bLwvsdeMH5-12"> <mxCell style="label;image=https://cdn3.iconfinder.com/data/icons/user-avatars-1/512/users-3-128.png;whiteSpace=wrap;html=1;rounded=0;glass=0;treeMoving=1;treeFolding=1;" parent="dNxyNK7c78bLwvsdeMH5-11" vertex="1"> <mxGeometry x="260" y="50" width="180" height="70" as="geometry" /> </mxCell> </UserObject> <mxCell id="dNxyNK7c78bLwvsdeMH5-13" value="" style="endArrow=blockThin;endFill=1;fontSize=11;edgeStyle=elbowEdgeStyle;elbow=vertical;rounded=0;" parent="dNxyNK7c78bLwvsdeMH5-11" source="dNxyNK7c78bLwvsdeMH5-12" target="dNxyNK7c78bLwvsdeMH5-14" edge="1"> <mxGeometry relative="1" as="geometry" /> </mxCell> <UserObject label="%name%&lt;br&gt;&lt;i style=&quot;color: gray&quot;&gt;%position%&lt;/i&gt;&lt;br&gt;&lt;a href=&quot;mailto:%email%&quot;&gt;Email&lt;/a&gt;" name="Edward Morrison" position="Brand Manager" location="Office 2" email="me@example.com" placeholders="1" link="https://www.draw.io" id="dNxyNK7c78bLwvsdeMH5-14"> <mxCell style="label;image=https://cdn3.iconfinder.com/data/icons/user-avatars-1/512/users-10-3-128.png;whiteSpace=wrap;html=1;rounded=0;glass=0;treeFolding=1;treeMoving=1;" parent="dNxyNK7c78bLwvsdeMH5-11" vertex="1"> <mxGeometry x="40" y="180" width="180" height="80" as="geometry" /> </mxCell> </UserObject> <mxCell id="dNxyNK7c78bLwvsdeMH5-15" value="" style="endArrow=blockThin;endFill=1;fontSize=11;edgeStyle=elbowEdgeStyle;elbow=vertical;rounded=0;" parent="dNxyNK7c78bLwvsdeMH5-11" source="dNxyNK7c78bLwvsdeMH5-12" target="dNxyNK7c78bLwvsdeMH5-16" edge="1"> <mxGeometry relative="1" as="geometry" /> </mxCell> <UserObject label="%name%&lt;br&gt;&lt;i style=&quot;color: gray&quot;&gt;%position%&lt;/i&gt;&lt;br&gt;&lt;a href=&quot;mailto:%email%&quot;&gt;Email&lt;/a&gt;" name="Evan Valet" position="HR Director" location="Office 4" email="me@example.com" placeholders="1" link="https://www.draw.io" id="dNxyNK7c78bLwvsdeMH5-16"> <mxCell style="label;image=https://cdn3.iconfinder.com/data/icons/user-avatars-1/512/users-9-2-128.png;whiteSpace=wrap;html=1;rounded=0;glass=0;treeFolding=1;treeMoving=1;" parent="dNxyNK7c78bLwvsdeMH5-11" vertex="1"> <mxGeometry x="260" y="180" width="180" height="80" as="geometry" /> </mxCell> </UserObject> <mxCell id="dNxyNK7c78bLwvsdeMH5-17" value="" style="endArrow=blockThin;endFill=1;fontSize=11;edgeStyle=elbowEdgeStyle;elbow=vertical;rounded=0;" parent="dNxyNK7c78bLwvsdeMH5-11" source="dNxyNK7c78bLwvsdeMH5-12" target="dNxyNK7c78bLwvsdeMH5-18" edge="1"> <mxGeometry relative="1" as="geometry" /> </mxCell> <UserObject label="%name%&lt;br&gt;&lt;i style=&quot;color: gray&quot;&gt;%position%&lt;/i&gt;&lt;br&gt;&lt;a href=&quot;mailto:%email%&quot;&gt;Email&lt;/a&gt;" name="Alison Donovan" position="System Admin" location="Office 3" email="me@example.com" placeholders="1" link="https://www.draw.io" id="dNxyNK7c78bLwvsdeMH5-18"> <mxCell style="label;image=https://cdn3.iconfinder.com/data/icons/user-avatars-1/512/users-2-128.png;whiteSpace=wrap;html=1;rounded=0;glass=0;" parent="dNxyNK7c78bLwvsdeMH5-11" vertex="1"> <mxGeometry x="490" y="180" width="180" height="80" as="geometry" /> </mxCell> </UserObject> </root> </mxGraphModel> </diagram> <diagram name="Page-1 的副本" id="QUBPRxTMLXw4AuhHwJvm"> <mxGraphModel dx="840" dy="519" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0"> <root> <mxCell id="tazqR-jlQMPDV_MZ-rYC-0" /> <mxCell id="tazqR-jlQMPDV_MZ-rYC-1" parent="tazqR-jlQMPDV_MZ-rYC-0" /> <mxCell id="VPFQTBCB0J-yRa51enEa-0" value="" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="tazqR-jlQMPDV_MZ-rYC-1"> <mxGeometry x="60" y="560" width="650" height="400" as="geometry" /> </mxCell> <mxCell id="VPFQTBCB0J-yRa51enEa-3" value="" style="shape=internalStorage;whiteSpace=wrap;html=1;backgroundOutline=1;" vertex="1" parent="tazqR-jlQMPDV_MZ-rYC-1"> <mxGeometry x="80" y="580" width="80" height="80" as="geometry" /> </mxCell> </root> </mxGraphModel> </diagram> </mxfile> "><defs/><g><g data-cell-id="0"><g data-cell-id="1"><g data-cell-id="dNxyNK7c78bLwvsdeMH5-11"><g><path d="M 0 20 L 0 0 L 710 0 L 710 20" fill="rgb(24, 20, 29)" stroke="rgb(240, 240, 240)" stroke-miterlimit="10" pointer-events="all"/><path d="M 0 20 L 0 290 L 710 290 L 710 20" fill="none" stroke="rgb(240, 240, 240)" stroke-miterlimit="10" pointer-events="none"/><path d="M 0 20 L 710 20" fill="none" stroke="rgb(240, 240, 240)" stroke-miterlimit="10" pointer-events="none"/></g><g><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 1px; height: 1px; padding-top: 10px; margin-left: 355px;"><div data-drawio-colors="color: rgb(240, 240, 240); " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(240, 240, 240); line-height: 1.2; pointer-events: all; font-weight: bold; white-space: nowrap;">Orgchart</div></div></div></foreignObject><text x="355" y="14" fill="rgb(240, 240, 240)" font-family=""Helvetica"" font-size="12px" text-anchor="middle" font-weight="bold">Orgchart</text></switch></g></g><g data-cell-id="dNxyNK7c78bLwvsdeMH5-12"><a xlink:href="https://www.draw.io"><g><rect x="260" y="50" width="180" height="70" fill="rgb(24, 20, 29)" stroke="rgb(240, 240, 240)" pointer-events="all"/><image x="266.5" y="63.5" width="42" height="42" xlink:href="https://cdn3.iconfinder.com/data/icons/user-avatars-1/512/users-3-128.png" preserveAspectRatio="none"/></g><g><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe flex-start; width: 126px; height: 1px; padding-top: 85px; margin-left: 314px;"><div data-drawio-colors="color: rgb(240, 240, 240); " style="box-sizing: border-box; font-size: 0px; text-align: left;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(240, 240, 240); line-height: 1.2; pointer-events: all; font-weight: bold; white-space: normal; overflow-wrap: normal;">Tessa Miller<br /><i style="color: gray">CFO</i><br /><a href="mailto:me@example.com">Email</a></div></div></div></foreignObject><text x="314" y="89" fill="rgb(240, 240, 240)" font-family=""Helvetica"" font-size="12px" font-weight="bold">Tessa Miller...</text></switch></g></g></a></g><g data-cell-id="dNxyNK7c78bLwvsdeMH5-13"><g><path d="M 350 120 L 350 150 L 130 150 L 130 171.88" fill="none" stroke="rgb(240, 240, 240)" stroke-miterlimit="10" pointer-events="stroke"/><path d="M 130 178.88 L 127.67 171.88 L 132.33 171.88 Z" fill="rgb(240, 240, 240)" stroke="rgb(240, 240, 240)" stroke-miterlimit="10" pointer-events="all"/></g></g><g data-cell-id="dNxyNK7c78bLwvsdeMH5-14"><a xlink:href="https://www.draw.io"><g><rect x="40" y="180" width="180" height="80" fill="rgb(24, 20, 29)" stroke="rgb(240, 240, 240)" pointer-events="all"/><image x="46.5" y="198.5" width="42" height="42" xlink:href="https://cdn3.iconfinder.com/data/icons/user-avatars-1/512/users-10-3-128.png" preserveAspectRatio="none"/></g><g><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe flex-start; width: 126px; height: 1px; padding-top: 220px; margin-left: 94px;"><div data-drawio-colors="color: rgb(240, 240, 240); " style="box-sizing: border-box; font-size: 0px; text-align: left;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(240, 240, 240); line-height: 1.2; pointer-events: all; font-weight: bold; white-space: normal; overflow-wrap: normal;">Edward Morrison<br /><i style="color: gray">Brand Manager</i><br /><a href="mailto:me@example.com">Email</a></div></div></div></foreignObject><text x="94" y="224" fill="rgb(240, 240, 240)" font-family=""Helvetica"" font-size="12px" font-weight="bold">Edward Morrison...</text></switch></g></g></a></g><g data-cell-id="dNxyNK7c78bLwvsdeMH5-15"><g><path d="M 350 120 L 350 150 L 350 171.88" fill="none" stroke="rgb(240, 240, 240)" stroke-miterlimit="10" pointer-events="stroke"/><path d="M 350 178.88 L 347.67 171.88 L 352.33 171.88 Z" fill="rgb(240, 240, 240)" stroke="rgb(240, 240, 240)" stroke-miterlimit="10" pointer-events="all"/></g></g><g data-cell-id="dNxyNK7c78bLwvsdeMH5-16"><a xlink:href="https://www.draw.io"><g><rect x="260" y="180" width="180" height="80" fill="rgb(24, 20, 29)" stroke="rgb(240, 240, 240)" pointer-events="all"/><image x="266.5" y="198.5" width="42" height="42" xlink:href="https://cdn3.iconfinder.com/data/icons/user-avatars-1/512/users-9-2-128.png" preserveAspectRatio="none"/></g><g><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe flex-start; width: 126px; height: 1px; padding-top: 220px; margin-left: 314px;"><div data-drawio-colors="color: rgb(240, 240, 240); " style="box-sizing: border-box; font-size: 0px; text-align: left;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(240, 240, 240); line-height: 1.2; pointer-events: all; font-weight: bold; white-space: normal; overflow-wrap: normal;">Evan Valet<br /><i style="color: gray">HR Director</i><br /><a href="mailto:me@example.com">Email</a></div></div></div></foreignObject><text x="314" y="224" fill="rgb(240, 240, 240)" font-family=""Helvetica"" font-size="12px" font-weight="bold">Evan Valet...</text></switch></g></g></a></g><g data-cell-id="dNxyNK7c78bLwvsdeMH5-17"><g><path d="M 350 120 L 350 150 L 580 150 L 580 171.88" fill="none" stroke="rgb(240, 240, 240)" stroke-miterlimit="10" pointer-events="stroke"/><path d="M 580 178.88 L 577.67 171.88 L 582.33 171.88 Z" fill="rgb(240, 240, 240)" stroke="rgb(240, 240, 240)" stroke-miterlimit="10" pointer-events="all"/></g></g><g data-cell-id="dNxyNK7c78bLwvsdeMH5-18"><a xlink:href="https://www.draw.io"><g><rect x="490" y="180" width="180" height="80" fill="rgb(24, 20, 29)" stroke="rgb(240, 240, 240)" pointer-events="all"/><image x="496.5" y="198.5" width="42" height="42" xlink:href="https://cdn3.iconfinder.com/data/icons/user-avatars-1/512/users-2-128.png" preserveAspectRatio="none"/></g><g><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe flex-start; width: 126px; height: 1px; padding-top: 220px; margin-left: 544px;"><div data-drawio-colors="color: rgb(240, 240, 240); " style="box-sizing: border-box; font-size: 0px; text-align: left;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(240, 240, 240); line-height: 1.2; pointer-events: all; font-weight: bold; white-space: normal; overflow-wrap: normal;">Alison Donovan<br /><i style="color: gray">System Admin</i><br /><a href="mailto:me@example.com">Email</a></div></div></div></foreignObject><text x="544" y="224" fill="rgb(240, 240, 240)" font-family=""Helvetica"" font-size="12px" font-weight="bold">Alison Donovan...</text></switch></g></g></a></g></g></g></g></g><switch><g requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"/><a transform="translate(0,-5)" xlink:href="https://www.drawio.com/doc/faq/svg-export-text-problems" target="_blank"><text text-anchor="middle" font-size="10px" x="50%" y="100%">Text is not SVG - cannot display</text></a></switch></svg>
\ No newline at end of file diff --git a/examples/COC7/Character.py b/examples/COC7/Character.py new file mode 100644 index 0000000..d2a6b9f --- /dev/null +++ b/examples/COC7/Character.py @@ -0,0 +1,127 @@ +# MyRule +import math +import dataclasses + +from dataclasses import dataclass +from typing import Literal, Optional, Union +from pydantic import Field, BaseModel +from hrc.rules import aliases, BaseRule +from hrc.rules.BaseRule import CharacterCard + + +@dataclass +class Attributes(CharacterCard.Attribute): + + @property + @aliases(['luck', '运气'], ignore_case=True) + def LUK(self) -> Union[str, int]: ... + + @property + def DB(self) -> Union[str, int]: + sum = self.player_card.STR + self.player_card.SIZ + if sum == 164: + return math.ceil((sum-164)/80) + "D6" + elif sum == 124: + return "1D4" + + @property + @aliases(['年龄', 'age'], ignore_case=True) + def AGE(self) -> Union[str, int]: ... + + @property + @aliases(['HitPoints', '生命值', '生命'], ignore_case=True) + def HP(self) -> Union[str, int]: + return self.MAX_HP + + @property + @aliases(['最大生命值', 'HitPointTotal', '总生命值'], ignore_case=True) + def MAX_HP(self) -> Union[str, int]: + if hasattr(self, 'CON') and hasattr(self, 'SIZ'): + return (self.CON + self.SIZ) // 10 + else: + return None + + @property + @aliases(['理智', 'Sanity', 'SanityPoint', '理智值', 'san值'], ignore_case=True) + def SAN(self) -> Union[str, int]: + return self.POW + + @property + @aliases(['最大理智值', 'MaximumSanity'], ignore_case=True) + def MAX_SAN(self) -> Union[str, int]: + return 99 - self.player_card.CM + + @property + @aliases(['魔法', '魔法值', 'MagicPoints'], ignore_case=True) + def MP(self) -> Union[str, int]: + if hasattr(self, 'POW'): + return math.floor(self.POW / 5) + else: + return None + + @property + @aliases(['伤害加值', 'DamageBonus'], ignore_case=True) + def DB(self) -> Union[int, str, 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 + ) + + @property + @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 + ) + + @property + @aliases(['移动速度'], ignore_case=True) + def MOV(self) -> Union[str, int, None]: + mov = 8 + siz = self.SIZ + str_val = self.STR + dex = self.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 + + @property + @aliases(['兴趣技能点', 'PersonalInterests'], ignore_case=Ture) + def PI(self) -> Union[str, int, None]: + return self.player_card.INT*2 + + @property + @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 + + @property + @aliases(['锁匠', '开锁', '撬锁', 'Locksmith'], ignore_case=True) + def LOCKSMITH(self) -> Union[str, int, None]: + return 1 + + @property + @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 new file mode 100644 index 0000000..060fb9d --- /dev/null +++ b/examples/COC7/Wiki.py @@ -0,0 +1,12 @@ +# MyRule +import math +import dataclasses + +from dataclasses import dataclass +from typing import Literal, Optional, Union +from pydantic import Field, BaseModel +from hrc.rules import aliases, BaseRule +from hrc.rules.BaseRule import CharacterCard + +class Query(Wiki): +
\ No newline at end of file diff --git a/examples/COC7/__init__.py b/examples/COC7/__init__.py new file mode 100644 index 0000000..f3d781f --- /dev/null +++ b/examples/COC7/__init__.py @@ -0,0 +1,24 @@ +import math + +from hrc import Core, player_card + +core = Core() + + +@core.event_post_processor_hook +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)) + + +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', "?")) diff --git a/hrc/rules/BaseRule/JudgeRule.py b/hrc/rules/BaseRule/JudgeRule.py deleted file mode 100644 index 20d28a2..0000000 --- a/hrc/rules/BaseRule/JudgeRule.py +++ /dev/null @@ -1,13 +0,0 @@ -import dataclasses -from dataclasses import dataclass -from typing import Literal, Optional, Union - -@dataclass -class Custom(object): - ... - -class Attribute(Custom): - ... - -class Skill(Custom): - ... diff --git a/hrc/rules/BaseRule/Wiki.py b/hrc/rules/BaseRule/Wiki.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/hrc/rules/BaseRule/Wiki.py diff --git a/hrc/rules/__init__.py b/hrc/rules/__init__.py index ccd3dbc..a32b693 100644 --- a/hrc/rules/__init__.py +++ b/hrc/rules/__init__.py @@ -8,4 +8,5 @@ from ..typing import RulesT class Rules(ABC, Generic[RulesT]): ... -
\ No newline at end of file + + diff --git a/hrc/rules/config.py b/hrc/rules/config.py new file mode 100644 index 0000000..2926a03 --- /dev/null +++ b/hrc/rules/config.py @@ -0,0 +1,4 @@ +from pydantic import ConfigDict, BaseModel + +class ConfigModel(BaseModel): + ...
\ No newline at end of file @@ -5,7 +5,7 @@ groups = ["default", "lint", "dev", "docs"] strategy = ["cross_platform"] lock_version = "4.4.1" -content_hash = "sha256:6a397399cbb573c77556f406ad9fcb7d091c37929af55bc146f6e7c952ae88dd" +content_hash = "sha256:01b1c497f1340087f8c5b728e930e69903dce579c47f26951fbe859693efabee" [[package]] name = "alabaster" @@ -18,6 +18,16 @@ files = [ ] [[package]] +name = "annotated-types" +version = "0.7.0" +requires_python = ">=3.8" +summary = "Reusable constraint types to use with typing.Annotated" +files = [ + {file = "annotated_types-0.7.0-py3-none-any.whl", hash = "sha256:1f02e8b43a8fbbc3f3e0d4f0f4bfc8131bcb4eebe8849b8e5c773f3a1c582a53"}, + {file = "annotated_types-0.7.0.tar.gz", hash = "sha256:aff07c09a53a08bc8cfccb9c85b05f1aa9a2a6f23728d790723543408344ce89"}, +] + +[[package]] name = "anyio" version = "4.3.0" requires_python = ">=3.8" @@ -733,6 +743,99 @@ files = [ ] [[package]] +name = "pydantic" +version = "2.7.4" +requires_python = ">=3.8" +summary = "Data validation using Python type hints" +dependencies = [ + "annotated-types>=0.4.0", + "pydantic-core==2.18.4", + "typing-extensions>=4.6.1", +] +files = [ + {file = "pydantic-2.7.4-py3-none-any.whl", hash = "sha256:ee8538d41ccb9c0a9ad3e0e5f07bf15ed8015b481ced539a1759d8cc89ae90d0"}, + {file = "pydantic-2.7.4.tar.gz", hash = "sha256:0c84efd9548d545f63ac0060c1e4d39bb9b14db8b3c0652338aecc07b5adec52"}, +] + +[[package]] +name = "pydantic-core" +version = "2.18.4" +requires_python = ">=3.8" +summary = "Core functionality for Pydantic validation and serialization" +dependencies = [ + "typing-extensions!=4.7.0,>=4.6.0", +] +files = [ + {file = "pydantic_core-2.18.4-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:f76d0ad001edd426b92233d45c746fd08f467d56100fd8f30e9ace4b005266e4"}, + {file = "pydantic_core-2.18.4-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:59ff3e89f4eaf14050c8022011862df275b552caef8082e37b542b066ce1ff26"}, + {file = "pydantic_core-2.18.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a55b5b16c839df1070bc113c1f7f94a0af4433fcfa1b41799ce7606e5c79ce0a"}, + {file = "pydantic_core-2.18.4-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:4d0dcc59664fcb8974b356fe0a18a672d6d7cf9f54746c05f43275fc48636851"}, + {file = "pydantic_core-2.18.4-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:8951eee36c57cd128f779e641e21eb40bc5073eb28b2d23f33eb0ef14ffb3f5d"}, + {file = "pydantic_core-2.18.4-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:4701b19f7e3a06ea655513f7938de6f108123bf7c86bbebb1196eb9bd35cf724"}, + {file = "pydantic_core-2.18.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e00a3f196329e08e43d99b79b286d60ce46bed10f2280d25a1718399457e06be"}, + {file = "pydantic_core-2.18.4-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:97736815b9cc893b2b7f663628e63f436018b75f44854c8027040e05230eeddb"}, + {file = "pydantic_core-2.18.4-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:6891a2ae0e8692679c07728819b6e2b822fb30ca7445f67bbf6509b25a96332c"}, + {file = "pydantic_core-2.18.4-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:bc4ff9805858bd54d1a20efff925ccd89c9d2e7cf4986144b30802bf78091c3e"}, + {file = "pydantic_core-2.18.4-cp310-none-win32.whl", hash = "sha256:1b4de2e51bbcb61fdebd0ab86ef28062704f62c82bbf4addc4e37fa4b00b7cbc"}, + {file = "pydantic_core-2.18.4-cp310-none-win_amd64.whl", hash = "sha256:6a750aec7bf431517a9fd78cb93c97b9b0c496090fee84a47a0d23668976b4b0"}, + {file = "pydantic_core-2.18.4-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:942ba11e7dfb66dc70f9ae66b33452f51ac7bb90676da39a7345e99ffb55402d"}, + {file = "pydantic_core-2.18.4-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:b2ebef0e0b4454320274f5e83a41844c63438fdc874ea40a8b5b4ecb7693f1c4"}, + {file = "pydantic_core-2.18.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a642295cd0c8df1b86fc3dced1d067874c353a188dc8e0f744626d49e9aa51c4"}, + {file = "pydantic_core-2.18.4-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:5f09baa656c904807e832cf9cce799c6460c450c4ad80803517032da0cd062e2"}, + {file = "pydantic_core-2.18.4-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:98906207f29bc2c459ff64fa007afd10a8c8ac080f7e4d5beff4c97086a3dabd"}, + {file = "pydantic_core-2.18.4-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:19894b95aacfa98e7cb093cd7881a0c76f55731efad31073db4521e2b6ff5b7d"}, + {file = "pydantic_core-2.18.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0fbbdc827fe5e42e4d196c746b890b3d72876bdbf160b0eafe9f0334525119c8"}, + {file = "pydantic_core-2.18.4-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:f85d05aa0918283cf29a30b547b4df2fbb56b45b135f9e35b6807cb28bc47951"}, + {file = "pydantic_core-2.18.4-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:e85637bc8fe81ddb73fda9e56bab24560bdddfa98aa64f87aaa4e4b6730c23d2"}, + {file = "pydantic_core-2.18.4-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:2f5966897e5461f818e136b8451d0551a2e77259eb0f73a837027b47dc95dab9"}, + {file = "pydantic_core-2.18.4-cp311-none-win32.whl", hash = "sha256:44c7486a4228413c317952e9d89598bcdfb06399735e49e0f8df643e1ccd0558"}, + {file = "pydantic_core-2.18.4-cp311-none-win_amd64.whl", hash = "sha256:8a7164fe2005d03c64fd3b85649891cd4953a8de53107940bf272500ba8a788b"}, + {file = "pydantic_core-2.18.4-cp311-none-win_arm64.whl", hash = "sha256:4e99bc050fe65c450344421017f98298a97cefc18c53bb2f7b3531eb39bc7805"}, + {file = "pydantic_core-2.18.4-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:6f5c4d41b2771c730ea1c34e458e781b18cc668d194958e0112455fff4e402b2"}, + {file = "pydantic_core-2.18.4-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:2fdf2156aa3d017fddf8aea5adfba9f777db1d6022d392b682d2a8329e087cef"}, + {file = "pydantic_core-2.18.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4748321b5078216070b151d5271ef3e7cc905ab170bbfd27d5c83ee3ec436695"}, + {file = "pydantic_core-2.18.4-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:847a35c4d58721c5dc3dba599878ebbdfd96784f3fb8bb2c356e123bdcd73f34"}, + {file = "pydantic_core-2.18.4-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:3c40d4eaad41f78e3bbda31b89edc46a3f3dc6e171bf0ecf097ff7a0ffff7cb1"}, + {file = "pydantic_core-2.18.4-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:21a5e440dbe315ab9825fcd459b8814bb92b27c974cbc23c3e8baa2b76890077"}, + {file = "pydantic_core-2.18.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:01dd777215e2aa86dfd664daed5957704b769e726626393438f9c87690ce78c3"}, + {file = "pydantic_core-2.18.4-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:4b06beb3b3f1479d32befd1f3079cc47b34fa2da62457cdf6c963393340b56e9"}, + {file = "pydantic_core-2.18.4-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:564d7922e4b13a16b98772441879fcdcbe82ff50daa622d681dd682175ea918c"}, + {file = "pydantic_core-2.18.4-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:0eb2a4f660fcd8e2b1c90ad566db2b98d7f3f4717c64fe0a83e0adb39766d5b8"}, + {file = "pydantic_core-2.18.4-cp312-none-win32.whl", hash = "sha256:8b8bab4c97248095ae0c4455b5a1cd1cdd96e4e4769306ab19dda135ea4cdb07"}, + {file = "pydantic_core-2.18.4-cp312-none-win_amd64.whl", hash = "sha256:14601cdb733d741b8958224030e2bfe21a4a881fb3dd6fbb21f071cabd48fa0a"}, + {file = "pydantic_core-2.18.4-cp312-none-win_arm64.whl", hash = "sha256:c1322d7dd74713dcc157a2b7898a564ab091ca6c58302d5c7b4c07296e3fd00f"}, + {file = "pydantic_core-2.18.4-cp39-cp39-macosx_10_12_x86_64.whl", hash = "sha256:44a688331d4a4e2129140a8118479443bd6f1905231138971372fcde37e43528"}, + {file = "pydantic_core-2.18.4-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:a2fdd81edd64342c85ac7cf2753ccae0b79bf2dfa063785503cb85a7d3593223"}, + {file = "pydantic_core-2.18.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:86110d7e1907ab36691f80b33eb2da87d780f4739ae773e5fc83fb272f88825f"}, + {file = "pydantic_core-2.18.4-cp39-cp39-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:46387e38bd641b3ee5ce247563b60c5ca098da9c56c75c157a05eaa0933ed154"}, + {file = "pydantic_core-2.18.4-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:123c3cec203e3f5ac7b000bd82235f1a3eced8665b63d18be751f115588fea30"}, + {file = "pydantic_core-2.18.4-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:dc1803ac5c32ec324c5261c7209e8f8ce88e83254c4e1aebdc8b0a39f9ddb443"}, + {file = "pydantic_core-2.18.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:53db086f9f6ab2b4061958d9c276d1dbe3690e8dd727d6abf2321d6cce37fa94"}, + {file = "pydantic_core-2.18.4-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:abc267fa9837245cc28ea6929f19fa335f3dc330a35d2e45509b6566dc18be23"}, + {file = "pydantic_core-2.18.4-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:a0d829524aaefdebccb869eed855e2d04c21d2d7479b6cada7ace5448416597b"}, + {file = "pydantic_core-2.18.4-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:509daade3b8649f80d4e5ff21aa5673e4ebe58590b25fe42fac5f0f52c6f034a"}, + {file = "pydantic_core-2.18.4-cp39-none-win32.whl", hash = "sha256:ca26a1e73c48cfc54c4a76ff78df3727b9d9f4ccc8dbee4ae3f73306a591676d"}, + {file = "pydantic_core-2.18.4-cp39-none-win_amd64.whl", hash = "sha256:c67598100338d5d985db1b3d21f3619ef392e185e71b8d52bceacc4a7771ea7e"}, + {file = "pydantic_core-2.18.4-pp310-pypy310_pp73-macosx_10_12_x86_64.whl", hash = "sha256:574d92eac874f7f4db0ca653514d823a0d22e2354359d0759e3f6a406db5d55d"}, + {file = "pydantic_core-2.18.4-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:1f4d26ceb5eb9eed4af91bebeae4b06c3fb28966ca3a8fb765208cf6b51102ab"}, + {file = "pydantic_core-2.18.4-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:77450e6d20016ec41f43ca4a6c63e9fdde03f0ae3fe90e7c27bdbeaece8b1ed4"}, + {file = "pydantic_core-2.18.4-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d323a01da91851a4f17bf592faf46149c9169d68430b3146dcba2bb5e5719abc"}, + {file = "pydantic_core-2.18.4-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:43d447dd2ae072a0065389092a231283f62d960030ecd27565672bd40746c507"}, + {file = "pydantic_core-2.18.4-pp310-pypy310_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:578e24f761f3b425834f297b9935e1ce2e30f51400964ce4801002435a1b41ef"}, + {file = "pydantic_core-2.18.4-pp310-pypy310_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:81b5efb2f126454586d0f40c4d834010979cb80785173d1586df845a632e4e6d"}, + {file = "pydantic_core-2.18.4-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:ab86ce7c8f9bea87b9d12c7f0af71102acbf5ecbc66c17796cff45dae54ef9a5"}, + {file = "pydantic_core-2.18.4-pp39-pypy39_pp73-macosx_10_12_x86_64.whl", hash = "sha256:90afc12421df2b1b4dcc975f814e21bc1754640d502a2fbcc6d41e77af5ec312"}, + {file = "pydantic_core-2.18.4-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:51991a89639a912c17bef4b45c87bd83593aee0437d8102556af4885811d59f5"}, + {file = "pydantic_core-2.18.4-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:293afe532740370aba8c060882f7d26cfd00c94cae32fd2e212a3a6e3b7bc15e"}, + {file = "pydantic_core-2.18.4-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b48ece5bde2e768197a2d0f6e925f9d7e3e826f0ad2271120f8144a9db18d5c8"}, + {file = "pydantic_core-2.18.4-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:eae237477a873ab46e8dd748e515c72c0c804fb380fbe6c85533c7de51f23a8f"}, + {file = "pydantic_core-2.18.4-pp39-pypy39_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:834b5230b5dfc0c1ec37b2fda433b271cbbc0e507560b5d1588e2cc1148cf1ce"}, + {file = "pydantic_core-2.18.4-pp39-pypy39_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:e858ac0a25074ba4bce653f9b5d0a85b7456eaddadc0ce82d3878c22489fa4ee"}, + {file = "pydantic_core-2.18.4-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:2fd41f6eff4c20778d717af1cc50eca52f5afe7805ee530a4fbd0bae284f16e9"}, + {file = "pydantic_core-2.18.4.tar.gz", hash = "sha256:ec3beeada09ff865c344ff3bc2f427f5e6c26401cc6113d77e372c3fdac73864"}, +] + +[[package]] name = "pygments" version = "2.17.2" requires_python = ">=3.7" diff --git a/pyproject.toml b/pyproject.toml index f053b75..df3b0c8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,6 +9,7 @@ description = "Core of HydroRoll SDK." authors = [{ name = "简律纯", email = "leader@hydroroll.team" }] dependencies = [ "pdfquery>=0.4.3", + "pydantic>=2.7.4", ] requires-python = ">=3.9" readme = "README.rst" diff --git a/tests/test_BaseRule.py b/tests/test_BaseRule.py index da5ac93..3d70a80 100644 --- a/tests/test_BaseRule.py +++ b/tests/test_BaseRule.py @@ -24,8 +24,6 @@ __rule_book__ = "BASIC ROLEPLAYING" # 不同的大类(举例) # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -# - # 规则包剖析 @@ -42,46 +40,11 @@ __rule_book__ = "BASIC ROLEPLAYING" # 战役 # 模组 -# 判定规则 -# - 属性|判定 规则 -# - 技能判定规则 -# - 自定义类判定规则 - -# 人物卡 -# - 属性列表* -# - 技能列表* +# 人物卡 - CharacterCard +# - 属性: 列表、判定 +# - 技能: 列表、判定 # - 人物塑造 # - 姓名、年龄、种族、阵营 - +# - 自定义判定列表 # ============================================== - -# MyRule -import hrc -from hrc.rules import BaseRule, Rules -from hrc.rules.BaseRule import CharacterCard, JudgeRule - - -class JudgeAttr(JudgeRule.Attribute): - """属性判定规则""" - - -class JudgeCustom(JudgeRule.Custom): - """自定义判定规则""" - - -class ChaAttr(CharacterCard.Attribute): - """人物卡属性列表""" - - -class ChaSkill(CharacterCard.Skill): - """人物卡技能列表""" - - -class ThePool(Rules[JudgeAttr, JudgeCustom]): - """规则包[池]""" - - __config__ = 'ThePool' - - -
\ No newline at end of file |
