sm64ex: Various Features (#790)

* sm64ex: Course and Secret Randomizer

* sm64ex: Allow higher star door costs, raise minimum amount of stars, deprecate ExtraStars

* sm64ex: Support setting MIPS costs

* sm64ex: Safeguard MIPS Costs
This commit is contained in:
Yussur Mustafa Oraji
2022-07-25 18:39:31 +02:00
committed by GitHub
parent e6635cdd77
commit c3ff201b90
6 changed files with 235 additions and 150 deletions

View File

@@ -5,7 +5,7 @@ from .Items import item_table, cannon_item_table, SM64Item
from .Locations import location_table, SM64Location
from .Options import sm64_options
from .Rules import set_rules
from .Regions import create_regions, sm64courses, sm64paintings
from .Regions import create_regions, sm64courses, sm64entrances_s, sm64_internalloc_to_string, sm64_internalloc_to_regionid
from BaseClasses import Item, Tutorial, ItemClassification
from ..AutoWorld import World, WebWorld
@@ -54,10 +54,10 @@ class SM64World(World):
set_rules(self.world, self.player, self.area_connections)
if self.topology_present:
# Write area_connections to spoiler log
for painting_id, destination in self.area_connections.items():
for entrance, destination in self.area_connections.items():
self.world.spoiler.set_entrance(
sm64paintings[painting_id] + " Painting",
sm64courses[destination // 10],
sm64_internalloc_to_string[entrance] + " Entrance",
sm64_internalloc_to_string[destination],
'entrance', self.player)
def create_item(self, name: str) -> Item:
@@ -74,9 +74,13 @@ class SM64World(World):
def generate_basic(self):
staritem = self.create_item("Power Star")
starcount = min(self.world.StarsToFinish[self.player].value + self.world.ExtraStars[self.player].value,120)
starcount = self.world.AmountOfStars[self.player].value
if (not self.world.EnableCoinStars[self.player].value):
starcount = max(starcount - 15,self.world.StarsToFinish[self.player].value)
starcount = max(35,self.world.AmountOfStars[self.player].value-15)
starcount = max(starcount, self.world.FirstBowserStarDoorCost[self.player].value,
self.world.BasementStarDoorCost[self.player].value, self.world.SecondFloorStarDoorCost[self.player].value,
self.world.MIPS1Cost[self.player].value, self.world.MIPS2Cost[self.player].value,
self.world.StarsToFinish[self.player].value)
self.world.itempool += [staritem for i in range(0,starcount)]
mushroomitem = self.create_item("1Up Mushroom")
self.world.itempool += [mushroomitem for i in range(starcount,120 - (15 if not self.world.EnableCoinStars[self.player].value else 0))]
@@ -117,6 +121,8 @@ class SM64World(World):
"FirstBowserDoorCost": self.world.FirstBowserStarDoorCost[self.player].value,
"BasementDoorCost": self.world.BasementStarDoorCost[self.player].value,
"SecondFloorCost": self.world.SecondFloorStarDoorCost[self.player].value,
"MIPS1Cost": self.world.MIPS1Cost[self.player].value,
"MIPS2Cost": self.world.MIPS2Cost[self.player].value,
"StarsToFinish": self.world.StarsToFinish[self.player].value,
"DeathLink": self.world.death_link[self.player].value,
}
@@ -145,8 +151,9 @@ class SM64World(World):
def modify_multidata(self, multidata):
if self.topology_present:
er_hint_data = {}
for painting_id, destination in self.area_connections.items():
region = self.world.get_region(sm64courses[destination // 10], self.player)
for entrance, destination in self.area_connections.items():
regionid = sm64_internalloc_to_regionid[destination]
region = self.world.get_region(sm64courses[regionid], self.player)
for location in region.locations:
er_hint_data[location.address] = sm64paintings[painting_id]
er_hint_data[location.address] = sm64_internalloc_to_string[entrance]
multidata['er_hint_data'][self.player] = er_hint_data