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

[Xedra Evolved] Rubik dialogue about Jotunn quads #68311

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 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
14 changes: 14 additions & 0 deletions data/mods/Xedra_Evolved/achievements/achievements.json
Original file line number Diff line number Diff line change
Expand Up @@ -225,5 +225,19 @@
"stat_type": "count",
"event_transformation": "avatar_gains_deduction_level_5",
"description": { "str_sp": "Investigation skill level 5 gained" }
},
{
"id": "achievement_find_border_patrol_office",
"type": "achievement",
"name": "Do borders even matter now?",
"requirements": [
{
"event_statistic": "last_oter_type_avatar_entered",
"is": "==",
"target": [ "oter_type_str_id", "field_office_3" ],
"visible": "when_achievement_completed",
"description": "Enter a Border Patrol Office"
}
]
}
]
84 changes: 83 additions & 1 deletion src/avatar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,89 @@ void avatar::memorize_clear_decoration( const tripoint_abs_ms &p, std::string_vi
player_map_memory->clear_tile_decoration( p, prefix );
}

std::vector<mission *> avatar::get_active_missions() const
std::vector<achievement *> avatar::has_achievement() const
{
std::vector<achievement *> ret;
for( auto &elem : achievements ) {
Maleclypse marked this conversation as resolved.
Show resolved Hide resolved
if( elem.second ) {
ret.push_back( elem.second.get() );
}
}
return ret;
}

void avatar::gain_achievement( const std::string &id )
{
if( has_achievement( id ) ) {
return;
}
achievements[id] = std::make_unique<achievement>( id );
}

bool avatar::has_achievement( const std::string &id ) const
{
return achievements.count( id ) > 0;
}

void avatar::set_achievement( const std::string &id, const bool achieved )
{
if( !has_achievement( id ) ) {
return;
}
achievements[id]->set_achieved( achieved );
}

void avatar::set_achievement( const std::string &id, const int progress )
{
if( !has_achievement( id ) ) {
return;
}
achievements[id]->set_progress( progress );
}

void avatar::set_achievement( const std::string &id, const std::string &progress )
{
if( !has_achievement( id ) ) {
return;
}
achievements[id]->set_progress( progress );
}

void avatar::set_achievement( const std::string &id, const std::string &progress,
const bool achieved )
{
if( !has_achievement( id ) ) {
return;
}
achievements[id]->set_progress( progress );
achievements[id]->set_achieved( achieved );
}

void avatar::set_achievement( const std::string &id, const int progress,
const bool achieved )
{
if( !has_achievement( id ) ) {
return;
}
achievements[id]->set_progress( progress );
achievements[id]->set_achieved( achieved );
}

void avatar::set_achievement( const std::string &id, const std::string &progress,
const std::string &progress_max, const bool achieved )
{
if( !has_achievement( id ) ) {
return;
}
achievements[id]->set_progress( progress );
achievements[id]->set_progress_max( progress_max );
achievements[id]->set_achieved( achieved );
}

void avatar::set_achievement( const std::string &id, const int progress,
const int progress_max

std::vector<mission *> avatar::get_active_missions() const
{
return active_missions;
}
Expand Down
10 changes: 10 additions & 0 deletions src/condition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,14 @@ void conditional_t::set_u_has_mission( const JsonObject &jo, const std::string &
};
}

void conditional_t::set_u_has_achievement( const JsonObject &jo, const std::string &member )
{
str_or_var u_achievement = get_str_or_var( jo.get_member( member ), member, true );
condition = [u_achievement]( dialogue const & d ) {
return get_avatar().has_achievement( achievement_id( u_achievement.evaluate( d ) ) );
};
}

void conditional_t::set_u_monsters_in_direction( const JsonObject &jo,
const std::string &member )
{
Expand Down Expand Up @@ -3279,6 +3287,8 @@ conditional_t::conditional_t( const JsonObject &jo )
set_is_riding( is_npc );
} else if( jo.has_member( "u_has_mission" ) ) {
set_u_has_mission( jo, "u_has_mission" );
} else if( jo.has_member( "u_has_achievement" ) ) {
set_u_has_achievement( jo, "u_has_achievement" );
} else if( jo.has_member( "u_monsters_in_direction" ) ) {
set_u_monsters_in_direction( jo, "u_monsters_in_direction" );
} else if( jo.has_member( "u_safe_mode_trigger" ) ) {
Expand Down
1 change: 1 addition & 0 deletions src/condition.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ struct conditional_t {
void set_is_riding( bool is_npc = false );
void set_npc_has_class( const JsonObject &jo, const std::string &member, bool is_npc );
void set_u_has_mission( const JsonObject &jo, const std::string &member );
void set_u_has_achievement( const JsonObject &jo, const std::string &member );
void set_u_monsters_in_direction( const JsonObject &jo, const std::string &member );
void set_u_safe_mode_trigger( const JsonObject &jo, const std::string &member );
void set_has_strength( const JsonObject &jo, const std::string &member, bool is_npc = false );
Expand Down