diff --git a/data/json/npcs/TALK_COMMON_MISSION.json b/data/json/npcs/TALK_COMMON_MISSION.json index ab1dc4cbae502..1b5bbd0f518ef 100644 --- a/data/json/npcs/TALK_COMMON_MISSION.json +++ b/data/json/npcs/TALK_COMMON_MISSION.json @@ -128,91 +128,108 @@ "condition": "mission_failed", "trial": { "type": "LIE", "difficulty": 10, "mod": [ [ "TRUST", 3 ] ] }, "success": { "topic": "TALK_NONE" }, - "failure": { "topic": "TALK_MISSION_FAILURE" } + "failure": { "topic": "TALK_MISSION_FAILURE", "opinion": { "trust": -3, "value": -1, "anger": 2 } } }, { "text": "Not yet.", "condition": "mission_incomplete", "topic": "TALK_NONE" }, { - "truefalsetext": { "true": "I killed him.", "false": "I killed it.", "condition": { "mission_goal": "ASSASSINATE" } }, + "truefalsetext": { "true": "I killed him.", "false": "I killed it.", "condition": { "mission_goal": "MGOAL_ASSASSINATE" } }, "condition": { "and": [ "mission_incomplete", { "or": [ - { "mission_goal": "ASSASSINATE" }, - { "mission_goal": "KILL_MONSTER" }, - { "mission_goal": "KILL_MONSTER_SPEC" }, - { "mission_goal": "KILL_MONSTER_TYPE" } + { "mission_goal": "MGOAL_ASSASSINATE" }, + { "mission_goal": "MGOAL_KILL_MONSTER" }, + { "mission_goal": "MGOAL_KILL_MONSTER_SPEC" }, + { "mission_goal": "MGOAL_KILL_MONSTER_TYPE" } ] } ] }, - "trial": { "type": "LIE", "difficulty": 10, "mod": [ [ "TRUST", 3 ] ] }, - "success": { "topic": "TALK_NONE" }, - "failure": { "topic": "TALK_MISSION_FAILURE" } + "trial": { "type": "LIE", "difficulty": 10, "mod": [ [ "TRUST", 5 ] ] }, + "success": { "topic": "TALK_MISSION_SUCCESS", "effect": "mission_success" }, + "failure": { "topic": "TALK_MISSION_SUCCESS_LIE", "opinion": { "trust": -5, "value": -1, "anger": 5 } } }, { "text": "No. I'll get back to it, bye!", "condition": "mission_incomplete", "topic": "TALK_NONE" }, { "text": "Yup! Here it is!", "topic": "TALK_MISSION_SUCCESS", - "condition": { "and": [ { "or": [ { "mission_goal": "FIND_ITEM" }, { "mission_goal": "FIND_ANY_ITEM" } ] }, "mission_complete" ] }, - "switch": true + "condition": { + "and": [ { "or": [ { "mission_goal": "MGOAL_FIND_ITEM" }, { "mission_goal": "MGOAL_FIND_ANY_ITEM" } ] }, "mission_complete" ] + }, + "switch": true, + "effect": "mission_success" }, { "text": "We're here!", "topic": "TALK_MISSION_SUCCESS", - "condition": { "and": [ "mission_complete", { "mission_goal": "GO_TO_TYPE" } ] }, - "switch": true + "condition": { "and": [ "mission_complete", { "mission_goal": "MGOAL_GO_TO_TYPE" } ] }, + "switch": true, + "effect": "mission_success" }, { "text": "Here I am.", "topic": "TALK_MISSION_SUCCESS", - "condition": { "and": [ { "or": [ { "mission_goal": "GO_TO" }, { "mission_goal": "FIND_NPC" } ] }, "mission_complete" ] }, - "switch": true + "condition": { "and": [ { "or": [ { "mission_goal": "MGOAL_GO_TO" }, { "mission_goal": "MGOAL_FIND_NPC" } ] }, "mission_complete" ] }, + "switch": true, + "effect": "mission_success" }, { "text": "Here it is!", "topic": "TALK_MISSION_SUCCESS", - "condition": { "and": [ "mission_complete", { "mission_goal": "FIND_MONSTER" } ] }, - "switch": true + "condition": { "and": [ "mission_complete", { "mission_goal": "MGOAL_FIND_MONSTER" } ] }, + "switch": true, + "effect": "mission_success" }, { "text": "Justice has been served.", "topic": "TALK_MISSION_SUCCESS", - "condition": { "and": [ "mission_complete", { "mission_goal": "ASSASSINATE" } ] }, - "switch": true + "condition": { "and": [ "mission_complete", { "mission_goal": "MGOAL_ASSASSINATE" } ] }, + "switch": true, + "effect": "mission_success" }, { "text": "I killed it.", "topic": "TALK_MISSION_SUCCESS", - "condition": { "and": [ "mission_complete", { "mission_goal": "KILL_MONSTER" } ] }, - "switch": true + "condition": { "and": [ "mission_complete", { "mission_goal": "MGOAL_KILL_MONSTER" } ] }, + "switch": true, + "effect": "mission_success" }, { "text": "I killed them. All of them.", "topic": "TALK_MISSION_SUCCESS", "condition": { - "and": [ { "or": [ { "mission_goal": "KILL_MONSTER_SPEC" }, { "mission_goal": "KILL_MONSTER_TYPE" } ] }, "mission_complete" ] + "and": [ + { "or": [ { "mission_goal": "MGOAL_KILL_MONSTER_SPEC" }, { "mission_goal": "MGOAL_KILL_MONSTER_TYPE" } ] }, + "mission_complete" + ] }, - "switch": true + "switch": true, + "effect": "mission_success" }, { "text": "I brought 'em.", "topic": "TALK_MISSION_SUCCESS", - "condition": { "and": [ "mission_complete", { "mission_goal": "RECRUIT_NPC" }, { "mission_goal": "RECRUIT_NPC_CLASS" } ] }, - "switch": true + "condition": { + "and": [ "mission_complete", { "mission_goal": "MGOAL_RECRUIT_NPC" }, { "mission_goal": "MGOAL_RECRUIT_NPC_CLASS" } ] + }, + "switch": true, + "effect": "mission_success" }, { "text": "I've taken care of it", "topic": "TALK_MISSION_SUCCESS", - "condition": { "and": [ "mission_complete", { "mission_goal": "COMPUTER_TOGGLE" } ] }, - "switch": true + "condition": { "and": [ "mission_complete", { "mission_goal": "MGOAL_COMPUTER_TOGGLE" } ] }, + "switch": true, + "effect": "mission_success" }, { "text": "Mission success! I don't know what else to say.", "topic": "TALK_MISSION_SUCCESS", "condition": "mission_complete", "switch": true, - "default": true + "default": true, + "effect": "mission_success" } ] }, @@ -223,10 +240,12 @@ "responses": [ { "text": "Glad to help. I need no payment.", - "topic": "TALK_NONE", - "effect": "clear_mission", - "mission_opinion": { "trust": 4, "value": 3 }, - "opinion": { "fear": -1, "anger": -1 } + "success": { + "topic": "TALK_NONE", + "effect": "clear_mission", + "mission_opinion": { "trust": 4, "value": 3 }, + "opinion": { "fear": -1, "anger": -1 } + } }, { "text": "How about some items as payment?", @@ -237,15 +256,16 @@ { "text": "Maybe you can teach me something as payment?", "topic": "TALK_TRAIN", - "condition": { "or": [ "npc_train_skills", "npc_train_styles" ] }, - "effect": "mission_reward" + "condition": { "or": [ "npc_train_skills", "npc_train_styles" ] } }, { "text": "Glad to help. I need no payment. Bye!", - "topic": "TALK_DONE", - "effect": "clear_mission", - "mission_opinion": { "trust": 4, "value": 3 }, - "opinion": { "fear": -1, "anger": -1 } + "success": { + "topic": "TALK_DONE", + "effect": "clear_mission", + "mission_opinion": { "trust": 4, "value": 3 }, + "opinion": { "fear": -1, "anger": -1 } + } } ] }, diff --git a/data/json/npcs/TALK_COMMON_OTHER.json b/data/json/npcs/TALK_COMMON_OTHER.json index bf4abb3e2b435..b1abc4e6ea39d 100644 --- a/data/json/npcs/TALK_COMMON_OTHER.json +++ b/data/json/npcs/TALK_COMMON_OTHER.json @@ -291,7 +291,7 @@ "text": "I'll give it back!", "switch": true, "default": true, - "trial": { "type": "LIE", "difficulty": 10, "mod": [ [ "TRUST", 2 ], [ "VALUE", 5 ], [ "ALTRUISM", 3 ] ] }, + "trial": { "type": "LIE", "difficulty": 0, "mod": [ [ "TRUST", 2 ], [ "VALUE", 5 ], [ "ALTRUISM", 3 ] ] }, "success": { "topic": "TALK_GIVE_EQUIPMENT", "effect": [ { "add_debt": [ [ "TRUST", 1 ], [ "VALUE", 3 ], [ "ALTRUISM", 2 ], [ "TOTAL", 300 ] ] }, "give_equipment" ], diff --git a/src/npctalk.cpp b/src/npctalk.cpp index c2db000d68690..a402ea98ed576 100644 --- a/src/npctalk.cpp +++ b/src/npctalk.cpp @@ -1661,11 +1661,13 @@ void talk_effect_t::set_effect( talkfunction_ptr ptr ) talk_topic talk_effect_t::apply( dialogue &d ) const { + // Need to get a reference to the mission before effects are applied, because effects can remove the mission + mission *miss = d.beta->chatbin.mission_selected; + for( const talk_effect_fun_t &effect: effects ) { effect( d ); } d.beta->op_of_u += opinion; - mission *miss = d.beta->chatbin.mission_selected; if( miss && ( mission_opinion.trust || mission_opinion.fear || mission_opinion.value || mission_opinion.anger ) ) { int m_value = cash_to_favor( *d.beta, miss->get_value() );