Files
Grinch-AP/worlds/civ_6/test/TestBoostsanity.py

183 lines
7.4 KiB
Python
Raw Normal View History

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>
2025-03-10 07:53:26 -06:00
from Fill import distribute_items_restrictive
from ..Data import get_boosts_data
from . import CivVITestBase
class TestBoostsanityIncluded(CivVITestBase):
auto_construct = False
options = {
"progressive_eras": "true",
"boostsanity": "true",
"progression_style": "none",
"shuffle_goody_hut_rewards": "false",
}
def test_boosts_get_included(self) -> None:
self.world_setup()
distribute_items_restrictive(self.multiworld)
locations = self.multiworld.get_locations(self.player)
found_locations = 0
for location in locations:
if "BOOST" in location.name:
found_locations += 1
num_boost_locations = len(get_boosts_data())
self.assertEqual(found_locations, num_boost_locations)
def test_boosts_require_prereqs_no_progressives(self) -> None:
self.world_setup()
location = "BOOST_TECH_ADVANCED_BALLISTICS"
items_to_give = ["Refining", "Electricity", "Apprenticeship", "Industrialization"]
self.assertFalse(self.can_reach_location(location))
for prereq in items_to_give:
self.collect_by_name(prereq)
is_last_prereq = prereq == items_to_give[-1]
self.assertEqual(self.can_reach_location(location), is_last_prereq)
class TestBoostsanityIncludedNoProgressiveDistricts(CivVITestBase):
auto_construct = False
options = {
"progressive_eras": "true",
"boostsanity": "true",
"progression_style": "districts_only",
"shuffle_goody_hut_rewards": "false",
}
def test_boosts_get_included(self) -> None:
self.world_setup()
distribute_items_restrictive(self.multiworld)
locations = self.multiworld.get_locations(self.player)
found_locations = 0
for location in locations:
if "BOOST" in location.name:
found_locations += 1
num_boost_locations = len(get_boosts_data())
self.assertEqual(found_locations, num_boost_locations)
class TestBoostsanityPrereqsWithProgressiveDistricts(CivVITestBase):
options = {
"progressive_eras": "true",
"boostsanity": "true",
"progression_style": "districts_only",
"shuffle_goody_hut_rewards": "false",
}
def test_boosts_require_progressive_prereqs_optional(self) -> None:
location = "BOOST_TECH_NUCLEAR_FUSION"
items_to_give = ["Progressive Industrial Zone", "Progressive Industrial Zone"]
self.assertFalse(self.can_reach_location(location))
for prereq in items_to_give:
self.collect_by_name(prereq)
is_last_prereq = prereq == items_to_give[-1]
self.assertEqual(self.can_reach_location(location), is_last_prereq)
def tests_boosts_require_correct_progressive_district_count(self) -> None:
location = "BOOST_TECH_RIFLING"
items_to_give = ["Mining", "Progressive Encampment", "Progressive Encampment"]
self.assertFalse(self.can_reach_location(location))
for prereq in items_to_give:
self.collect_by_name(prereq)
is_last_prereq = prereq == items_to_give[-1]
self.assertEqual(self.can_reach_location(location), is_last_prereq)
class TestBoostsanityExcluded(CivVITestBase):
auto_construct = False
options = {
"progressive_eras": "true",
"death_link": "true",
"boostsanity": "false",
"death_link_effect": "unit_killed",
"progressive_districts": "true",
"shuffle_goody_hut_rewards": "false",
}
def test_boosts_are_not_included(self) -> None:
self.world_setup()
distribute_items_restrictive(self.multiworld)
locations = self.multiworld.get_locations(self.player)
found_locations = 0
for location in locations:
if "BOOST" in location.name:
found_locations += 1
self.assertEqual(found_locations, 0)
class TestBoostsanityEraRequired(CivVITestBase):
options = {
"boostsanity": "true",
"progression_style": "none",
"shuffle_goody_hut_rewards": "false",
}
def test_era_required_boosts_not_accessible_early(self) -> None:
# BOOST_CIVIC_FEUDALISM has EraRequired=True and ERA_CLASSICAL
# It should NOT be accessible in Ancient era
self.assertFalse(self.can_reach_location("BOOST_CIVIC_FEUDALISM"))
# BOOST_CIVIC_URBANIZATION has EraRequired=True and ERA_INDUSTRIAL
# It should NOT be accessible in Ancient era
self.assertFalse(self.can_reach_location("BOOST_CIVIC_URBANIZATION"))
# BOOST_CIVIC_SPACE_RACE has EraRequired=True and ERA_ATOMIC
# It should NOT be accessible in Ancient era
self.assertFalse(self.can_reach_location("BOOST_CIVIC_SPACE_RACE"))
# Regular boosts without EraRequired should be accessible
self.assertTrue(self.can_reach_location("BOOST_TECH_SAILING"))
self.assertTrue(self.can_reach_location("BOOST_CIVIC_MILITARY_TRADITION"))
def test_era_required_boosts_accessible_in_correct_era(self) -> None:
# Collect items to reach Classical era
self.collect_by_name(["Mining", "Bronze Working", "Astrology", "Writing",
"Irrigation", "Sailing", "Animal Husbandry",
"State Workforce", "Foreign Trade"])
# BOOST_CIVIC_FEUDALISM should now be accessible in Classical era
self.assertTrue(self.can_reach_location("BOOST_CIVIC_FEUDALISM"))
# BOOST_CIVIC_URBANIZATION still not accessible (requires Industrial)
self.assertFalse(self.can_reach_location("BOOST_CIVIC_URBANIZATION"))
# Collect more items to reach Industrial era
self.collect_all_but(["TECH_ROCKETRY"])
# Now BOOST_CIVIC_URBANIZATION should be accessible
self.assertTrue(self.can_reach_location("BOOST_CIVIC_URBANIZATION"))
class TestBoostsanityEraRequiredWithProgression(CivVITestBase):
options = {
"boostsanity": "true",
"progression_style": "eras_and_districts",
"shuffle_goody_hut_rewards": "false",
}
def test_era_required_with_progressive_eras(self) -> None:
# Collect all items except Progressive Era
self.collect_all_but(["Progressive Era"])
# Even with all other items, era-required boosts should not be accessible
self.assertFalse(self.can_reach_location("BOOST_CIVIC_FEUDALISM"))
self.assertFalse(self.can_reach_location("BOOST_CIVIC_URBANIZATION"))
# Collect enough Progressive Era items to reach Classical (needs 2)
self.collect(self.get_item_by_name("Progressive Era"))
self.collect(self.get_item_by_name("Progressive Era"))
# BOOST_CIVIC_FEUDALISM should now be accessible
self.assertTrue(self.can_reach_location("BOOST_CIVIC_FEUDALISM"))
# But BOOST_CIVIC_URBANIZATION still requires Industrial era (needs 5 total)
self.assertFalse(self.can_reach_location("BOOST_CIVIC_URBANIZATION"))
# Collect 3 more Progressive Era items to reach Industrial
self.collect_by_name(["Progressive Era", "Progressive Era", "Progressive Era"])
# Now BOOST_CIVIC_URBANIZATION should be accessible
self.assertTrue(self.can_reach_location("BOOST_CIVIC_URBANIZATION"))