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 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. - Trade Sequence Step B: Require random obtainable weapon, instead of always polar star and fireball.
- Randomize Booster v0.8 / v2.0 - Randomize Booster v0.8 / v2.0
Issues 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. - 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. - 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. - 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 ("Got the =%s=!<WAI0160"):format(t.name), -- Whimsical Star
-- Cave Story+ -- Cave Story+
("Obtained the %s.<WAI0160<NOD"):format(t.name), ("Obtained the %s.<WAI0160<NOD"):format(t.name),
("Obtained the %s.<WAI0160"):format(t.name), -- Whimsical Star
}, },
command = { command = {
("<IT+00%s<EQ+%s"):format(t.id, t.equipMask), -- Replacement ("<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), command = ("<IT+00%s"):format(t.id),
displayCmd = ("<GIT10%s"):format(t.id), displayCmd = ("<GIT10%s"):format(t.id),
music = t.music or "<CMU0010", music = t.music or "<CMU0010",
kind = "missiles",
replaceBefore = t.replaceBefore, replaceBefore = t.replaceBefore,
} }
end end

View file

@ -11,12 +11,17 @@ function C:new()
end end
local function _filterAny(item) return true 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 local function _filterWeapon(item) return item.kind == "weapon" end
function C:getAny() function C:getAny()
return self:_getItem(_filterAny) return self:_getItem(_filterAny)
end end
function C:getAnyExceptMissiles()
return self:_getItem(_filterAnyExceptMissiles)
end
function C:getWeapon() function C:getWeapon()
return self:_getItem(_filterWeapon) return self:_getItem(_filterWeapon)
end end

View file

@ -92,6 +92,10 @@ function C:_shuffleItems(tscFiles)
})) }))
local firstWeapon = itemDeck:getWeapon() local firstWeapon = itemDeck:getWeapon()
tscFiles[firstArea]:replaceSpecificItem(firstItemKey, firstWeapon) 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 -- Replace all weapon trades with random weapons
tscFiles['Curly.tsc']:replaceSpecificItem('wMachineGun', itemDeck:getWeapon()) tscFiles['Curly.tsc']:replaceSpecificItem('wMachineGun', itemDeck:getWeapon())
@ -99,6 +103,21 @@ function C:_shuffleItems(tscFiles)
tscFiles['Pole.tsc']:replaceSpecificItem('wSpur', itemDeck:getWeapon()) tscFiles['Pole.tsc']:replaceSpecificItem('wSpur', itemDeck:getWeapon())
tscFiles['Little.tsc']:replaceSpecificItem('wNemesis', 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. -- Replace the rest of the items.
for _, tscFile in pairs(tscFiles) do for _, tscFile in pairs(tscFiles) do
while tscFile:hasUnreplacedItems() do while tscFile:hasUnreplacedItems() do