mirror of
https://github.com/Steffo99/lihzahrd.git
synced 2024-11-21 15:44:24 +00:00
Group saved ore tiers
This commit is contained in:
parent
fefbeb1447
commit
34a3e3ff56
5 changed files with 68 additions and 87 deletions
|
@ -1,4 +1,3 @@
|
|||
from .altarssmashed import AltarsSmashed
|
||||
from .anglerquest import AnglerQuest
|
||||
from .anglerquestfish import AnglerQuestFish
|
||||
from .backgrounds import Backgrounds
|
||||
|
@ -8,7 +7,6 @@ from .difficulty import Difficulty
|
|||
from .events import Events
|
||||
from .fourpartsplit import FourPartSplit
|
||||
from .generatorinfo import GeneratorInfo
|
||||
from .hardmodeore import HardmodeTier1Ore, HardmodeTier2Ore, HardmodeTier3Ore
|
||||
from .invasion import Invasion
|
||||
from .invasiontype import InvasionType
|
||||
from .lanternevent import LanternEvent
|
||||
|
@ -31,7 +29,6 @@ from .version import Version
|
|||
from .worldeviltype import WorldEvilType
|
||||
|
||||
__all__ = [
|
||||
"AltarsSmashed",
|
||||
"AnglerQuest",
|
||||
"AnglerQuestFish",
|
||||
"Backgrounds",
|
||||
|
@ -41,9 +38,6 @@ __all__ = [
|
|||
"Events",
|
||||
"FourPartSplit",
|
||||
"GeneratorInfo",
|
||||
"HardmodeTier1Ore",
|
||||
"HardmodeTier2Ore",
|
||||
"HardmodeTier3Ore",
|
||||
"Invasion",
|
||||
"InvasionType",
|
||||
"LanternEvent",
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
from .hardmodeore import HardmodeTier1Ore, HardmodeTier2Ore, HardmodeTier3Ore
|
||||
|
||||
|
||||
class AltarsSmashed:
|
||||
"""Information related to the first three hardmode ores."""
|
||||
def __init__(self,
|
||||
count: int,
|
||||
ore_tier1: HardmodeTier1Ore,
|
||||
ore_tier2: HardmodeTier2Ore,
|
||||
ore_tier3: HardmodeTier3Ore):
|
||||
self.count: int = count
|
||||
"""The number of altars smashed."""
|
||||
|
||||
self.ore_tier1: HardmodeTier1Ore = ore_tier1
|
||||
self.ore_tier2: HardmodeTier2Ore = ore_tier2
|
||||
self.ore_tier3: HardmodeTier3Ore = ore_tier3
|
||||
|
||||
def __repr__(self):
|
||||
return f"WorldAltars(count={self.count}, ore_tier1={self.ore_tier1}, ore_tier2={self.ore_tier2}," \
|
||||
f" ore_tier3={self.ore_tier3})"
|
|
@ -1,28 +0,0 @@
|
|||
import enum
|
||||
|
||||
|
||||
class HardmodeTier1Ore(enum.IntEnum):
|
||||
NOT_DETERMINED = -1
|
||||
COBALT = 107
|
||||
PALLADIUM = 221
|
||||
|
||||
def __repr__(self):
|
||||
return f"{self.__class__.__name__}.{self.name}"
|
||||
|
||||
|
||||
class HardmodeTier2Ore(enum.IntEnum):
|
||||
NOT_DETERMINED = -1
|
||||
MYTHRIL = 108
|
||||
ORICHALCUM = 222
|
||||
|
||||
def __repr__(self):
|
||||
return f"{self.__class__.__name__}.{self.name}"
|
||||
|
||||
|
||||
class HardmodeTier3Ore(enum.IntEnum):
|
||||
NOT_DETERMINED = -1
|
||||
ADAMANTITE = 111
|
||||
TITANIUM = 223
|
||||
|
||||
def __repr__(self):
|
||||
return f"{self.__class__.__name__}.{self.name}"
|
|
@ -1,17 +1,52 @@
|
|||
import typing
|
||||
from typing import *
|
||||
from ..tiles import BlockType
|
||||
|
||||
|
||||
class SavedOreTiers:
|
||||
"""Information about the treetop variants in the worls"""
|
||||
"""The types of ores that generated in the world."""
|
||||
|
||||
def __init__(self,
|
||||
saved_ore_tier_copper: int,
|
||||
saved_ore_tier_iron: int,
|
||||
saved_ore_tier_silver: int,
|
||||
saved_ore_tier_gold: int,
|
||||
):
|
||||
self.copper: int = saved_ore_tier_copper
|
||||
self.iron: int = saved_ore_tier_iron
|
||||
self.silver: int = saved_ore_tier_silver
|
||||
self.gold: int = saved_ore_tier_gold
|
||||
tier_1: BlockType,
|
||||
tier_2: BlockType,
|
||||
tier_3: BlockType,
|
||||
tier_4: BlockType,
|
||||
hardmode_tier_1: Optional[BlockType],
|
||||
hardmode_tier_2: Optional[BlockType],
|
||||
hardmode_tier_3: Optional[BlockType]):
|
||||
|
||||
self.tier_1: BlockType = tier_1
|
||||
"""Copper or Tin?"""
|
||||
assert self.tier_1 == BlockType.COPPER or self.tier_1 == BlockType.TIN
|
||||
|
||||
self.tier_2: BlockType = tier_2
|
||||
"""Iron or Lead?"""
|
||||
assert self.tier_2 == BlockType.IRON or self.tier_2 == BlockType.LEAD
|
||||
|
||||
self.tier_3: BlockType = tier_3
|
||||
"""Silver or Tungsten?"""
|
||||
assert self.tier_3 == BlockType.SILVER or self.tier_3 == BlockType.TUNGSTEN
|
||||
|
||||
self.tier_4: BlockType = tier_4
|
||||
"""Gold or Platinum?"""
|
||||
assert self.tier_4 == BlockType.GOLD or self.tier_4 == BlockType.PLATINUM
|
||||
|
||||
self.hardmode_tier_1: Optional[BlockType] = hardmode_tier_1
|
||||
"""Cobalt or Palladium? None if it hasn't been determined yet."""
|
||||
assert self.hardmode_tier_1 is None \
|
||||
or self.hardmode_tier_1 == BlockType.COBALT \
|
||||
or self.hardmode_tier_1 == BlockType.PALLADIUM
|
||||
|
||||
self.hardmode_tier_2: Optional[BlockType] = hardmode_tier_2
|
||||
"""Mythril or Orichalcum? None if it hasn't been determined yet."""
|
||||
assert self.hardmode_tier_2 is None \
|
||||
or self.hardmode_tier_2 == BlockType.MYTHRIL \
|
||||
or self.hardmode_tier_2 == BlockType.ORICHALCUM
|
||||
|
||||
self.hardmode_tier_3: Optional[BlockType] = hardmode_tier_3
|
||||
"""Adamantite or Titanium? None if it hasn't been determined yet."""
|
||||
assert self.hardmode_tier_3 is None \
|
||||
or self.hardmode_tier_3 == BlockType.ADAMANTITE \
|
||||
or self.hardmode_tier_3 == BlockType.TITANIUM
|
||||
|
||||
def __repr__(self):
|
||||
return f"WorldSavedOreTier(copper={self.copper}, iron={self.iron}, silver={self.silver}, gold={self.gold})"
|
||||
return f"<SavedOreTiers>"
|
||||
|
|
|
@ -44,7 +44,7 @@ class World:
|
|||
dungeon_point: Coordinates,
|
||||
world_evil: WorldEvilType,
|
||||
saved_npcs: SavedNPCs,
|
||||
altars_smashed: AltarsSmashed,
|
||||
altars_smashed: int,
|
||||
is_hardmode: bool,
|
||||
shadow_orbs: ShadowOrbs,
|
||||
bosses_defeated: BossesDefeated,
|
||||
|
@ -152,8 +152,8 @@ class World:
|
|||
self.saved_npcs: SavedNPCs = saved_npcs
|
||||
"""The NPCs that were rescued by the player."""
|
||||
|
||||
self.altars_smashed: AltarsSmashed = altars_smashed
|
||||
"""Information related to the destruction of Demon Altars with a Pwnhammer."""
|
||||
self.altars_smashed: int = altars_smashed
|
||||
"""The number of Demon Altars smashed with a Pwnhammer (or better)."""
|
||||
|
||||
self.is_hardmode: bool = is_hardmode
|
||||
"""Whether or not the world is in hardmode."""
|
||||
|
@ -180,7 +180,7 @@ class World:
|
|||
"""A list of all the NPCs currently living in the world, including the Old Man."""
|
||||
|
||||
self.mobs: List[Mob] = mobs
|
||||
"""A list of mobs in the world...?"""
|
||||
"""(Unknown, possibly a list of mobs in the world?)"""
|
||||
|
||||
self.tile_entities: List[TileEntity] = tile_entities
|
||||
"""A list of tile entities in the world, such as Training Dummies, Item Frames and Logic Sensors."""
|
||||
|
@ -192,16 +192,18 @@ class World:
|
|||
"""Which pets have bene purchased."""
|
||||
|
||||
self.halloween_today: bool = halloween_today
|
||||
"""Is today an halloween reward day?"""
|
||||
"""Is today an Halloween reward day?
|
||||
Triggered by reaching Wave 15 of the Pumpkin Moon."""
|
||||
|
||||
self.xmas_today: bool = xmas_today
|
||||
"""Is today an xmas reward day?"""
|
||||
"""Is today a Xmas reward day?
|
||||
Triggered by reaching Wave 20 of the Frost Moon."""
|
||||
|
||||
self.treetop_variants: TreetopVariants = treetop_variants
|
||||
"""Treetops variants that can exist in the world."""
|
||||
|
||||
self.saved_ore_tiers: SavedOreTiers = saved_ore_tiers
|
||||
"""Probably related to drunk wordgen having both types of ores."""
|
||||
"""The metals that generated in the world."""
|
||||
|
||||
self.rooms: List[Room] = rooms
|
||||
self.clouds: Clouds = clouds
|
||||
|
@ -455,7 +457,7 @@ class World:
|
|||
spawn_meteorite=f.bool(),
|
||||
evil_boss_counter=f.int4())
|
||||
|
||||
smashed_altars_count = f.int4()
|
||||
altars_smashed = f.int4()
|
||||
|
||||
is_hardmode = f.bool()
|
||||
|
||||
|
@ -471,21 +473,17 @@ class World:
|
|||
rain = Rain(is_active=f.bool(), time_left=f.int4(), max_rain=f.single())
|
||||
|
||||
try:
|
||||
hardmode_ore_1 = HardmodeTier1Ore(f.int4())
|
||||
hardmode_ore_1 = BlockType(f.int4())
|
||||
except ValueError:
|
||||
hardmode_ore_1 = HardmodeTier1Ore.NOT_DETERMINED
|
||||
hardmode_ore_1 = None
|
||||
try:
|
||||
hardmode_ore_2 = HardmodeTier2Ore(f.int4())
|
||||
hardmode_ore_2 = BlockType(f.int4())
|
||||
except ValueError:
|
||||
hardmode_ore_2 = HardmodeTier2Ore.NOT_DETERMINED
|
||||
hardmode_ore_2 = None
|
||||
try:
|
||||
hardmode_ore_3 = HardmodeTier3Ore(f.int4())
|
||||
hardmode_ore_3 = BlockType(f.int4())
|
||||
except ValueError:
|
||||
hardmode_ore_3 = HardmodeTier3Ore.NOT_DETERMINED
|
||||
altars_smashed = AltarsSmashed(count=smashed_altars_count,
|
||||
ore_tier1=hardmode_ore_1,
|
||||
ore_tier2=hardmode_ore_2,
|
||||
ore_tier3=hardmode_ore_3)
|
||||
hardmode_ore_3 = None
|
||||
|
||||
bg_forest = f.int1()
|
||||
bg_corruption = f.int1()
|
||||
|
@ -630,7 +628,11 @@ class World:
|
|||
halloween_today = f.bool()
|
||||
xmas_today = f.bool()
|
||||
|
||||
saved_ore_tiers = SavedOreTiers(f.int4(), f.int4(), f.int4(), f.int4())
|
||||
ore_1 = BlockType(f.int4())
|
||||
ore_2 = BlockType(f.int4())
|
||||
ore_3 = BlockType(f.int4())
|
||||
ore_4 = BlockType(f.int4())
|
||||
saved_ore_tiers = SavedOreTiers(ore_1, ore_2, ore_3, ore_4, hardmode_ore_1, hardmode_ore_2, hardmode_ore_3)
|
||||
|
||||
pets = Pets(f.bool(), f.bool(), f.bool())
|
||||
|
||||
|
@ -891,8 +893,6 @@ class World:
|
|||
journey_powers.difficulty = f.single()
|
||||
elif power_id == 13:
|
||||
journey_powers.freeze_biome_spread = f.bool()
|
||||
else:
|
||||
print(f"Unknown id: {power_id}")
|
||||
|
||||
unknown_journey_powers_data = f.read_until(pointers.footer)
|
||||
|
||||
|
|
Loading…
Reference in a new issue