diff --git a/data/scripts/flavor/cerulean_city.lua b/data/scripts/flavor/cerulean_city.lua index 93d0ba9b..ed248543 100644 --- a/data/scripts/flavor/cerulean_city.lua +++ b/data/scripts/flavor/cerulean_city.lua @@ -3,6 +3,10 @@ -- Both NPCs use text_asm with an hRandomAdd roll to pick one of several -- flavor lines (no flags, no branching outcome) -- ported as a weighted -- math.random pick each time the NPC is talked to. +-- +-- Yellow renames Slowbro -> Electrode in the text labels (see +-- tools/yellow_symbol_aliases.py); look up both so Red/Blue and Yellow +-- share this script. local M = {} @@ -12,6 +16,29 @@ local function push(game, ow, npc, done, text) game.stack:push(TextBox.new(game, text, done)) end +-- CeruleanCitySlowbroText / CeruleanCityElectrodeText +-- cp 180 -> 76/256 chance of 1st; cp 120 -> 60/256 chance of 2nd; +-- cp 60 -> 60/256 chance of 3rd; else 60/256 chance of 4th. +local function talkMon(game, ow, npc, done) + local t = game.data.text + local roll = math.random(0, 255) + local text + if roll >= 180 then + text = t._CeruleanCitySlowbroTookASnoozeText + or t._CeruleanCityElectrodeTookASnoozeText + elseif roll >= 120 then + text = t._CeruleanCitySlowbroIsLoafingAroundText + or t._CeruleanCityElectrodeIsLoafingAroundText + elseif roll >= 60 then + text = t._CeruleanCitySlowbroTurnedAwayText + or t._CeruleanCityElectrodeTurnedAwayText + else + text = t._CeruleanCitySlowbroIgnoredOrdersText + or t._CeruleanCityElectrodeIgnoredOrdersText + end + push(game, ow, npc, done, text) +end + M.CERULEAN_CITY = { talk = { -- CeruleanCityCooltrainerF1Text (scripts/CeruleanCity.asm:362-393) @@ -23,32 +50,20 @@ M.CERULEAN_CITY = { local text if roll >= 180 then text = t._CeruleanCityCooltrainerF1SlowbroUseSonicboomText + or t._CeruleanCityCooltrainerF1ElectrodeUseSonicboomText elseif roll >= 100 then text = t._CeruleanCityCooltrainerF1SlowbroPunchText + or t._CeruleanCityCooltrainerF1ElectrodePunchText else text = t._CeruleanCityCooltrainerF1SlowbroWithdrawText + or t._CeruleanCityCooltrainerF1ElectrodeWithdrawText end push(game, ow, npc, done, text) end, - -- CeruleanCitySlowbroText (scripts/CeruleanCity.asm:395-436) - -- cp 180 -> 76/256 chance of 1st; cp 120 -> 60/256 chance of 2nd; - -- cp 60 -> 60/256 chance of 3rd; else 60/256 chance of 4th. - TEXT_CERULEANCITY_SLOWBRO = function(game, ow, npc, done) - local t = game.data.text - local roll = math.random(0, 255) - local text - if roll >= 180 then - text = t._CeruleanCitySlowbroTookASnoozeText - elseif roll >= 120 then - text = t._CeruleanCitySlowbroIsLoafingAroundText - elseif roll >= 60 then - text = t._CeruleanCitySlowbroTurnedAwayText - else - text = t._CeruleanCitySlowbroIgnoredOrdersText - end - push(game, ow, npc, done, text) - end, + TEXT_CERULEANCITY_SLOWBRO = talkMon, + -- Yellow map object uses TEXT_CERULEANCITY_ELECTRODE + TEXT_CERULEANCITY_ELECTRODE = talkMon, }, }