From 75c2182f3639976721e3fc3e4384e09987f99e16 Mon Sep 17 00:00:00 2001 From: Kayne Ruse Date: Fri, 4 Apr 2025 18:01:52 +1100 Subject: [PATCH] Tried to work on notes, but my brain is fried. --- README.md | 2 +- dev-notes.md | 32 +++++++++++++++++++++++++++++++- source/event_handlers.py | 1 - source/useable.py | 21 +++++++-------------- source/utils.py | 12 ++++++++++++ 5 files changed, 51 insertions(+), 17 deletions(-) create mode 100644 source/utils.py diff --git a/README.md b/README.md index 1652fcd..5b74a8c 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ Here's a few potential options, which absolutely will change over time: * Mythic Odyssey * Dreamlands/Cthulhu Horror/Gothic Horror (accessible only during the full/new moon) * Stargates/Sliders -* Isekai Protag Syndrome +* Isekai Protag Syndrome (mana-morph?) * Gunslingers (Wild West) ## Links And Resources diff --git a/dev-notes.md b/dev-notes.md index 1dfd166..02c250d 100644 --- a/dev-notes.md +++ b/dev-notes.md @@ -2,7 +2,37 @@ This file is a kind of scratch-pad for a multitude of ideas, that I can't implement yet. They'll be added to, refined or removed over time, so don't get too attached. -TODO: Plan out each confirmed dimension. +## Entity Statistics + +#TODO: brain no work, calc these later + +Level = exp??? + +Base Stats, from 3 to 18: #TODO: are these needed? + STR, Strength + DEX, Dexterity + CON, Constitution + INT, Intelligence + WIS, Wisdom + CHA, Charisma + +Derived Stats, will always change based on the base stats: + MaxHP: + CurHP: + Accuracy: + Evasion: + Damage: + Absorb: + +To-hit, d20: + 11 + weapon_accuracy - target_evasion + +damage-dealt: + roll(weapon_damage) - target_absorb + +## Dimension List + +#TODO: Plan out each confirmed dimension. ## Concepts and Ideas diff --git a/source/event_handlers.py b/source/event_handlers.py index 13b4b1a..081e2a3 100644 --- a/source/event_handlers.py +++ b/source/event_handlers.py @@ -302,7 +302,6 @@ class InventoryViewer(EventHandler): options = ["Use", "Drop 1", "Drop All", "Back"] callback = lambda x: self.stack_selector_callback(x) - #TODO: drop 1, drop all for stacks self.engine.event_handler = OptionSelector( self.engine, self, diff --git a/source/useable.py b/source/useable.py index da12caa..7c7e66f 100644 --- a/source/useable.py +++ b/source/useable.py @@ -1,6 +1,8 @@ from __future__ import annotations from typing import Optional, TYPE_CHECKING +from utils import roll_dice + if TYPE_CHECKING: from stats import Stats @@ -71,6 +73,11 @@ class Unuseable(BaseUseable): class PotionOfHealing(BaseUseable): + #NetHack's healing potions, (B | U | C): + #Healing: 8d4 | 6d4 | 4d4. If the result is above MaxHP, MaxHP is incrased by 1 | 1 | 0. + #Extra Healing: 8d8 | 6d8 | 4d8. If the result is above MaxHP, MaxHP is incrased by 5 | 2 | 0. + #Full Healing: 400 | 400 | 400. If the result is above MaxHP, MaxHP is incrased by 8 | 4 | 0. + """Restores 4d4 health when applied.""" __last_roll: int = -1 @@ -81,17 +88,3 @@ class PotionOfHealing(BaseUseable): def get_used_msg(self, appearance: str) -> Optional[str]: return f"You restored {self.__last_roll} health." - - -# NOTE: NetHack's version -# Healing: 8d4 | 6d4 | 4d4. If the result is above MaxHP, MaxHP is incrased by 1 | 1 | 0. -# Extra Healing: 8d8 | 6d8 | 4d8. If the result is above MaxHP, MaxHP is incrased by 5 | 2 | 0. -# Full Healing: 400 | 400 | 400. If the result is above MaxHP, MaxHP is incrased by 8 | 4 | 0. - -#TODO: move this into a different file, 'utils.py' -import random -def roll_dice(number: int, sides: int) -> int: - total: int = 0 - for i in range(number): - total += random.randint(1, sides) - return total diff --git a/source/utils.py b/source/utils.py new file mode 100644 index 0000000..aba7574 --- /dev/null +++ b/source/utils.py @@ -0,0 +1,12 @@ +import random + +def roll_dice(number: int, sides: int) -> int: + """ + Rolls XdY, where X is `number` and Y is `sides`. + + Returns the total value. + """ + total: int = 0 + for i in range(number): + total += random.randint(1, sides) + return total