Core: move multiple Item properties into a single Flag (#638)

This commit is contained in:
Fabian Dill
2022-06-17 03:23:27 +02:00
committed by GitHub
parent 5be00e28dd
commit 6c525e1fe6
45 changed files with 559 additions and 493 deletions

View File

@@ -14,9 +14,6 @@ class ItemData(typing.NamedTuple):
class LegacyItem(Item):
game: str = "Rogue Legacy"
def __init__(self, name, advancement: bool = False, code: int = None, player: int = None):
super(LegacyItem, self).__init__(name, advancement, code, player)
# Separate tables for each type of item.
vendors_table = {

View File

@@ -1,10 +1,12 @@
import typing
from BaseClasses import MultiWorld, Region, Entrance
from BaseClasses import MultiWorld, Region, RegionType, Entrance, ItemClassification
from .Items import LegacyItem
from .Locations import LegacyLocation, diary_location_table, location_table, base_location_table
from .Names import LocationName, ItemName
prog = ItemClassification.progression
def create_regions(world, player: int):
@@ -47,16 +49,16 @@ def create_regions(world, player: int):
# Connect entrances and set up events.
world.get_entrance(LocationName.outside, player).connect(world.get_region(LocationName.castle, player))
world.get_location(LocationName.castle, player).place_locked_item(LegacyItem(ItemName.boss_castle, True, None, player))
world.get_location(LocationName.garden, player).place_locked_item(LegacyItem(ItemName.boss_forest, True, None, player))
world.get_location(LocationName.tower, player).place_locked_item(LegacyItem(ItemName.boss_tower, True, None, player))
world.get_location(LocationName.dungeon, player).place_locked_item(LegacyItem(ItemName.boss_dungeon, True, None, player))
world.get_location(LocationName.fountain, player).place_locked_item(LegacyItem(ItemName.boss_fountain, True, None, player))
world.get_location(LocationName.castle, player).place_locked_item(LegacyItem(ItemName.boss_castle, prog, None, player))
world.get_location(LocationName.garden, player).place_locked_item(LegacyItem(ItemName.boss_forest, prog, None, player))
world.get_location(LocationName.tower, player).place_locked_item(LegacyItem(ItemName.boss_tower, prog, None, player))
world.get_location(LocationName.dungeon, player).place_locked_item(LegacyItem(ItemName.boss_dungeon, prog, None, player))
world.get_location(LocationName.fountain, player).place_locked_item(LegacyItem(ItemName.boss_fountain, prog, None, player))
def create_region(world: MultiWorld, player: int, name: str, locations=None, exits=None):
# Shamelessly stolen from the ROR2 definition, lol
ret = Region(name, None, name, player)
ret = Region(name, RegionType.Generic, name, player)
ret.world = world
if locations:
for location in locations:

View File

@@ -1,6 +1,6 @@
import typing
from BaseClasses import Item, MultiWorld, Tutorial
from BaseClasses import Item, ItemClassification, Tutorial
from .Items import LegacyItem, ItemData, item_table, vendors_table, static_classes_table, progressive_classes_table, \
skill_unlocks_table, blueprints_table, runes_table, misc_items_table
from .Locations import LegacyLocation, location_table, base_location_table
@@ -169,7 +169,7 @@ class LegacyWorld(World):
def create_item(self, name: str) -> Item:
data = item_table[name]
return LegacyItem(name, data.progression, data.code, self.player)
return LegacyItem(name, ItemClassification.progression if data.progression else ItemClassification.filler, data.code, self.player)
def set_rules(self):
set_rules(self.world, self.player)