-
Notifications
You must be signed in to change notification settings - Fork 665
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Zillion: use useful item classification #4179
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,34 @@ | ||
from typing import Counter | ||
from BaseClasses import Item, ItemClassification as IC | ||
from zilliandomizer.logic_components.items import Item as ZzItem | ||
|
||
_useful_thresholds = { | ||
"Apple": 9999, | ||
"Champ": 9999, | ||
"JJ": 9999, | ||
"Win": 9999, | ||
"Empty": 0, | ||
"ID Card": 10, | ||
"Red ID Card": 2, | ||
"Floppy Disk": 7, | ||
"Bread": 0, | ||
"Opa-Opa": 20, | ||
"Zillion": 8, | ||
"Scope": 8, | ||
} | ||
""" make the item useful if the number in the item pool is below this number """ | ||
|
||
|
||
def get_classification(name: str, zz_item: ZzItem, item_counts: Counter[str]) -> IC: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I assume this not accounting for extra items such as from start_inventory, item_plando, and item_links is intended / expected? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I admit I didn't think of those when writing this. But thinking about it now, I think it's not worth the added complexity for something that won't make very much of a difference. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree that it's not worth changing, especially since this'll only ever make items Useful when they shouldn't be, and not the reverse. |
||
classification = IC.filler | ||
if zz_item.required: | ||
classification = IC.progression | ||
if not zz_item.is_progression: | ||
classification = IC.progression_skip_balancing | ||
if item_counts[name] < _useful_thresholds.get(name, 0): | ||
classification |= IC.useful | ||
return classification | ||
|
||
|
||
class ZillionItem(Item): | ||
game = "Zillion" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are Empty and Bread included if the default is already 0?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The values are here so that it's more clear when reading this code what happens with Empty and Bread.
If this
"Empty": 0,
weren't here, it would take a little more mental energy for the reader to figure out what happens with it.The default is just a safety in case something changes in the future.