mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 20:21:32 -06:00
New Game Implementation: Civilization VI (#3736)
* Init * remove submodule * Init * Update docs * Fix tests * Update to use apcivvi * Update Readme and codeowners * Minor changes * Remove .value from options (except starting hint) * Minor updates * remove unnecessary property * Cleanup Rules and Region * Fix output file generation * Implement feedback * Remove 'AP' tag and fix issue with format strings and using same quotes * Update worlds/civ_6/__init__.py Co-authored-by: Scipio Wright <scipiowright@gmail.com> * Minor docs changes * minor updates * Small rework of create items * Minor updates * Remove unused variable * Move client to Launcher Components with rest of similar clients * Revert "Move client to Launcher Components with rest of similar clients" This reverts commit f9fd5df9fdf19eaf4f1de54e21e3c33a74f02364. * modify component * Fix generation issues * Fix tests * Minor change * Add improvement and test case * Minor options changes * . * Preliminary Review * Fix failing test due to slot data serialization * Format json * Remove exclude missable boosts * Update options (update goody hut text, make research multiplier a range) * Update docs punctuation and slot data init * Move priority/excluded locations into options * Implement docs PR feedback * PR Feedback for options * PR feedback misc * Update location classification and fix client type * Fix typings * Update research cost multiplier * Remove unnecessary location priority code * Remove extrenous use of items() * WIP PR Feedback * WIP PR Feedback * Add victory event * Add option set for death link effect * PR improvements * Update post fill hint to support items with multiple classifications * remove unnecessary len * Move location exclusion logic * Update test to use set instead of accidental dict * Update docs around progressive eras and boost locations * Update docs for options to be more readable * Fix issue with filler items and prehints * Update filler_data to be static * Update links in docs * Minor updates and PR feedback * Update boosts data * Update era required items * Update existing techs * Update existing techs * move boost data class * Update reward data * Update prereq data * Update new items and progressive districts * Remove unused code * Make filler item name func more efficient * Update death link text * Move Civ6 to the end of readme * Fix bug with hidden locations and location.name * Partial PR Feedback Implementation * Format changes * Minor review feedback * Modify access rules to use list created in generate_early * Modify boost rules to precalculate requirements * Remove option checks from access rules * Fix issue with pre initialized dicts * Add inno setup for civ6 client * Update inno_setup.iss --------- Co-authored-by: Scipio Wright <scipiowright@gmail.com> Co-authored-by: Exempt-Medic <60412657+Exempt-Medic@users.noreply.github.com> Co-authored-by: Exempt-Medic <ExemptMedic@Gmail.com> Co-authored-by: NewSoupVi <57900059+NewSoupVi@users.noreply.github.com>
This commit is contained in:
156
worlds/civ_6/Locations.py
Normal file
156
worlds/civ_6/Locations.py
Normal file
@@ -0,0 +1,156 @@
|
||||
from collections import defaultdict
|
||||
from dataclasses import dataclass
|
||||
from typing import Optional, Dict
|
||||
from BaseClasses import Location, Region
|
||||
|
||||
from .Data import get_boosts_data, get_new_civics_data, get_new_techs_data
|
||||
|
||||
from .Enum import CivVICheckType, EraType
|
||||
|
||||
CIV_VI_AP_LOCATION_ID_BASE = 5041000
|
||||
|
||||
# Locs that should not have progression items
|
||||
GOODY_HUT_LOCATION_NAMES = [
|
||||
"GOODY_HUT_1",
|
||||
"GOODY_HUT_2",
|
||||
"GOODY_HUT_3",
|
||||
"GOODY_HUT_4",
|
||||
"GOODY_HUT_5",
|
||||
"GOODY_HUT_6",
|
||||
"GOODY_HUT_7",
|
||||
"GOODY_HUT_8",
|
||||
"GOODY_HUT_9",
|
||||
"GOODY_HUT_10",
|
||||
]
|
||||
|
||||
|
||||
@dataclass
|
||||
class CivVILocationData:
|
||||
name: str
|
||||
cost: int
|
||||
uiTreeRow: int
|
||||
civ_id: int
|
||||
era_type: str
|
||||
location_type: CivVICheckType
|
||||
|
||||
game: str = "Civilization VI"
|
||||
|
||||
@property
|
||||
def code(self):
|
||||
return self.civ_id + CIV_VI_AP_LOCATION_ID_BASE
|
||||
|
||||
|
||||
class CivVILocation(Location):
|
||||
game: str = "Civilization VI"
|
||||
location_type: CivVICheckType
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
player: int,
|
||||
name: str = "",
|
||||
address: Optional[int] = None,
|
||||
parent: Optional[Region] = None,
|
||||
):
|
||||
super().__init__(player, name, address, parent)
|
||||
category = name.split("_")[0]
|
||||
if "victory" in category:
|
||||
self.location_type = CivVICheckType.EVENT
|
||||
else:
|
||||
self.location_type = CivVICheckType(category)
|
||||
|
||||
|
||||
def generate_flat_location_table() -> Dict[str, CivVILocationData]:
|
||||
"""
|
||||
Generates a flat location table in the following format:
|
||||
{
|
||||
"TECH_AP_ANCIENT_00": CivVILocationData,
|
||||
"TECH_AP_ANCIENT_01": CivVILocationData,
|
||||
"CIVIC_AP_ANCIENT_00": CivVILocationData,
|
||||
...
|
||||
}
|
||||
"""
|
||||
era_locations = generate_era_location_table()
|
||||
flat_locations: Dict[str, CivVILocationData] = {}
|
||||
for locations in era_locations.values():
|
||||
for location_id, location_data in locations.items():
|
||||
flat_locations[location_id] = location_data
|
||||
return flat_locations
|
||||
|
||||
|
||||
def generate_era_location_table() -> Dict[str, Dict[str, CivVILocationData]]:
|
||||
"""
|
||||
Uses the data from existing_tech.json to generate a location table in the following format:
|
||||
{
|
||||
"ERA_ANCIENT": {
|
||||
"TECH_AP_ANCIENT_00": CivVILocationData,
|
||||
"TECH_AP_ANCIENT_01": CivVILocationData,
|
||||
"CIVIC_AP_ANCIENT_00": CivVILocationData,
|
||||
},
|
||||
...
|
||||
}
|
||||
"""
|
||||
|
||||
new_techs = get_new_techs_data()
|
||||
era_locations: Dict[str, Dict[str, CivVILocationData]] = defaultdict(dict)
|
||||
id_base = 0
|
||||
# Techs
|
||||
for data in new_techs:
|
||||
era_type = data["EraType"]
|
||||
era_locations[era_type][data["Type"]] = CivVILocationData(
|
||||
data["Type"],
|
||||
data["Cost"],
|
||||
data["UITreeRow"],
|
||||
id_base,
|
||||
era_type,
|
||||
CivVICheckType.TECH,
|
||||
)
|
||||
id_base += 1
|
||||
# Civics
|
||||
new_civics = get_new_civics_data()
|
||||
|
||||
for data in new_civics:
|
||||
era_type = data["EraType"]
|
||||
era_locations[era_type][data["Type"]] = CivVILocationData(
|
||||
data["Type"],
|
||||
data["Cost"],
|
||||
data["UITreeRow"],
|
||||
id_base,
|
||||
era_type,
|
||||
CivVICheckType.CIVIC,
|
||||
)
|
||||
id_base += 1
|
||||
|
||||
# Eras
|
||||
for era in EraType:
|
||||
|
||||
if era == EraType.ERA_ANCIENT:
|
||||
continue
|
||||
|
||||
era_locations[era.name][era.name] = CivVILocationData(
|
||||
era.name, 0, 0, id_base, era.name, CivVICheckType.ERA
|
||||
)
|
||||
id_base += 1
|
||||
|
||||
# Goody Huts, defaults to 10 goody huts as location checks (rarely will a player get more than this)
|
||||
for i in range(10):
|
||||
era_locations[EraType.ERA_ANCIENT.value]["GOODY_HUT_" + str(i + 1)] = (
|
||||
CivVILocationData(
|
||||
"GOODY_HUT_" + str(i + 1),
|
||||
0,
|
||||
0,
|
||||
id_base,
|
||||
EraType.ERA_ANCIENT.value,
|
||||
CivVICheckType.GOODY,
|
||||
)
|
||||
)
|
||||
id_base += 1
|
||||
# Boosts
|
||||
boosts = get_boosts_data()
|
||||
for boost in boosts:
|
||||
location = CivVILocationData(
|
||||
boost.Type, 0, 0, id_base, boost.EraType, CivVICheckType.BOOST
|
||||
)
|
||||
era_locations["ERA_ANCIENT"][boost.Type] = location
|
||||
id_base += 1
|
||||
|
||||
return era_locations
|
||||
Reference in New Issue
Block a user