Now avoid using missiles as replacement for items which are given during an event.

This commit is contained in:
shru 2018-12-19 18:49:40 -05:00
parent 719c247908
commit 618c3c5020
4 changed files with 26 additions and 2 deletions

View file

@ -4,14 +4,12 @@ Cave Story Randomizer
Todo
----
- Missiles should only replace items which are not part of cutscenes.
- Trade Sequence Step B: Require random obtainable weapon, instead of always polar star and fireball.
- Randomize Booster v0.8 / v2.0
Issues
------
- Items will no longer trigger associated cutscenes if replaced with missiles. This probably breaks something somewhere...
- Collecting the Super Missile Launcher increases your maximum missiles by 5. This does not normally happen.
- 3 Life Capsules can not be replaced because they appear on maps with 2 capsules. Need label-aware replace.
- Hell Missile Upgrade uses a unique script and won't be easy to replace.

View file

@ -39,6 +39,7 @@ function equipment(t)
("Got the =%s=!<WAI0160"):format(t.name), -- Whimsical Star
-- Cave Story+
("Obtained the %s.<WAI0160<NOD"):format(t.name),
("Obtained the %s.<WAI0160"):format(t.name), -- Whimsical Star
},
command = {
("<IT+00%s<EQ+%s"):format(t.id, t.equipMask), -- Replacement
@ -74,6 +75,7 @@ function item(t)
command = ("<IT+00%s"):format(t.id),
displayCmd = ("<GIT10%s"):format(t.id),
music = t.music or "<CMU0010",
kind = "missiles",
replaceBefore = t.replaceBefore,
}
end

View file

@ -11,12 +11,17 @@ function C:new()
end
local function _filterAny(item) return true end
local function _filterAnyExceptMissiles(item) return item.kind ~= "missiles" end
local function _filterWeapon(item) return item.kind == "weapon" end
function C:getAny()
return self:_getItem(_filterAny)
end
function C:getAnyExceptMissiles()
return self:_getItem(_filterAnyExceptMissiles)
end
function C:getWeapon()
return self:_getItem(_filterWeapon)
end

View file

@ -92,6 +92,10 @@ function C:_shuffleItems(tscFiles)
}))
local firstWeapon = itemDeck:getWeapon()
tscFiles[firstArea]:replaceSpecificItem(firstItemKey, firstWeapon)
-- First cutscene won't play if missiles go in polar star chest.
if firstArea == 'Cave.tsc' then
tscFiles['Pole.tsc']:replaceSpecificItem('wPolarStar', itemDeck:getAnyExceptMissiles())
end
-- Replace all weapon trades with random weapons
tscFiles['Curly.tsc']:replaceSpecificItem('wMachineGun', itemDeck:getWeapon())
@ -99,6 +103,21 @@ function C:_shuffleItems(tscFiles)
tscFiles['Pole.tsc']:replaceSpecificItem('wSpur', itemDeck:getWeapon())
tscFiles['Little.tsc']:replaceSpecificItem('wNemesis', itemDeck:getWeapon())
-- Replace items which are part of elaborate events.
-- Missiles jump to a global event, so shouldn't be used here.
local items = {
{'Santa.tsc', 'wFireball'},
{'Chako.tsc', 'iChakosRouge'},
{'MazeA.tsc', 'eTurbocharge'},
{'MazeA.tsc', 'eWhimsicalStar'},
{'Cent.tsc', 'lPlantationA'},
{'Cent.tsc', 'iLifePot'},
}
for _, t in ipairs(items) do
local file, itemKey = unpack(t)
tscFiles[file]:replaceSpecificItem(itemKey, itemDeck:getAnyExceptMissiles())
end
-- Replace the rest of the items.
for _, tscFile in pairs(tscFiles) do
while tscFile:hasUnreplacedItems() do