diff --git a/README.md b/README.md index 28f9d36..6e8de2a 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ It was created just for fun/learning. Like part 1-3, which I never made public ; ## Dependecies - [Python](https://www.python.org/downloads/) version `>= 3.9.2` -- A terminal to run it. The default on any platform should do the trick. +- A terminal to run it. The default on any platform should do the trick - e.g. xterm, terminator, powershell, cmd, etc. **Note**: DP4 was written and tested on Python `3.9.2`. **Later Python versions could introduce breaking changes**, but usually you're good with installing the latest one. You can have multiple Python versions installed at the same time. diff --git a/game/asset/container_name.dat b/game/asset/container_name.dat index 2e94500..4b36add 100644 --- a/game/asset/container_name.dat +++ b/game/asset/container_name.dat @@ -1,5 +1,14 @@ +bag barrel +basket +bin box +cabinet +carton casket +chest coffer crate +locker +sack +trunk diff --git a/game/asset/deathcause_text.dat b/game/asset/deathcause_text.dat index 08d7331..4fde978 100644 --- a/game/asset/deathcause_text.dat +++ b/game/asset/deathcause_text.dat @@ -1,24 +1,61 @@ +a colossal sinkhole swallowed you a cosmic anomaly erased you from existence a crazy cow overrun you a deadly booby trap caught you off guard a deadly virus outbreak +a eternal time loop trapped you +a falling statue crushed you a freak accident involving a malfunctioning robot a genetically mutated creature attacked you -a inexplicable time loop trapped you +a horde of spectral beings devoured you +a malevolent shadow consumed you a malevolent spirit possessed you +a malfunctioning reality-altering device erased you from existence +a meteorite hit you +a misfired spell caused your vanishing +a mythical creature devoured you +a pack of feral creatures ambushed you a poisonous plant poisoned you +a possessed artifact claimed your life +a psychic phenomenon shattered your mind a rogue artificial intelligence targeted you +a sentient darkness consumed you a sinkhole swallowed you up +a sudden tornado swept you away +a swarm of ghostly apparitions consumed you +a swarm of malevolent spirits devoured you +a swarm of supernatural insects consumed you +a temporal distortion erased you from time +a venomous spider bite led to your demise +an alien weapon disintegrated you +an ancient deity cursed you +an eldritch spell dissolved you an encounter with a rabid animal -an meteorite collision +an interdimensional rift consumed you +an otherworldly acid dissolved you +an otherworldly maw devoured you +an otherworldly mist consumed you +an otherworldly void consumed you of a deadly earthquake some random sniper shot you you drowned in a flash flood you fell into a deep chasm -you were ambushed by a pack of feral creatures you were caught in a volcanic eruption -you were consumed by an otherworldly void -you were devoured by a mythical creature +you were dragged into an interdimensional rift +you were engulfed by a vortex of dark energy you were engulfed by a wildfire +you were ensnared by quicksand +you were ensnared by sentient vines +you were ensnared by spectral tentacles +you were ensnared in a web of maleficent magic +you were ensnared in an illusionary trap you were entangled in an impenetrable web of dark magic +you were entrapped in an unbreakable force field +you were frozen by an ancient curse +you were lost in a dimensional anomaly +you were lost in a labyrinth of cursed mirrors +you were obliterated by a psychic shockwave +you were petrified by a gaze from beyond +you were petrified by a mythical gaze you were struck by a lightning bolt +you were trapped in a cursed mirror diff --git a/game/asset/entity_suffix.dat b/game/asset/entity_suffix.dat index 5563535..f387896 100644 --- a/game/asset/entity_suffix.dat +++ b/game/asset/entity_suffix.dat @@ -10205,9 +10205,11 @@ the damned the dirtybag the doomed the emo +the enigmatic the freak the literal the lost the lucky the sad the stoned +the unknown diff --git a/game/asset/object_name.dat b/game/asset/object_name.dat index c739854..70b095d 100644 --- a/game/asset/object_name.dat +++ b/game/asset/object_name.dat @@ -1,43 +1,76 @@ +abacus +abseil +accordion +adhesive aegis air freshener +amplifier +anvil apple +apron armour arrow +ashtray audio cassette +awl axe backpack bag +balaclava balloon banana band +bandana banner +barb +bathtub +beaker bed +bell berry +bib +bicycle +binder +biscuit blade blanket block blouse +bonsai book boom box -bottle cap bottle +bottle cap +bottle opener bow bowl +bowling ball box bracelet bread brick brocolli +bubble wrap bug net +bugle bullet +bumper button +cabbage cable +cactus +calculator camera +can opener candle candy wrapper +canoe canvas +cardigan carnwennan carrot +cashew +casserole cell phone chainmail chair @@ -45,51 +78,86 @@ chalk charger checkbook cheesecake bomb +chisel chocolate +Chopping board cigarette clamp +cleaver cloak clock club coat coin +compass computer +condiment cookie jar +corset couch courtain +cradle +crayon credit card +crib crown +cufflink cup dagger danceshoe +dandelion dart +dentures deodorant desk diadem +diaper didgeridoo +diploma doll door dragon tooth +dumbbell +earmuffs +eggplant +envelope eraser -eye liner eye +eye liner face wash +faucet +feather +felt +figurine finger glove fingernail +firecracker flag flint +flip-flop floor tile flower fork +fossil fridge +frisbee +galoshes +gazelle +girdle glasses +glitter +grater +gravy boat greeting card grid paper gucci bag +gum hair brush hair tie hammer +hammock hand fan +hanger harmonica harpoon harve @@ -97,26 +165,51 @@ headband headphones headset helmet +hinge +hive hoody horn +hose +hot plate ice cube tray +ice pick +incense ingot -key chain +jigsaw +jukebox +jumprope +kettle key +key chain keyboard +kite knife lace -lamp shade +ladle lamp +lamp shade lance +lantern +lanyard +leotard +lint roller lip gloss lockbox +loofah lotion +loudspeaker +lullaby +lunchbox magnet +mallet mammoth +manhole +maraca mask medallion +megaphone microphone +microscope microwave milk mini-disc @@ -124,9 +217,9 @@ mirror monitor mouse pad mp3 player +nail nail clipper nail file -nail neclace needle nuke @@ -165,8 +258,8 @@ seat belt shampoo shield shirt -shoe lace shoe +shoe lace shovel slipper soap @@ -195,8 +288,8 @@ tissue box tomahawk tomato tome -tooth pick tooth +tooth pick toothbrush toothpaste towel diff --git a/game/asset/object_prefix.dat b/game/asset/object_prefix.dat index 3ae8f50..a0a94d5 100644 --- a/game/asset/object_prefix.dat +++ b/game/asset/object_prefix.dat @@ -1,4 +1,7 @@ +aged +alluring ancient +antique beautiful bended bitten @@ -6,46 +9,111 @@ bleeding bloodmoon bloody broken +burnished +burnt +celestial chirping cinder clay cork cracked +crystalline +dazzling dripping dusty +elaborate electric +embellished +embossed +embroidered +enameled +enchanted +enigmatic +ephemeral +etched +ethereal +exquisite fake flaming +flickering +frosted +gilded glass +gleaming +glimmering +glistening +glittering glow golden +gossamer green half +illuminated +iridescent iron jagged knocked +lacquered latex +luminous lunatic +lustrous magic +magnetic mistery model +mystical +opulent +ornamental +ornate +pearlescent +pearly pierced pitch black plastic poket +polished +polychromatic +prismatic +pristine +quicksilver +radiant +radiating rainbow +refined repaired +resplendent ripped rubber rusty sand +satin +scintillating +serene shiny +silken +silky silver singing solar +sparkling spoiled stabilized steel +stellar +tarnished +time-worn +timeless torn +tranquil +twinkling used +velvet +velvety +vibrant +vintage +vivid +whimsical +whispering white +worn diff --git a/game/asset/object_suffix.dat b/game/asset/object_suffix.dat index ddeef9a..a5f8bac 100644 --- a/game/asset/object_suffix.dat +++ b/game/asset/object_suffix.dat @@ -1,15 +1,46 @@ +from the abyss +from the beyond +from the cosmos from the depths +from the shadows +from the void of a centaur +of bliss of doom +of dreams +of echoes +of elegance +of enchantment +of essence +of eternity of glory of happiness +of harmony +of illusion of immortality +of intrigue of invisibility of justice +of legacy of love of luck +of majesty +of marvel +of melody +of mystery +of myth +of opulence of pain +of radiance +of resonance +of resplendence +of riddle of sasquatsch +of serenity +of sparkle +of splendor +of sublimity +of symphony of terror of the broken unicorn of the district @@ -18,3 +49,7 @@ of the mooncult of the south of the sun of thorns +of tranquility +of whimsy +of whispers +of wonder diff --git a/game/dp4.py b/game/dp4.py index 7f7b1df..653904a 100755 --- a/game/dp4.py +++ b/game/dp4.py @@ -10,5 +10,7 @@ if DP4.cliargs.play: DP4.play() + elif DP4.cliargs.list_saves: + DP4.list_saves() else: DP4.CLIParser.print_help() diff --git a/game/lib/conf.py b/game/lib/conf.py index f46f416..5333439 100644 --- a/game/lib/conf.py +++ b/game/lib/conf.py @@ -36,7 +36,7 @@ class DP4_Conf: # auto-save interval in seconds # the game will always try to save on exit - autosave_interval: int = 180 + autosave_interval: int = 300 # chances for event groups to be triggered (after DP4_Core.sim_walk) # order from lowest to higest chance @@ -44,9 +44,9 @@ class DP4_Conf: # see DP4_Event.new # valid range: 0.0 - 1.0 event_group_chance: dict[str, float] = { - 'death': 0.03, - 'gift': 0.04, - 'hacker': 0.05, + 'death': 0.04, + 'gift': 0.05, + 'hacker': 0.06, 'container': 0.21, 'entity': 1.0, } @@ -135,7 +135,7 @@ class DP4_Conf: sim_walk_walking_duration: tuple[float, float] = (5.0, 15.0) sim_walk_enternewregion_duration: tuple[float, float] = (10.0, 20.0) - sim_walk_startevent_chance: float = 0.2 + sim_walk_startevent_chance: float = 0.24 sim_sell_searchvendor_duration: tuple[float, float] = (7.0, 20.0) sim_sell_negvendormod_duration: tuple[float, float] = (7.0, 15.0) diff --git a/game/lib/core.py b/game/lib/core.py index 5b61af1..af48e5e 100644 --- a/game/lib/core.py +++ b/game/lib/core.py @@ -1,4 +1,5 @@ import argparse +import datetime import pathlib import random import sys @@ -27,7 +28,7 @@ def __init__(self) -> None: self.CLIParser: argparse.ArgumentParser = argparse.ArgumentParser( description=f''' An idle-game that is *played* in the terminal. No user input is necessary when it runs. Everything that happens depends on your luck. - Auto-saves every {ff(self.Conf.autosave_interval / 60, prec=1)} minutes. Press CTRL+C to save and quit. + Progress will be auto-saved from time to time or when you quit the game by pressing CTRL+C. ''', epilog='Made by arT2 (etrusci.org). Repository: https://github.com/etrusci-org/destinyspath4', ) @@ -37,6 +38,11 @@ def __init__(self) -> None: help='play the game', ) + self.CLIParser.add_argument('-s', '--list-saves', + action='store_true', + help='list save data info from the current save data directory', + ) + self.CLIParser.add_argument('-n', '--save-name', metavar='NAME', type=str, @@ -53,6 +59,14 @@ def __init__(self) -> None: help=f'path to the save data directory (default={self.Conf.save_dir})', ) + self.CLIParser.add_argument('-i', '--autosave-interval', + metavar='SECONDS', + type=int, + default=self.Conf.autosave_interval, + required=False, + help=f'time in seconds on which the progress should automatically be saved to file (default={self.Conf.autosave_interval})', + ) + # lang option disabled until there is a second translation # self.CLIParser.add_argument('-t', '--translation', # metavar='LANGCODE', @@ -74,6 +88,7 @@ def __init__(self) -> None: self.Conf.save_dir = save_dir self.Conf.save_name = self.cliargs.save_name self.Conf.save_file = self.Conf.save_dir.joinpath(f'{self.Conf.save_name}.dp4') + self.Conf.autosave_interval = self.cliargs.autosave_interval self.Save = DP4_Save(file=self.Conf.save_file) @@ -248,7 +263,7 @@ def sim_death(self) -> None: deathcause = self.String.random_name('deathcause') - self.log(self.Lang.sim_death.format(cause_of_death=deathcause), sleep=rffr(self.Conf.sim_death_dying_duration), with_spinner=True) + self.log(self.Lang.sim_death.format(cause_of_death=deathcause), sleep=rffr(self.Conf.sim_death_dying_duration), with_spinner=True, spinner_type='heartbeat') self.sim_rebirth() @@ -524,6 +539,28 @@ def item_value(self, item_name: str) -> float: # ----------------------------------------------------------------------- + def list_saves(self) -> None: + dump = list(self.Conf.save_dir.glob('*.dp4')) + + if len(dump) == 0: + print(f'No save data files found, try --play first') + return + + print(f'Listing save data files from: {self.Conf.save_dir}') + print('') + print('Resume any of these games with --save-name NAME') + print(f'e.g.: dp4.py --play --save-name {dump[0].stem}') + + for file in sorted(dump): + print('') + print(f' name: {file.stem}') + print(f' file: {file}') + print(f'modified: {datetime.datetime.fromtimestamp(file.lstat().st_mtime)}') + + + # ----------------------------------------------------------------------- + + def log(self, msg: str = '', start: str = '', end: str = '\n', sleep: float = 2.0, with_spinner=False, spinner_type: str = 'dot') -> None: orig_end = end if with_spinner: diff --git a/game/lib/spinner.py b/game/lib/spinner.py index f68e6b5..d619dcf 100644 --- a/game/lib/spinner.py +++ b/game/lib/spinner.py @@ -144,6 +144,23 @@ '+1100101', ], }, + 'heartbeat': { + 'i': 0.17, + 'f': [ + '--------', + '^~------', + '~~~-----', + '-~^~----', + '--------', + '--------', + '----~^~-', + '-----~~~', + '------~^', + '--------', + '--------', + '--------', + ], + } }