| 1 | // Dialog scripts for Donny and Ollie |
| 2 | // Context-aware greetings and personality-driven lines |
| 3 | |
| 4 | import gameState from '../gameState.js' |
| 5 | import inventory from './inventory.js' |
| 6 | |
| 7 | // Track if this is first meeting |
| 8 | const STORAGE_KEY_MET = 'dougk-met-characters' |
| 9 | |
| 10 | function getMetCharacters() { |
| 11 | try { |
| 12 | return JSON.parse(localStorage.getItem(STORAGE_KEY_MET) || '{}') |
| 13 | } catch { |
| 14 | return {} |
| 15 | } |
| 16 | } |
| 17 | |
| 18 | function markCharacterMet(character) { |
| 19 | const met = getMetCharacters() |
| 20 | met[character] = true |
| 21 | localStorage.setItem(STORAGE_KEY_MET, JSON.stringify(met)) |
| 22 | } |
| 23 | |
| 24 | function hasMetCharacter(character) { |
| 25 | return getMetCharacters()[character] || false |
| 26 | } |
| 27 | |
| 28 | // Donny - Distinguished, formal, slightly pompous but endearing |
| 29 | const DONNY_FIRST_MEETING = [ |
| 30 | "Ah, a fellow connoisseur of the finer things...", |
| 31 | "I am Donny. Distinguished purveyor of exquisite wares.", |
| 32 | "I have procured some rather exceptional items...", |
| 33 | "Care to take a look?" |
| 34 | ] |
| 35 | |
| 36 | const DONNY_GREETINGS = [ |
| 37 | [ |
| 38 | "Ah, we meet again, my discerning friend...", |
| 39 | "I have acquired some new curiosities.", |
| 40 | "Shall we browse?" |
| 41 | ], |
| 42 | [ |
| 43 | "How fortuitous! I was just thinking of you.", |
| 44 | "My collection has grown quite splendidly...", |
| 45 | "Care to peruse?" |
| 46 | ], |
| 47 | [ |
| 48 | "Ah yes, the distinguished duck keeper returns!", |
| 49 | "I trust your pond prospers?", |
| 50 | "Perhaps some new finery is in order..." |
| 51 | ], |
| 52 | [ |
| 53 | "Splendid to see you again!", |
| 54 | "I've been polishing the merchandise...", |
| 55 | "Only the finest for my favorite customer." |
| 56 | ] |
| 57 | ] |
| 58 | |
| 59 | const DONNY_HIGH_KOI = [ |
| 60 | [ |
| 61 | "My word! That is quite the koi fortune!", |
| 62 | "A collector of your caliber deserves only the best.", |
| 63 | "Allow me to show you my premium selection..." |
| 64 | ], |
| 65 | [ |
| 66 | "Impressive! Your koi-catching prowess is legendary.", |
| 67 | "With wealth like that, anything is possible...", |
| 68 | "Shall we see what catches your eye?" |
| 69 | ] |
| 70 | ] |
| 71 | |
| 72 | const DONNY_REPEAT_VISITOR = [ |
| 73 | [ |
| 74 | "Back so soon? Excellent taste, as always.", |
| 75 | "I've kept the good stuff in the back...", |
| 76 | "Just for you, of course." |
| 77 | ], |
| 78 | [ |
| 79 | "Ah, my most loyal patron returns!", |
| 80 | "I do so enjoy our little exchanges.", |
| 81 | "What shall it be today?" |
| 82 | ] |
| 83 | ] |
| 84 | |
| 85 | // Ollie - Curious, excitable, slightly scatterbrained |
| 86 | const OLLIE_FIRST_MEETING = [ |
| 87 | "Ooooh! Hello hello hello!", |
| 88 | "I'm Ollie! I've been watching you through my glass...", |
| 89 | "You catch the fishies! So clever!", |
| 90 | "I found some treasures! Wanna see wanna see?" |
| 91 | ] |
| 92 | |
| 93 | const OLLIE_GREETINGS = [ |
| 94 | [ |
| 95 | "Oh oh oh! It's you again!", |
| 96 | "I found MORE things! So many things!", |
| 97 | "Look look look!" |
| 98 | ], |
| 99 | [ |
| 100 | "Hiii! I was hoping you'd come back!", |
| 101 | "I've been organizing my collection...", |
| 102 | "Well, TRYING to organize it anyway..." |
| 103 | ], |
| 104 | [ |
| 105 | "There you are! I've been looking everywhere!", |
| 106 | "Wait, no, I was looking at stuff with my magnifier.", |
| 107 | "BUT NOW YOU'RE HERE! Perfect timing!" |
| 108 | ], |
| 109 | [ |
| 110 | "*excited tentacle wiggles*", |
| 111 | "Friend friend friend! Welcome back!", |
| 112 | "I have oddities! Curiosities! Thingamabobs!" |
| 113 | ] |
| 114 | ] |
| 115 | |
| 116 | const OLLIE_HIGH_KOI = [ |
| 117 | [ |
| 118 | "WOW! Look at all those fishies!", |
| 119 | "You're like... a koi WIZARD!", |
| 120 | "I have special special things for special fishers!" |
| 121 | ], |
| 122 | [ |
| 123 | "So many koi! How do you DO that?!", |
| 124 | "I tried counting them but I lost track at... um...", |
| 125 | "Anyway! TREASURES! I have them!" |
| 126 | ] |
| 127 | ] |
| 128 | |
| 129 | const OLLIE_REPEAT_VISITOR = [ |
| 130 | [ |
| 131 | "You came back! You came BACK!", |
| 132 | "I was worried you forgot about me...", |
| 133 | "Just kidding! I was busy looking at a rock. Wanna see?" |
| 134 | ], |
| 135 | [ |
| 136 | "FRIEND! *happy bubbles*", |
| 137 | "I reorganized everything! Again!", |
| 138 | "It's a LITTLE messier but also better somehow?" |
| 139 | ] |
| 140 | ] |
| 141 | |
| 142 | function pickRandom(array) { |
| 143 | return array[Math.floor(Math.random() * array.length)] |
| 144 | } |
| 145 | |
| 146 | export function getDialogForCharacter(character) { |
| 147 | const koiCount = gameState.getKoi() |
| 148 | const hasMet = hasMetCharacter(character) |
| 149 | const ownedCount = inventory.ownedItems.length |
| 150 | |
| 151 | // Mark as met for next time |
| 152 | if (!hasMet) { |
| 153 | markCharacterMet(character) |
| 154 | } |
| 155 | |
| 156 | if (character === 'donny') { |
| 157 | // First meeting |
| 158 | if (!hasMet) { |
| 159 | return DONNY_FIRST_MEETING |
| 160 | } |
| 161 | |
| 162 | // High koi count (50+) |
| 163 | if (koiCount >= 50 && Math.random() < 0.5) { |
| 164 | return pickRandom(DONNY_HIGH_KOI) |
| 165 | } |
| 166 | |
| 167 | // Repeat visitor with purchases |
| 168 | if (ownedCount >= 3 && Math.random() < 0.4) { |
| 169 | return pickRandom(DONNY_REPEAT_VISITOR) |
| 170 | } |
| 171 | |
| 172 | // Standard greeting |
| 173 | return pickRandom(DONNY_GREETINGS) |
| 174 | } |
| 175 | |
| 176 | if (character === 'ollie') { |
| 177 | // First meeting |
| 178 | if (!hasMet) { |
| 179 | return OLLIE_FIRST_MEETING |
| 180 | } |
| 181 | |
| 182 | // High koi count (50+) |
| 183 | if (koiCount >= 50 && Math.random() < 0.5) { |
| 184 | return pickRandom(OLLIE_HIGH_KOI) |
| 185 | } |
| 186 | |
| 187 | // Repeat visitor |
| 188 | if (ownedCount >= 3 && Math.random() < 0.4) { |
| 189 | return pickRandom(OLLIE_REPEAT_VISITOR) |
| 190 | } |
| 191 | |
| 192 | // Standard greeting |
| 193 | return pickRandom(OLLIE_GREETINGS) |
| 194 | } |
| 195 | |
| 196 | return ["Hello!"] |
| 197 | } |
| 198 | |
| 199 | // Quick return lines - when player taps to summon them back |
| 200 | const DONNY_TAP_RETURN = [ |
| 201 | [ |
| 202 | "Ah, you're back for more, eh?", |
| 203 | "I knew you would be.", |
| 204 | "Let's see what catches your fancy..." |
| 205 | ], |
| 206 | [ |
| 207 | "Changed your mind? Excellent judgment.", |
| 208 | "The best customers always return.", |
| 209 | "Now then, shall we?" |
| 210 | ], |
| 211 | [ |
| 212 | "Back so soon? Marvelous!", |
| 213 | "I was just about to polish my finest wares.", |
| 214 | "Your timing is impeccable." |
| 215 | ], |
| 216 | [ |
| 217 | "Couldn't stay away, could you?", |
| 218 | "I completely understand.", |
| 219 | "Quality is irresistible, after all." |
| 220 | ] |
| 221 | ] |
| 222 | |
| 223 | const OLLIE_TAP_RETURN = [ |
| 224 | [ |
| 225 | "You tapped me! You TAPPED me!", |
| 226 | "I love taps! They're like underwater high-fives!", |
| 227 | "Okay okay, let's look at stuff!" |
| 228 | ], |
| 229 | [ |
| 230 | "OOH! Hello again!", |
| 231 | "Did you forget something? I forget stuff ALL the time!", |
| 232 | "Let's see what I have..." |
| 233 | ], |
| 234 | [ |
| 235 | "Back for more shinies?", |
| 236 | "I KNEW you liked the shinies!", |
| 237 | "Everyone likes shinies!" |
| 238 | ], |
| 239 | [ |
| 240 | "*surprised wiggle*", |
| 241 | "Oh hi! I was just counting my tentacles...", |
| 242 | "Still eight! Anyway, SHOPPING TIME!" |
| 243 | ] |
| 244 | ] |
| 245 | |
| 246 | export function getReturnDialog(character) { |
| 247 | if (character === 'donny') { |
| 248 | return pickRandom(DONNY_TAP_RETURN) |
| 249 | } |
| 250 | if (character === 'ollie') { |
| 251 | return pickRandom(OLLIE_TAP_RETURN) |
| 252 | } |
| 253 | return ["Welcome back!"] |
| 254 | } |
| 255 | |
| 256 | // Farewell lines (for future use when closing shop) |
| 257 | export const FAREWELLS = { |
| 258 | donny: [ |
| 259 | "Until next time, my friend.", |
| 260 | "Do come again. I'll save the best for you.", |
| 261 | "Farewell! May your pond flourish.", |
| 262 | "A pleasure, as always." |
| 263 | ], |
| 264 | ollie: [ |
| 265 | "Bye bye bye! Come back soon!", |
| 266 | "See you later! I'll find more stuff!", |
| 267 | "*waves all tentacles* BYEEE!", |
| 268 | "Don't be a stranger! I'll be here! Looking at things!" |
| 269 | ] |
| 270 | } |