Zillion: Use Useful Item Classification (#4179)
This commit is contained in:
parent
9443861849
commit
563794ab83
|
@ -9,8 +9,7 @@ import logging
|
|||
|
||||
from typing_extensions import override
|
||||
|
||||
from BaseClasses import ItemClassification, LocationProgressType, \
|
||||
MultiWorld, Item, CollectionState, Entrance, Tutorial
|
||||
from BaseClasses import LocationProgressType, MultiWorld, Item, CollectionState, Entrance, Tutorial
|
||||
|
||||
from .gen_data import GenData
|
||||
from .logic import ZillionLogicCache
|
||||
|
@ -19,7 +18,7 @@ from .options import ZillionOptions, validate, z_option_groups
|
|||
from .id_maps import ZillionSlotInfo, get_slot_info, item_name_to_id as _item_name_to_id, \
|
||||
loc_name_to_id as _loc_name_to_id, make_id_to_others, \
|
||||
zz_reg_name_to_reg_name, base_id
|
||||
from .item import ZillionItem
|
||||
from .item import ZillionItem, get_classification
|
||||
from .patch import ZillionPatch
|
||||
|
||||
from zilliandomizer.system import System
|
||||
|
@ -422,12 +421,8 @@ class ZillionWorld(World):
|
|||
self.logger.warning("warning: called `create_item` without calling `generate_early` first")
|
||||
assert self.id_to_zz_item, "failed to get item maps"
|
||||
|
||||
classification = ItemClassification.filler
|
||||
zz_item = self.id_to_zz_item[item_id]
|
||||
if zz_item.required:
|
||||
classification = ItemClassification.progression
|
||||
if not zz_item.is_progression:
|
||||
classification = ItemClassification.progression_skip_balancing
|
||||
classification = get_classification(name, zz_item, self._item_counts)
|
||||
|
||||
z_item = ZillionItem(name, classification, item_id, self.player, zz_item)
|
||||
return z_item
|
||||
|
|
|
@ -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:
|
||||
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"
|
||||
|
|
Loading…
Reference in New Issue