Skip to content

Commit

Permalink
Fix some more mission completion dialog bugs
Browse files Browse the repository at this point in the history
Putting the clear_mission effect into the success section of the JSON
seems to be required. Also the clear_mission effect was removing a
mission reference before the opinion modifiers could be applied.
Also, choosing training for a mission reward will automatically clear
the mission, and if the JSON forces it to clear with an effect, the
player has to pay for the training.

references CleverRaven#27972
references CleverRaven#27983
  • Loading branch information
mscarter committed Feb 1, 2019
1 parent a11526b commit af61c23
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
20 changes: 13 additions & 7 deletions data/json/npcs/TALK_COMMON_MISSION.json
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,12 @@
"responses": [
{
"text": "Glad to help. I need no payment.",
"effect": "clear_mission",
"success": { "topic": "TALK_NONE", "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 @@ -252,14 +256,16 @@
{
"text": "Maybe you can teach me something as payment?",
"topic": "TALK_TRAIN",
"condition": { "or": [ "npc_train_skills", "npc_train_styles" ] },
"effect": "clear_mission"
"condition": { "or": [ "npc_train_skills", "npc_train_styles" ] }
},
{
"text": "Glad to help. I need no payment. Bye!",
"topic": "TALK_DONE",
"effect": "clear_mission",
"success": { "topic": "TALK_DONE", "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
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

0 comments on commit af61c23

Please sign in to comment.