Skip to content

Commit

Permalink
Add player and monster docs
Browse files Browse the repository at this point in the history
  • Loading branch information
KLPig committed Jul 12, 2024
1 parent 348fbc4 commit 5af4695
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 22 deletions.
63 changes: 63 additions & 0 deletions docs/temp/m.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<!DOCTYPE html>
<html>
<head>
<title>m</title>
<link rel="stylesheet" href="../style.css">
<link rel="stylesheet" href="style.css">
</head>
<body>
<h1>Monster</h1>
<p>Enemy character manager for combat in the game.</p>

<h2>Class: Monster</h2>
<p>The Monster class is responsible for managing the attributes and actions of enemy characters during combat scenarios.</p>

<h3>Constructor</h3>
<p>Initializes the Monster object with the specified attributes.</p>
<pre><code>Constructor(self, animation, name: str, hp: int, at: int, df: int, act_options: list[str] = [])</code></pre>
<p>Arguments</p>
<ul>
<li><strong>animation:</strong> The <a href="ani.html">animation object</a> associated with the monster.</li>
<li><strong>name:</strong> The name of the monster.</li>
<li><strong>hp:</strong> The initial health points of the monster.</li>
<li><strong>at:</strong> The attack power of the monster.</li>
<li><strong>df:</strong> The defense power of the monster.</li>
<li><strong>act_options:</strong> A list of additional actions the monster can perform.</li>
</ul>

<h3>hurt</h3>
<p>Reduces the monster's health points due to damage.</p>
<pre><code>hurt(self, damage: int)</code></pre>
<p>Arguments</p>
<ul>
<li><strong>damage:</strong> The amount of health points to reduce.</li>
</ul>

<h3>heal</h3>
<p>Restores health points to the monster.</p>
<pre><code>heal(self, num: int)</code></pre>
<p>Arguments</p>
<ul>
<li><strong>num:</strong> The amount of health points to restore.</li>
</ul>

<h2>Hooks</h2>
<h3>hook_registrations: events</h3>
<h3>Usage:</h3>
<pre><code lang="python">
@monster_object.events
def available_hook_name(arg1, arg2, ...) -> return_type:
# code here
</code></pre>
<p>Note that their should not be a 'self' argument in the hook function.</p>
<h2>Hooks List:</h2>
<h3>on_act</h3>
<p>When the player use ACT, targeted to the current monster.</p>
<pre><code>on_act(self, name: str) -> list[str] | None</code></pre>
<p>Arguments</p>
<ul>
<li><strong>name: </strong>The action name performed. (e.g. Check)</li>
</ul>

</body>
</html>
37 changes: 17 additions & 20 deletions docs/temp/p.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<title>Player Class Documentation</title>
<title>p</title>
<link rel="stylesheet" href="../style.css">
<link rel="stylesheet" href="style.css">
</head>
Expand All @@ -25,9 +25,24 @@ <h3>Constructor</h3>
<li><strong>wd_time:</strong> The time being unattackable after being attacked. (Some attack may disable it.) Default is 20.</li>
</ul>

<h3>write_data</h3>
<p>Copies attributes from another Player object. (used for overworld-connection)</p>
<pre><code>write_data(self, p)</code></pre>
<p>Arguments</p>
<ul>
<li><strong>p:</strong> The Player object from which to copy attributes.</li>
</ul>

<h2>Hooks</h2>
<h3>hook_registrations: events</h3>

<h3>Usage:</h3>
<pre><code lang="python">
@player_object.events
def available_hook_name(arg1, arg2, ...) -> return_type:
# code here
</code></pre>
<p>Note that their should not be a 'self' argument in the hook function.</p>
<h2>Hooks List:</h2>
<h3>on_attack</h3>
<p>When attack and hurt somebody.</p>
<pre><code>on_attack(self, damage: int, target: Monster) -> int | None | str</code></pre>
Expand Down Expand Up @@ -83,23 +98,5 @@ <h3>hurt</h3>
<li><strong>hp:</strong> The amount of health points to reduce.</li>
</ul>

<h3>st_wd</h3>
<p>Sets the wait time for the player.</p>
<pre><code>st_wd(self)</code></pre>

<h3>update</h3>
<p>Updates the player's state, including reducing the wait time.</p>
<pre><code>update(self)</code></pre>

<h3>write_data</h3>
<p>Copies attributes from another Player object.</p>
<pre><code>write_data(self, p)</code></pre>
<p>Arguments</p>
<ul>
<li><strong>p:</strong> The Player object from which to copy attributes.</li>
</ul>

<h2>Usage</h2>
<p>The Player class is integral to the combat system, handling all player-related actions and attributes. Ensure all necessary hooks are set up before engaging in combat.</p>
</body>
</html>
2 changes: 1 addition & 1 deletion docs/temp/up.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ <h1>UnderPython</h1>
<p style="color:red">WARNING: This doc is only for underpython alpha 1.0! Credits and others may be changed!</p>
<p style="font-size: xx-small;color:gray">This is a temporary doc, and it will be updated later.</p>
<p style="font-size: xx-small;color: gray;">But I just got an AI assistant that can help me with this doc.</p>
<p style="font-size: xx-small;color: lightgray;">Last updated: 2024-7-9</p>
<p style="font-size: xx-small;color: lightgray;">Last updated: 2024-7-12</p>
<p>UnderPython is a python module of making undertale encounters and overworld,
able to handle many conditions.</p>
<p>UnderPython is based on <a href="https://www.pygame.org">Pygame</a> and
Expand Down
15 changes: 15 additions & 0 deletions docs/temp_zhcn/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
:root
{
font-size: larger;
}
pre
{
font-size: medium;
padding: 10px;
margin: 10px;
background-color: #f2f2f2;
color:black;
border-radius: 5px;
font-family: monospace;

}
2 changes: 1 addition & 1 deletion docs/temp_zhcn/up.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ <h1>UnderPython</h1>
<p style="color:red">警告:此文档仅适用于 UnderPython alpha 1.0!版权和其他可爱内容可能会更改!</p>
<p style="font-size: xx-small;color:gray">懒得写,就只搞了个模板。</p>
<p style="font-size: xx-small;color: gray;">但是有AI哈哈哈哈</p>
<p style="font-size: xx-small;color: lightgray;">上次更新:2024-7-9</p>
<p style="font-size: xx-small;color: lightgray;">上次更新:2024-7-12</p>
<p>UnderPython 是一个用于制作 Undertale 战斗和背景移动的 Python 模块,
非常的好啊。</p>
<p>UnderPython 基于 <a href="https://www.pygame.org">Pygame</a>
Expand Down

0 comments on commit 5af4695

Please sign in to comment.