mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 20:21:32 -06:00
SM update (#147)
* fixed generations failing when only bosses are unreachable * - replaced setting maxDiff to infinity with a bool only affecting boss logics if only bosses are left to finish * fixed failling generations when using 'fun' settings Accessibility checks are forced to 'items' if restricted locations are used by VARIA following usage of 'fun' settings * fixed debug logger * removed unsupported "suits_restriction" option * fixed generations failing when only bosses are unreachable (using a less intrusive approach for AP) * - fixed deathlink emptying reserves - added death_link_survive option that lets player survive when receiving a deathlink if the have non-empty reserves * - merged death_link and death_link_survive options
This commit is contained in:
@@ -134,9 +134,9 @@ class AccessGraph(object):
|
||||
|
||||
def printGraph(self):
|
||||
if self.log.getEffectiveLevel() == logging.DEBUG:
|
||||
self.log("Area graph:")
|
||||
self.log.debug("Area graph:")
|
||||
for s, d in self.InterAreaTransitions:
|
||||
self.log("{} -> {}".format(s.Name, d.Name))
|
||||
self.log.debug("{} -> {}".format(s.Name, d.Name))
|
||||
|
||||
def addAccessPoint(self, ap):
|
||||
ap.distance = 0
|
||||
|
||||
@@ -566,6 +566,8 @@ class Helpers(object):
|
||||
# print('RIDLEY', ammoMargin, secs)
|
||||
(diff, defenseItems) = self.computeBossDifficulty(ammoMargin, secs,
|
||||
Settings.bossesDifficulty['Ridley'])
|
||||
if (sm.onlyBossLeft):
|
||||
diff = 1
|
||||
if diff < 0:
|
||||
return smboolFalse
|
||||
else:
|
||||
@@ -580,6 +582,8 @@ class Helpers(object):
|
||||
#print('KRAID True ', ammoMargin, secs)
|
||||
(diff, defenseItems) = self.computeBossDifficulty(ammoMargin, secs,
|
||||
Settings.bossesDifficulty['Kraid'])
|
||||
if (sm.onlyBossLeft):
|
||||
diff = 1
|
||||
if diff < 0:
|
||||
return smboolFalse
|
||||
|
||||
@@ -621,6 +625,8 @@ class Helpers(object):
|
||||
if sm.haveItem('Gravity') and sm.haveItem('ScrewAttack'):
|
||||
fight.difficulty /= Settings.algoSettings['draygonScrewBonus']
|
||||
fight.difficulty = self.adjustHealthDropDiff(fight.difficulty)
|
||||
if (sm.onlyBossLeft):
|
||||
fight.difficulty = 1
|
||||
else:
|
||||
fight = smboolFalse
|
||||
# for grapple kill considers energy drained by wall socket + 2 spankings by Dray
|
||||
@@ -661,6 +667,8 @@ class Helpers(object):
|
||||
elif not hasCharge and sm.itemCount('Missile') <= 2: # few missiles is harder
|
||||
difficulty *= Settings.algoSettings['phantoonLowMissileMalus']
|
||||
difficulty = self.adjustHealthDropDiff(difficulty)
|
||||
if (sm.onlyBossLeft):
|
||||
difficulty = 1
|
||||
fight = SMBool(True, difficulty, items=ammoItems+defenseItems)
|
||||
|
||||
return sm.wor(fight,
|
||||
@@ -707,6 +715,8 @@ class Helpers(object):
|
||||
# print('MB2', ammoMargin, secs)
|
||||
#print("ammoMargin: {}, secs: {}, settings: {}, energyDiff: {}".format(ammoMargin, secs, Settings.bossesDifficulty['MotherBrain'], energyDiff))
|
||||
(diff, defenseItems) = self.computeBossDifficulty(ammoMargin, secs, Settings.bossesDifficulty['MotherBrain'], energyDiff)
|
||||
if (sm.onlyBossLeft):
|
||||
diff = 1
|
||||
if diff < 0:
|
||||
return smboolFalse
|
||||
return SMBool(True, diff, items=ammoItems+defenseItems)
|
||||
|
||||
@@ -13,12 +13,13 @@ class SMBoolManager(object):
|
||||
items = ['ETank', 'Missile', 'Super', 'PowerBomb', 'Bomb', 'Charge', 'Ice', 'HiJump', 'SpeedBooster', 'Wave', 'Spazer', 'SpringBall', 'Varia', 'Plasma', 'Grapple', 'Morph', 'Reserve', 'Gravity', 'XRayScope', 'SpaceJump', 'ScrewAttack', 'Nothing', 'NoEnergy', 'MotherBrain', 'Hyper'] + Bosses.Golden4()
|
||||
countItems = ['Missile', 'Super', 'PowerBomb', 'ETank', 'Reserve']
|
||||
|
||||
def __init__(self, player=0, maxDiff=sys.maxsize):
|
||||
def __init__(self, player=0, maxDiff=sys.maxsize, onlyBossLeft = False):
|
||||
self._items = { }
|
||||
self._counts = { }
|
||||
|
||||
self.player = player
|
||||
self.maxDiff = maxDiff
|
||||
self.onlyBossLeft = onlyBossLeft
|
||||
|
||||
# cache related
|
||||
self.cacheKey = 0
|
||||
|
||||
@@ -76,7 +76,7 @@ class ItemLocContainer(object):
|
||||
locs = copy.copy(self.unusedLocations)
|
||||
# we don't copy restriction state on purpose: it depends on
|
||||
# outside context we don't want to bring to the copy
|
||||
ret = ItemLocContainer(SMBoolManager(self.sm.player, self.sm.maxDiff),
|
||||
ret = ItemLocContainer(SMBoolManager(self.sm.player, self.sm.maxDiff, self.sm.onlyBossLeft),
|
||||
self.itemPoolBackup[:] if self.itemPoolBackup != None else self.itemPool[:],
|
||||
locs)
|
||||
ret.currentItems = self.currentItems[:]
|
||||
@@ -103,7 +103,7 @@ class ItemLocContainer(object):
|
||||
# transfer collected items/locations to another container
|
||||
def transferCollected(self, dest):
|
||||
dest.currentItems = self.currentItems[:]
|
||||
dest.sm = SMBoolManager(self.sm.player, self.sm.maxDiff)
|
||||
dest.sm = SMBoolManager(self.sm.player, self.sm.maxDiff, self.sm.onlyBossLeft)
|
||||
dest.sm.addItems([item.Type for item in dest.currentItems])
|
||||
dest.itemLocations = copy.copy(self.itemLocations)
|
||||
dest.unrestrictedItems = copy.copy(self.unrestrictedItems)
|
||||
|
||||
@@ -311,7 +311,7 @@ def loadRandoPreset(world, player, args):
|
||||
args.animals = world.animals[player].value
|
||||
args.noVariaTweaks = not world.varia_tweaks[player].value
|
||||
args.maxDifficulty = diffs[world.max_difficulty[player].value]
|
||||
args.suitsRestriction = world.suits_restriction[player].value
|
||||
#args.suitsRestriction = world.suits_restriction[player].value
|
||||
#args.hideItems = world.hide_items[player].value
|
||||
args.strictMinors = world.strict_minors[player].value
|
||||
args.noLayout = not world.layout_patches[player].value
|
||||
|
||||
Reference in New Issue
Block a user