* Verify the default values of `Option`s.
Since `Option.verify()` can handle normalization of option names, this allows options to define defaults which rely on that normalization. For example, it allows a world to exclude certain locations by default.
This also makes it easier to catch errors if a world author accidentally sets an invalid default.
* Update Generate.py
Co-authored-by: Doug Hoskisson <beauxq@users.noreply.github.com>
---------
Co-authored-by: Doug Hoskisson <beauxq@users.noreply.github.com>
Co-authored-by: NewSoupVi <57900059+NewSoupVi@users.noreply.github.com>
* Options: Add an OptionError to specify bad options caused the failure
* inherit from ValueError instead of RuntimeError since this error should be thrown via bad input
---------
Co-authored-by: NewSoupVi <57900059+NewSoupVi@users.noreply.github.com>
* Replace all usages of player settings
* Fixed line break error
* Attempt to fix line break again
* Finally figure out what Pycharm did to this file
* Pycharm search failed me
* Remove duplicate s
* Update ArchipIdle
* Revert random newline changes from Pycharm
* Remove player settings from fstrings and rename --samesettings to --sameoptions
* Finally get PyCharm to not auto-format my commits, randomly inserting the newlines
* Removing player-settings
* Missed one
* Remove final line break error
Co-authored-by: Exempt-Medic <60412657+exempt-medic@users.noreply.github.com>
---------
Co-authored-by: Exempt-Medic <60412657+Exempt-Medic@users.noreply.github.com>
Co-authored-by: Exempt-Medic <ExemptMedic@Gmail.com>
* proof of concept
* add dict support, block top/game level merge
* prevent key error when option being merged is new
* update triggers guide
* Add documentation about add/remove/replace
* move to trailing name instead of proper tag
* update docs
* confirm types
* Update Utils.py
* Update Generate.py
* pep8
* move to + syntax
* forgot to support sets
* specify received type of type error
* Update Generate.py
Co-authored-by: Fabian Dill <Berserker66@users.noreply.github.com>
* Apply suggestion from review
* add test for update weights
* move test to new test case
* Apply suggestions from code review
Co-authored-by: black-sliver <59490463+black-sliver@users.noreply.github.com>
---------
Co-authored-by: Fabian Dill <Berserker66@users.noreply.github.com>
Co-authored-by: black-sliver <59490463+black-sliver@users.noreply.github.com>
## What is this fixing or adding?
Adds Bombless Start option, along with proper bomb logic. This involves updating `can_kill_most_things` to include checking how many bombs can be held. Many places where the ability to kill enemies was assumed, now have logic. This fixes some possible existing logic issues, for example: Mini Moldorm cave checks currently are always in logic despite the fact that on expert enemy health it would require 12 bombs to kill each mini moldorm.
Overhauls options, pulling them out of core and in particular making large changes to how the shop options work.
Co-authored-by: espeon65536 <81029175+espeon65536@users.noreply.github.com>
Co-authored-by: black-sliver <59490463+black-sliver@users.noreply.github.com>
Co-authored-by: Bondo <38083232+BadmoonzZ@users.noreply.github.com>
Co-authored-by: espeon65536 <espeon65536@gmail.com>
Co-authored-by: Fabian Dill <Berserker66@users.noreply.github.com>
* WebHost: unify references to options
* it was just an extra s the whole time...
* grammar
* redirect from old pages
* redirect stuff correctly
* use url_for
* use " for modified strings
* remove redirect cache
* player_settings
* update site map
🤞
* map option objects to a `World.options` dict
* convert RoR2 to options dict system for testing
* add temp behavior for lttp with notes
* copy/paste bad
* convert `set_default_common_options` to a namespace property
* reorganize test call order
* have fill_restrictive use the new options system
* update world api
* update soe tests
* fix world api
* core: auto initialize a dataclass on the World class with the option results
* core: auto initialize a dataclass on the World class with the option results: small tying improvement
* add `as_dict` method to the options dataclass
* fix namespace issues with tests
* have current option updates use `.value` instead of changing the option
* update ror2 to use the new options system again
* revert the junk pool dict since it's cased differently
* fix begin_with_loop typo
* write new and old options to spoiler
* change factorio option behavior back
* fix comparisons
* move common and per_game_common options to new system
* core: automatically create missing options_dataclass from legacy option_definitions
* remove spoiler special casing and add back the Factorio option changing but in new system
* give ArchipIDLE the default options_dataclass so its options get generated and spoilered properly
* reimplement `inspect.get_annotations`
* move option info generation for webhost to new system
* need to include Common and PerGame common since __annotations__ doesn't include super
* use get_type_hints for the options dictionary
* typing.get_type_hints returns the bases too.
* forgot to sweep through generate
* sweep through all the tests
* swap to a metaclass property
* move remaining usages from get_type_hints to metaclass property
* move remaining usages from __annotations__ to metaclass property
* move remaining usages from legacy dictionaries to metaclass property
* remove legacy dictionaries
* cache the metaclass property
* clarify inheritance in world api
* move the messenger to new options system
* add an assert for my dumb
* update the doc
* rename o to options
* missed a spot
* update new messenger options
* comment spacing
Co-authored-by: Doug Hoskisson <beauxq@users.noreply.github.com>
* fix tests
* fix missing import
* make the documentation definition more accurate
* use options system for loc creation
* type cast MessengerWorld
* fix typo and use quotes for cast
* LTTP: set random seed in tests
* ArchipIdle: remove change here as it's default on AutoWorld
* Stardew: Need to set state because `set_default_common_options` used to
* The Messenger: update shop rando and helpers to new system; optimize imports
* Add a kwarg to `as_dict` to do the casing for you
* RoR2: use new kwarg for less code
* RoR2: revert some accidental reverts
* The Messenger: remove an unnecessary variable
* remove TypeVar that isn't used
* CommonOptions not abstract
* Docs: fix mistake in options api.md
Co-authored-by: Doug Hoskisson <beauxq@users.noreply.github.com>
* create options for item link worlds
* revert accidental doc removals
* Item Links: set default options on group
* change Zillion to new options dataclass
* remove unused parameter to function
* use TypeGuard for Literal narrowing
* move dlc quest to new api
* move overcooked 2 to new api
* fixed some missed code in oc2
* - Tried to be compliant with 993 (WIP?)
* - I think it all works now
* - Removed last trace of me touching core
* typo
* It now passes all tests!
* Improve options, fix all issues I hope
* - Fixed init options
* dlcquest: fix bad imports
* missed a file
* - Reduce code duplication
* add as_dict documentation
* - Use .items(), get option name more directly, fix slot data content
* - Remove generic options from the slot data
* improve slot data documentation
* remove `CommonOptions.get_value` (#21)
* better slot data description
Co-authored-by: black-sliver <59490463+black-sliver@users.noreply.github.com>
---------
Co-authored-by: el-u <109771707+el-u@users.noreply.github.com>
Co-authored-by: Doug Hoskisson <beauxq@users.noreply.github.com>
Co-authored-by: Doug Hoskisson <beauxq@yahoo.com>
Co-authored-by: black-sliver <59490463+black-sliver@users.noreply.github.com>
Co-authored-by: Alex Gilbert <alexgilbert@yahoo.com>
* Add settings API ("auto settings") for host.yaml
* settings: no BOM when saving
* settings: fix saving / groups resetting themselves
* settings: fix AutoWorldRegister import
Co-authored-by: el-u <109771707+el-u@users.noreply.github.com>
* Lufia2: settings: clean up imports
* settings: more consistent class naming
* Docs: update world api for settings api refactor
* settings: fix access from World instance
* settings: update migration timeline
* Docs: Apply suggestions from code review
Co-authored-by: Zach Parks <zach@alliware.com>
* Settings: correctly resolve .exe in UserPath and LocalPath
---------
Co-authored-by: el-u <109771707+el-u@users.noreply.github.com>
Co-authored-by: Zach Parks <zach@alliware.com>
* core: fix bug that caused world option overrides to fail
* copy paste sliver's better code that works as intended
* Fix whitespace
Co-authored-by: black-sliver <59490463+black-sliver@users.noreply.github.com>
* core: fix options with "random" as default value not generating
when option is missing from the player yaml,
Using this in #893 and tested there.
* remove if
* OptionSets default to frozenset so handle that
* range had some specific instances of assuming default as a valid value so change this here to call the from_any
* isinstance instead of type
Co-authored-by: black-sliver <59490463+black-sliver@users.noreply.github.com>
Co-authored-by: black-sliver <59490463+black-sliver@users.noreply.github.com>
* add freetext and freetextchoice options
* fix textchoice. create plando_bosses bool so worlds can check if boss plando is enabled
* remove strange unneccessary \ escapes
* lttp: rip boss plando out of core
* fix broken text methods so they read the data correctly
* revert `None` key in boss_shuffle_options. fix failing tests
* lttp: rewrite boss plando
* lttp: rewrite boss shuffle
* add generic verification step and allow options to set a plando module
* add default typing to plando_options set
* use PlandoSettings intflag for lttp boss plando
* fix plandosettings boss flag check
* minor lttp init cleanup
* make suggested changes. account for "random" existing within plando boss options
* override eq operator
* Please document me!
* Forgot to mention it supports plando
* remove auto_display_name
* Throw warning alerting user to which shuffle is being used if plando is off. Set the remaining boss shuffle in init and boss placement cleanup
* move the convoluted string matching to `from_text`
* remove unneccessary text lowering and actually turn off plando option when it's disabled
* typing
* strong typing for verify method and reorder
* typing is your friend
* log warning correctly
* 3.8 support :(
* also list apparently
* rip out old boss shuffle spoiler code
* verification step for plando bosses and locations
* update plando guide to reference new supported behavior
* empty string is not `None`. remove unneccessary error throw
* Fix bad ordering
* validate boss_shuffle only contains a normal boss option at the end
* get random choice from a list dummy
* >:(
Co-authored-by: black-sliver <59490463+black-sliver@users.noreply.github.com>
* minor textchoice cleanup
Co-authored-by: black-sliver <59490463+black-sliver@users.noreply.github.com>
* have generation print plando settings as string instead of numbers
* Change to __str__
* Make to_string not a class method
* Suggested fix
Co-authored-by: black-sliver <59490463+black-sliver@users.noreply.github.com>
* Fix the fix
* Better quotes
Co-authored-by: black-sliver <59490463+black-sliver@users.noreply.github.com>