From 84955b49571d3db9c8aa146dc7cef121ae3e1c53 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 2 Feb 2026 01:59:29 +0000 Subject: [PATCH 1/5] Initial plan From 113eb2e04b2e18d13fb29f8ae5e9bbf8a6ad3869 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 2 Feb 2026 02:04:01 +0000 Subject: [PATCH 2/5] Add interactive dialogue system with tutorial content for NPCs Co-authored-by: dmccoystephenson <21204351+dmccoystephenson@users.noreply.github.com> --- src/location/bank.py | 37 ++++++++++++++++- src/location/docks.py | 36 +++++++++++++++- src/location/shop.py | 34 +++++++++++++++- src/location/tavern.py | 33 ++++++++++++++- src/npc/npc.py | 13 +++++- src/ui/userInterface.py | 49 ++++++++++++++++++++++ tests/location/test_bank.py | 10 ++--- tests/location/test_docks.py | 10 ++--- tests/location/test_shop.py | 10 ++--- tests/location/test_tavern.py | 10 ++--- tests/npc/test_npc.py | 77 +++++++++++++++++++++++++++++++++++ 11 files changed, 294 insertions(+), 25 deletions(-) diff --git a/src/location/bank.py b/src/location/bank.py index f139fa8..5f4d317 100644 --- a/src/location/bank.py +++ b/src/location/bank.py @@ -27,6 +27,41 @@ def __init__( "I've worked at this bank for fifteen years and I take pride in keeping everyone's money safe. " "My grandmother taught me the value of saving, and I've helped many fishermen in this village " "secure their futures. A penny saved is a penny earned, as they say!", + [ + { + "question": "How does the bank work?", + "response": "The bank is simple and safe! You can deposit money when you have some on hand, " + "and withdraw it whenever you need. We keep your money secure - " + "no risk of losing it to gambling or spending it accidentally! " + "Plus, your savings earn interest over time. The more you save, the more you earn. " + "It's the smart way to grow your wealth!" + }, + { + "question": "Tell me about interest rates.", + "response": "Ah yes, interest! Every day that passes, your savings grow by a small percentage. " + "It might not seem like much at first, but over time it really adds up! " + "The interest is automatically added to your bank account. " + "Think of it as the bank paying you for keeping your money with us. " + "The more you save, the more interest you earn!" + }, + { + "question": "Should I save or spend my money?", + "response": "That's the eternal question, isn't it? Here's my advice: " + "Keep some money on hand for daily needs - buying bait, paying for drinks, gambling if you must. " + "But save the rest in the bank! Your savings will grow with interest, " + "and you'll have a nice cushion for the future. " + "Many fishermen spend everything they earn and have nothing to show for it. " + "Be smarter than that!" + }, + { + "question": "What's the most important financial advice?", + "response": "Save regularly, even if it's just a little bit. Every coin counts! " + "Don't gamble away your hard-earned money - the odds are rarely in your favor. " + "Invest in good bait to improve your catches, but save the profits. " + "And remember: it's not about how much you earn, it's about how much you keep. " + "That's the secret to real wealth!" + } + ] ) def run(self): @@ -113,4 +148,4 @@ def withdraw(self): break def talkToNPC(self): - self.userInterface.showDialogue(self.npc.introduce()) + self.userInterface.showInteractiveDialogue(self.npc) diff --git a/src/location/docks.py b/src/location/docks.py index f722116..3429260 100644 --- a/src/location/docks.py +++ b/src/location/docks.py @@ -32,6 +32,40 @@ def __init__( "My pa was a fisherman, and his pa before him. I help maintain the boats and docks, " "and I've learned a thing or two about fishing over the years. " "The sea provides for those who respect her!", + [ + { + "question": "How do I fish at the docks?", + "response": "Fishing is what this village is all about! You need at least 10 energy to fish. " + "When you cast your line, you'll spend several random hours (1-10) fishing. " + "Each hour uses 10 energy. When a fish bites, press Enter fast - within 2 seconds! " + "Your reaction time matters. The more successful catches, the more fish you'll get. " + "Don't worry if you miss a few - you'll still catch at least one fish if you tried!" + }, + { + "question": "What other locations can I visit?", + "response": "From the docks, you can get to anywhere in the village! " + "There's your home - that's where you sleep to restore energy. " + "Gilbert's shop is where you sell fish and buy better bait. " + "The tavern is run by Old Tom - gambling and drinks there. " + "And the bank, where Margaret will keep your money safe and even give you interest!" + }, + { + "question": "Tell me about energy and rest.", + "response": "Energy is your lifeblood as a fisherman! You start each day with it, " + "and fishing uses it up - 10 energy per hour of fishing. " + "When you're running low, head home and sleep. That'll restore you for the next day. " + "The game keeps track of time - each action moves the clock forward. " + "Plan your day wisely!" + }, + { + "question": "What makes a good fisherman?", + "response": "Patience and quick reflexes! When that fish bites, you gotta be ready. " + "Invest in better bait from Gilbert - it makes a huge difference. " + "Fish when you have energy, sell regularly, and save your money. " + "The sea has its rhythms - you'll learn them in time. " + "And remember: it's not just about catching fish, it's about enjoying the life!" + } + ] ) def run(self): @@ -148,4 +182,4 @@ def fish(self): ) def talkToNPC(self): - self.userInterface.showDialogue(self.npc.introduce()) + self.userInterface.showInteractiveDialogue(self.npc) diff --git a/src/location/shop.py b/src/location/shop.py index 9366eec..c0386c5 100644 --- a/src/location/shop.py +++ b/src/location/shop.py @@ -28,6 +28,38 @@ def __init__( "I've been running this shop for thirty years, ever since I inherited it from my father. " "I've seen many fishermen come and go, but the best ones always come back for quality bait. " "I may not fish much anymore, but I know good gear when I see it!", + [ + { + "question": "What do you sell here?", + "response": "I deal in all things fishing! I'll buy any fish you catch - the price varies, " + "but you can expect $3 to $5 per fish. I also sell better bait that'll help you catch more fish. " + "The price goes up each time you upgrade, but trust me, it's worth it! " + "Better bait means more fish, and more fish means more money!" + }, + { + "question": "How does fishing work?", + "response": "Ah, fishing! Head down to the docks when you've got some energy. " + "You'll spend a few hours out there, and each hour costs 10 energy. " + "When a fish bites, you need to press Enter quickly - within 2 seconds! " + "Your success rate determines how many fish you catch. " + "Better bait from my shop will multiply your catch!" + }, + { + "question": "Tell me about the bait upgrades.", + "response": "Starting bait is decent, but my premium bait? That's where the magic happens! " + "Each upgrade increases your fish multiplier by 1. So if you normally catch 5 fish, " + "with a 2x multiplier you'll catch 10! The bait gets more expensive each time - " + "starts at one price then increases by 25% with each purchase. " + "But serious fishermen know it's the best investment you can make!" + }, + { + "question": "Any tips for selling fish?", + "response": "Well, the price per fish is random between $3 and $5, so sometimes you get lucky! " + "I'd say don't hoard your fish too long - sell regularly to keep money flowing. " + "Use that money to buy better bait, which helps you catch more, which means more money! " + "It's a beautiful cycle, really. And don't forget to save some money at the bank!" + } + ] ) def run(self): @@ -74,4 +106,4 @@ def buyBetterBait(self): self.currentPrompt.text = "You bought some better bait!" def talkToNPC(self): - self.userInterface.showDialogue(self.npc.introduce()) + self.userInterface.showInteractiveDialogue(self.npc) diff --git a/src/location/tavern.py b/src/location/tavern.py index 620240d..111b52e 100644 --- a/src/location/tavern.py +++ b/src/location/tavern.py @@ -34,6 +34,37 @@ def __init__( "I sailed the seven seas for forty years before settling down here. " "Lost my leg to a shark near the Caribbean, but I got plenty of stories to make up for it. " "These days I pour drinks and listen to folks' troubles. Best job I ever had!", + [ + { + "question": "How do I make money in this village?", + "response": "Well now, there's a few ways to fill your pockets around here! " + "The most reliable is fishing at the docks - catch some fish and sell 'em at Gilbert's shop. " + "You can also try your luck at gambling right here in the tavern, but be warned - " + "the dice don't always roll in your favor! And if you're patient, the bank offers " + "interest on your savings." + }, + { + "question": "What can I do at the tavern?", + "response": "Ah, the tavern! This is the place to unwind after a long day. " + "You can get yourself drunk for $10 - though you'll wake up at home with a headache the next day! " + "Or if you're feeling lucky, you can gamble with the dice. Place a bet, pick a number from 1 to 6, " + "and if the dice matches your choice, you'll double your money!" + }, + { + "question": "Tell me about the other villagers.", + "response": "Let me see... There's Gilbert the shopkeeper - been running that shop for thirty years. " + "He'll buy your fish and sell you better bait. Then there's Sam down at the docks, " + "knows everything about fishing. Margaret at the bank will keep your money safe. " + "All good folk, they are!" + }, + { + "question": "Any advice for a newcomer?", + "response": "Aye, I've seen many fishermen come through these doors. Here's what I tell 'em all: " + "Start small, fish when you have energy, and sell your catch regularly. " + "Don't gamble away all your coin - save some at the bank. " + "And remember, better bait means better catches. Take your time and enjoy the village!" + } + ] ) def run(self): @@ -151,4 +182,4 @@ def changeBet(self, prompt): ) def talkToNPC(self): - self.userInterface.showDialogue(self.npc.introduce()) + self.userInterface.showInteractiveDialogue(self.npc) diff --git a/src/npc/npc.py b/src/npc/npc.py index 714307a..a4bcbf6 100644 --- a/src/npc/npc.py +++ b/src/npc/npc.py @@ -1,9 +1,20 @@ # @author Daniel McCoy Stephenson class NPC: - def __init__(self, name: str, backstory: str): + def __init__(self, name: str, backstory: str, dialogue_options: list = None): self.name = name self.backstory = backstory + self.dialogue_options = dialogue_options or [] def introduce(self): """Returns the NPC's introduction text""" return f"{self.name}: {self.backstory}" + + def get_dialogue_options(self): + """Returns list of available dialogue options""" + return self.dialogue_options + + def get_dialogue_response(self, option_index: int): + """Returns the response for a specific dialogue option""" + if 0 <= option_index < len(self.dialogue_options): + return self.dialogue_options[option_index].get("response", "") + return "" diff --git a/src/ui/userInterface.py b/src/ui/userInterface.py index 221bfb1..7741e21 100644 --- a/src/ui/userInterface.py +++ b/src/ui/userInterface.py @@ -86,3 +86,52 @@ def showDialogue(self, text): self.divider() input(" [ CONTINUE ]") self.currentPrompt.text = "What would you like to do?" + + def showInteractiveDialogue(self, npc): + """Shows an interactive dialogue menu with the NPC""" + while True: + self.lotsOfSpace() + self.divider() + print(f" Talking with {npc.name}") + self.divider() + + # Show dialogue options + dialogue_options = npc.get_dialogue_options() + if not dialogue_options: + # Fallback to simple introduction if no options + print(npc.introduce()) + self.divider() + input(" [ CONTINUE ]") + self.currentPrompt.text = "What would you like to do?" + break + + print(" What would you like to ask?\n") + option_list = [] + for i, option in enumerate(dialogue_options): + question = option.get("question", f"Option {i+1}") + print(f" [{i+1}] {question}") + option_list.append(str(i+1)) + + print(f" [{len(option_list)+1}] [Back]") + option_list.append(str(len(option_list)+1)) + + choice = input("\n> ") + + if choice in option_list: + choice_idx = int(choice) - 1 + + # Check if user chose to go back + if choice_idx == len(dialogue_options): + self.currentPrompt.text = "What would you like to do?" + break + + # Show the response + response = npc.get_dialogue_response(choice_idx) + self.lotsOfSpace() + self.divider() + print(f" {npc.name}: {response}") + self.divider() + input(" [ CONTINUE ]") + else: + print(" Invalid choice. Try again!") + input(" [ CONTINUE ]") diff --git a/tests/location/test_bank.py b/tests/location/test_bank.py index c620339..f6e4f32 100644 --- a/tests/location/test_bank.py +++ b/tests/location/test_bank.py @@ -120,16 +120,16 @@ def test_run_talk_to_npc_action(): def test_talkToNPC(): # prepare bankInstance = createBank() - bankInstance.userInterface.showDialogue = MagicMock() + bankInstance.userInterface.showInteractiveDialogue = MagicMock() # call bankInstance.talkToNPC() # check - bankInstance.userInterface.showDialogue.assert_called_once() - call_args = bankInstance.userInterface.showDialogue.call_args[0][0] - assert "Margaret the Teller" in call_args - assert len(call_args) > 0 + bankInstance.userInterface.showInteractiveDialogue.assert_called_once() + call_args = bankInstance.userInterface.showInteractiveDialogue.call_args[0][0] + assert call_args.name == "Margaret the Teller" + assert len(call_args.get_dialogue_options()) > 0 def test_deposit_success(): diff --git a/tests/location/test_docks.py b/tests/location/test_docks.py index d1c4edd..28839ae 100644 --- a/tests/location/test_docks.py +++ b/tests/location/test_docks.py @@ -74,16 +74,16 @@ def test_run_talk_to_npc_action(): def test_talkToNPC(): # prepare docksInstance = createDocks() - docksInstance.userInterface.showDialogue = MagicMock() + docksInstance.userInterface.showInteractiveDialogue = MagicMock() # call docksInstance.talkToNPC() # check - docksInstance.userInterface.showDialogue.assert_called_once() - call_args = docksInstance.userInterface.showDialogue.call_args[0][0] - assert "Sam the Dock Worker" in call_args - assert len(call_args) > 0 + docksInstance.userInterface.showInteractiveDialogue.assert_called_once() + call_args = docksInstance.userInterface.showInteractiveDialogue.call_args[0][0] + assert call_args.name == "Sam the Dock Worker" + assert len(call_args.get_dialogue_options()) > 0 def test_run_go_to_shop_action(): diff --git a/tests/location/test_shop.py b/tests/location/test_shop.py index b8cddc0..2908184 100644 --- a/tests/location/test_shop.py +++ b/tests/location/test_shop.py @@ -88,16 +88,16 @@ def test_run_talk_to_npc_action(): def test_talkToNPC(): # prepare shopInstance = createShop() - shopInstance.userInterface.showDialogue = MagicMock() + shopInstance.userInterface.showInteractiveDialogue = MagicMock() # call shopInstance.talkToNPC() # check - shopInstance.userInterface.showDialogue.assert_called_once() - call_args = shopInstance.userInterface.showDialogue.call_args[0][0] - assert "Gilbert the Shopkeeper" in call_args - assert len(call_args) > 0 + shopInstance.userInterface.showInteractiveDialogue.assert_called_once() + call_args = shopInstance.userInterface.showInteractiveDialogue.call_args[0][0] + assert call_args.name == "Gilbert the Shopkeeper" + assert len(call_args.get_dialogue_options()) > 0 def test_sellFish(): diff --git a/tests/location/test_tavern.py b/tests/location/test_tavern.py index d020937..fd60448 100644 --- a/tests/location/test_tavern.py +++ b/tests/location/test_tavern.py @@ -105,16 +105,16 @@ def test_run_talk_to_npc_action(): def test_talkToNPC(): # prepare tavernInstance = createTavern() - tavernInstance.userInterface.showDialogue = MagicMock() + tavernInstance.userInterface.showInteractiveDialogue = MagicMock() # call tavernInstance.talkToNPC() # check - tavernInstance.userInterface.showDialogue.assert_called_once() - call_args = tavernInstance.userInterface.showDialogue.call_args[0][0] - assert "Old Tom the Barkeep" in call_args - assert len(call_args) > 0 + tavernInstance.userInterface.showInteractiveDialogue.assert_called_once() + call_args = tavernInstance.userInterface.showInteractiveDialogue.call_args[0][0] + assert call_args.name == "Old Tom the Barkeep" + assert len(call_args.get_dialogue_options()) > 0 def test_getDrunk(): diff --git a/tests/npc/test_npc.py b/tests/npc/test_npc.py index fddaed6..7b4ba89 100644 --- a/tests/npc/test_npc.py +++ b/tests/npc/test_npc.py @@ -19,3 +19,80 @@ def test_introduce(): # check assert introduction == "Barkeep: An old sailor with many tales to tell." + + +def test_initialization_with_dialogue_options(): + # prepare + dialogue_options = [ + {"question": "How are you?", "response": "I'm doing well!"}, + {"question": "What do you sell?", "response": "I sell fishing gear."} + ] + + # call + npc = NPC("Merchant", "A trader of goods.", dialogue_options) + + # check + assert npc.name == "Merchant" + assert npc.backstory == "A trader of goods." + assert len(npc.dialogue_options) == 2 + assert npc.dialogue_options[0]["question"] == "How are you?" + + +def test_get_dialogue_options(): + # prepare + dialogue_options = [ + {"question": "Question 1", "response": "Answer 1"}, + {"question": "Question 2", "response": "Answer 2"} + ] + npc = NPC("Guide", "A helpful guide.", dialogue_options) + + # call + options = npc.get_dialogue_options() + + # check + assert len(options) == 2 + assert options[0]["question"] == "Question 1" + assert options[1]["response"] == "Answer 2" + + +def test_get_dialogue_response(): + # prepare + dialogue_options = [ + {"question": "Question 1", "response": "Answer 1"}, + {"question": "Question 2", "response": "Answer 2"} + ] + npc = NPC("Guide", "A helpful guide.", dialogue_options) + + # call + response1 = npc.get_dialogue_response(0) + response2 = npc.get_dialogue_response(1) + + # check + assert response1 == "Answer 1" + assert response2 == "Answer 2" + + +def test_get_dialogue_response_invalid_index(): + # prepare + dialogue_options = [ + {"question": "Question 1", "response": "Answer 1"} + ] + npc = NPC("Guide", "A helpful guide.", dialogue_options) + + # call + response_negative = npc.get_dialogue_response(-1) + response_too_large = npc.get_dialogue_response(10) + + # check + assert response_negative == "" + assert response_too_large == "" + + +def test_npc_without_dialogue_options(): + # call + npc = NPC("Simple NPC", "Just a simple character.") + + # check + assert npc.dialogue_options == [] + assert npc.get_dialogue_options() == [] + assert npc.get_dialogue_response(0) == "" From c4d40d80e8fc8cd47cbaa64dbc89381d3dd7356c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 2 Feb 2026 02:26:54 +0000 Subject: [PATCH 3/5] Address PR feedback: fix dialogue_options initialization and add test coverage Co-authored-by: dmccoystephenson <21204351+dmccoystephenson@users.noreply.github.com> --- src/npc/npc.py | 5 ++- tests/npc/test_npc.py | 15 ++++++++ tests/ui/test_userInterface.py | 68 ++++++++++++++++++++++++++++++++++ 3 files changed, 87 insertions(+), 1 deletion(-) diff --git a/src/npc/npc.py b/src/npc/npc.py index a4bcbf6..07f4545 100644 --- a/src/npc/npc.py +++ b/src/npc/npc.py @@ -3,7 +3,10 @@ class NPC: def __init__(self, name: str, backstory: str, dialogue_options: list = None): self.name = name self.backstory = backstory - self.dialogue_options = dialogue_options or [] + if dialogue_options is None: + self.dialogue_options = [] + else: + self.dialogue_options = dialogue_options def introduce(self): """Returns the NPC's introduction text""" diff --git a/tests/npc/test_npc.py b/tests/npc/test_npc.py index 7b4ba89..eb96f13 100644 --- a/tests/npc/test_npc.py +++ b/tests/npc/test_npc.py @@ -96,3 +96,18 @@ def test_npc_without_dialogue_options(): assert npc.dialogue_options == [] assert npc.get_dialogue_options() == [] assert npc.get_dialogue_response(0) == "" + + +def test_npc_with_empty_list_preserves_identity(): + # prepare - create an empty list that we'll pass + empty_list = [] + + # call + npc = NPC("NPC", "A character.", empty_list) + + # check - the NPC should use the same list object, not create a new one + assert npc.dialogue_options is empty_list + + # Verify that modifications to the original list affect the NPC + empty_list.append({"question": "Test?", "response": "Test response"}) + assert len(npc.get_dialogue_options()) == 1 diff --git a/tests/ui/test_userInterface.py b/tests/ui/test_userInterface.py index 479c256..cf023f2 100644 --- a/tests/ui/test_userInterface.py +++ b/tests/ui/test_userInterface.py @@ -86,3 +86,71 @@ def test_showDialogue(): userInterface.print.assert_called_with("Test dialogue text") userInterface.input.assert_called_with(" [ CONTINUE ]") assert userInterfaceInstance.currentPrompt.text == "What would you like to do?" + + +def test_showInteractiveDialogue_with_no_options(): + # setup + from src.npc.npc import NPC + userInterfaceInstance = createUserInterface() + userInterface.print = MagicMock() + userInterface.input = MagicMock(return_value="") + userInterfaceInstance.lotsOfSpace = MagicMock() + userInterfaceInstance.divider = MagicMock() + npc = NPC("Test NPC", "A test character") + + # call + userInterfaceInstance.showInteractiveDialogue(npc) + + # check - should fallback to simple introduction + userInterfaceInstance.lotsOfSpace.assert_called_once() + assert userInterfaceInstance.divider.call_count == 3 + userInterface.input.assert_called_with(" [ CONTINUE ]") + assert userInterfaceInstance.currentPrompt.text == "What would you like to do?" + + +def test_showInteractiveDialogue_select_option(): + # setup + from src.npc.npc import NPC + userInterfaceInstance = createUserInterface() + userInterface.print = MagicMock() + # First input selects option 1, second input continues, third input selects Back + userInterface.input = MagicMock(side_effect=["1", "", "2"]) + userInterfaceInstance.lotsOfSpace = MagicMock() + userInterfaceInstance.divider = MagicMock() + + dialogue_options = [ + {"question": "Test question?", "response": "Test response"} + ] + npc = NPC("Test NPC", "A test character", dialogue_options) + + # call + userInterfaceInstance.showInteractiveDialogue(npc) + + # check - should have shown menu, response, and back option + assert userInterface.input.call_count == 3 + assert userInterfaceInstance.currentPrompt.text == "What would you like to do?" + + +def test_showInteractiveDialogue_invalid_choice(): + # setup + from src.npc.npc import NPC + userInterfaceInstance = createUserInterface() + userInterface.print = MagicMock() + # First input is invalid, second continues error message, third selects Back + userInterface.input = MagicMock(side_effect=["99", "", "2"]) + userInterfaceInstance.lotsOfSpace = MagicMock() + userInterfaceInstance.divider = MagicMock() + + dialogue_options = [ + {"question": "Test question?", "response": "Test response"} + ] + npc = NPC("Test NPC", "A test character", dialogue_options) + + # call + userInterfaceInstance.showInteractiveDialogue(npc) + + # check - should have handled invalid input + assert userInterface.input.call_count == 3 + # Should have printed "Invalid choice" message + print_calls = [str(call) for call in userInterface.print.call_args_list] + assert any("Invalid choice" in str(call) for call in print_calls) From b4ba8e9dd74d23ec83edf743bc17ed4f88c2289a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 2 Feb 2026 02:28:28 +0000 Subject: [PATCH 4/5] Improve test to avoid side effects with cleanup Co-authored-by: dmccoystephenson <21204351+dmccoystephenson@users.noreply.github.com> --- tests/npc/test_npc.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/npc/test_npc.py b/tests/npc/test_npc.py index eb96f13..1075e1e 100644 --- a/tests/npc/test_npc.py +++ b/tests/npc/test_npc.py @@ -101,13 +101,21 @@ def test_npc_without_dialogue_options(): def test_npc_with_empty_list_preserves_identity(): # prepare - create an empty list that we'll pass empty_list = [] + original_id = id(empty_list) # call npc = NPC("NPC", "A character.", empty_list) # check - the NPC should use the same list object, not create a new one assert npc.dialogue_options is empty_list + assert id(npc.dialogue_options) == original_id - # Verify that modifications to the original list affect the NPC - empty_list.append({"question": "Test?", "response": "Test response"}) + # Verify behavior: if caller modifies the list, NPC sees the changes + # (This demonstrates why preserving identity matters) + test_option = {"question": "Test?", "response": "Test response"} + empty_list.append(test_option) assert len(npc.get_dialogue_options()) == 1 + assert npc.get_dialogue_response(0) == "Test response" + + # Clean up the list to avoid side effects + empty_list.clear() From bcbe8cc4bf599596b4752c413438522ad919f776 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 2 Feb 2026 02:37:57 +0000 Subject: [PATCH 5/5] Add 'Tell me about yourself' dialogue option for all NPCs Co-authored-by: dmccoystephenson <21204351+dmccoystephenson@users.noreply.github.com> --- src/location/bank.py | 6 ++++++ src/location/docks.py | 7 +++++++ src/location/shop.py | 6 ++++++ src/location/tavern.py | 6 ++++++ 4 files changed, 25 insertions(+) diff --git a/src/location/bank.py b/src/location/bank.py index 5f4d317..17630be 100644 --- a/src/location/bank.py +++ b/src/location/bank.py @@ -28,6 +28,12 @@ def __init__( "My grandmother taught me the value of saving, and I've helped many fishermen in this village " "secure their futures. A penny saved is a penny earned, as they say!", [ + { + "question": "Tell me about yourself.", + "response": "I've worked at this bank for fifteen years and I take pride in keeping everyone's money safe. " + "My grandmother taught me the value of saving, and I've helped many fishermen in this village " + "secure their futures. A penny saved is a penny earned, as they say!" + }, { "question": "How does the bank work?", "response": "The bank is simple and safe! You can deposit money when you have some on hand, " diff --git a/src/location/docks.py b/src/location/docks.py index 3429260..0642b12 100644 --- a/src/location/docks.py +++ b/src/location/docks.py @@ -33,6 +33,13 @@ def __init__( "and I've learned a thing or two about fishing over the years. " "The sea provides for those who respect her!", [ + { + "question": "Tell me about yourself.", + "response": "Been working these docks since I was knee-high to a grasshopper. " + "My pa was a fisherman, and his pa before him. I help maintain the boats and docks, " + "and I've learned a thing or two about fishing over the years. " + "The sea provides for those who respect her!" + }, { "question": "How do I fish at the docks?", "response": "Fishing is what this village is all about! You need at least 10 energy to fish. " diff --git a/src/location/shop.py b/src/location/shop.py index c0386c5..5ede9cb 100644 --- a/src/location/shop.py +++ b/src/location/shop.py @@ -29,6 +29,12 @@ def __init__( "I've seen many fishermen come and go, but the best ones always come back for quality bait. " "I may not fish much anymore, but I know good gear when I see it!", [ + { + "question": "Tell me about yourself.", + "response": "I've been running this shop for thirty years, ever since I inherited it from my father. " + "I've seen many fishermen come and go, but the best ones always come back for quality bait. " + "I may not fish much anymore, but I know good gear when I see it!" + }, { "question": "What do you sell here?", "response": "I deal in all things fishing! I'll buy any fish you catch - the price varies, " diff --git a/src/location/tavern.py b/src/location/tavern.py index 111b52e..d3fa99e 100644 --- a/src/location/tavern.py +++ b/src/location/tavern.py @@ -35,6 +35,12 @@ def __init__( "Lost my leg to a shark near the Caribbean, but I got plenty of stories to make up for it. " "These days I pour drinks and listen to folks' troubles. Best job I ever had!", [ + { + "question": "Tell me about yourself.", + "response": "I sailed the seven seas for forty years before settling down here. " + "Lost my leg to a shark near the Caribbean, but I got plenty of stories to make up for it. " + "These days I pour drinks and listen to folks' troubles. Best job I ever had!" + }, { "question": "How do I make money in this village?", "response": "Well now, there's a few ways to fill your pockets around here! "