fix: undo unwanted autofromat

This commit is contained in:
Blade Boles 2023-07-05 20:55:25 -06:00
parent 15b1a287d4
commit bae4ce3355

View file

@ -39,6 +39,7 @@ Knave, being inspired by early Dungeons & Dragons, is very simple.
- _Knave_ also have random tables, such as for starting equipment and to see if dying when
hitting 0. Death, if it happens, is permanent.
## Making a rule module
> Create a new module mygame/evadventure/rules.py
@ -47,7 +48,6 @@ Knave, being inspired by early Dungeons & Dragons, is very simple.
A complete version of the rule module is found in
[evennia/contrib/tutorials/evadventure/rules.py](../../../api/evennia.contrib.tutorials.evadventure.rules.md).
```
There are three broad sets of rules for most RPGS:
- Character generation rules, often only used during character creation
@ -57,6 +57,7 @@ There are three broad sets of rules for most RPGS:
We want our `rules` module to cover as many aspeects of what we'd otherwise would have to look up
in a rulebook.
## Rolling dice
We will start by making a dice roller. Let's group all of our dice rolling into a structure like this
@ -93,7 +94,6 @@ class EvAdventureRollEngine:
dice = EvAdventureRollEngine()
```
```{sidebar}
This groups all dice-related code into one 'container' that is easy to import. But it's mostly a matter
of taste. You _could_ also break up the class' methods into normal functions at the top-level of the
@ -156,7 +156,6 @@ in a specific range. The line
```python
sum(randint(1, diesize) for _ in range(number))
```
works like this:
- For a certain `number` of times ...
@ -224,7 +223,6 @@ have it figure things out:
```python
result, quality = dice.saving_throw(character, Ability.STR)
```
The return will be a boolean `True/False` if they pass, as well as a `quality` that tells us if
a perfect fail/success was rolled or not.
@ -381,6 +379,7 @@ number of HPs
> Knowing what is available on the character and what rule rolls we need is a bit of a chicken-and-egg
> problem. We will make sure to implement the matching _Character_ class next lesson.
### Rolling on a table
We occasionally need to roll on a 'table' - a selection of choices. There are two main table-types
@ -389,7 +388,7 @@ we need to support:
Simply one element per row of the table (same odds to get each result).
| Result |
| :----: |
|:------:|
| item1 |
| item2 |
| item3 |
@ -404,7 +403,7 @@ This we will simply represent as a plain list
Ranges per item (varying odds per result):
| Range | Result |
| :---: | :----: |
|:-----:|:------:|
| 1-5 | item1 |
| 6-15 | item2 |
| 16-19 | item3 |
@ -462,11 +461,9 @@ class EvAdventureRollEngine:
roll_result = max(1, min(len(table_choices), roll_result))
return table_choices[roll_result - 1]
```
Check that you understand what this does.
This may be confusing:
```python
minval, *maxval = valrange.split("-", 1)
minval = abs(int(minval))
@ -487,6 +484,7 @@ maxval = abs(int(maxval[0]) if maxval else minval)
we check if `maxval` actually has a value `("5",)` or if its empty `()`. The result is either
`"5"` or the value of `minval`.
### Roll for death
While original Knave suggests hitting 0 HP means insta-death, we will grab the optional "death table"
@ -494,8 +492,8 @@ from the "prettified" Knave's optional rules to make it a little less punishing.
result of `2` to 'dead' since we don't simulate 'dismemberment' in this tutorial:
| Roll | Result | -1d4 Loss of Ability |
| :--: | :--------: | :------------------: |
| 1-2 | dead | - |
|:---: |:--------:|:--------------------:|
| 1-2 | dead | -
| 3 | weakened | STR |
|4 | unsteady | DEX |
| 5 | sickly | CON |
@ -602,7 +600,6 @@ As before, run the specific test with
In [evennia/contrib/tutorials/evadventure/tests/test_rules.py](../../../api/evennia.contrib.tutorials.evadventure.tests.test_rules.md)
has a complete example of rule testing.
```
The `setUp` method is a special method of the testing class. It will be run before every
test method. We use `super().setUp()` to make sure the parent class' version of this method
always fire. Then we create a fresh `EvAdventureRollEngine` we can test with.
@ -629,3 +626,8 @@ them for further help.
This concludes all the core rule mechanics of _Knave_ - the rules used during play. We noticed here
that we are going to soon need to establish how our _Character_ actually stores data. So we will
address that next.