Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix NPC dialog around lying and succeeding mission #27972

Merged
merged 2 commits into from
Feb 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 58 additions & 38 deletions data/json/npcs/TALK_COMMON_MISSION.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
]
},
Expand All @@ -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?",
Expand All @@ -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" ] }
paroid01 marked this conversation as resolved.
Show resolved Hide resolved
},
{
"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 }
}
}
]
},
Expand Down
2 changes: 1 addition & 1 deletion data/json/npcs/TALK_COMMON_OTHER.json
Original file line number Diff line number Diff line change
Expand Up @@ -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" ],
Expand Down
4 changes: 3 additions & 1 deletion src/npctalk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() );
Expand Down