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

feat(UI): make max skill level limit configurable #5999

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions src/cached_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ int fov_3d_z_range;
bool tile_iso;
bool pixel_minimap_option = false;
int PICKUP_RANGE;
int MAX_SKILL;

FungalOptions fungal_opt;

Expand Down
2 changes: 2 additions & 0 deletions src/cached_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ extern int PICKUP_RANGE;
*/
extern bool dont_debugmsg;

// Maximum (effective) level for a skill.
extern int MAX_SKILL;

/* Options related to fungal activity */
struct FungalOptions {
Expand Down
3 changes: 1 addition & 2 deletions src/character.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -613,8 +613,8 @@
}

Character::Character( Character &&source ) noexcept : Creature( std::move( source ) ),
worn( new worn_item_location( this ) ),

Check warning on line 616 in src/character.cpp

View workflow job for this annotation

GitHub Actions / build

missing exception handler for allocation failure at 'new' [bugprone-unhandled-exception-at-new]
inv( new character_item_location( this ) )

Check warning on line 617 in src/character.cpp

View workflow job for this annotation

GitHub Actions / build

missing exception handler for allocation failure at 'new' [bugprone-unhandled-exception-at-new]
{
move_operator_common( std::move( source ) );
}
Expand Down Expand Up @@ -3793,7 +3793,7 @@

if( !level.can_train() && !in_sleep_state() ) {
// If leveling is disabled, don't train, don't drain focus, don't print anything
// This also checks if your skill level is maxed out at the cap of 10.
// This also checks if your skill level is maxed out.
return;
}

Expand Down Expand Up @@ -8764,7 +8764,6 @@
bool in_skater_vehicle = in_vehicle && veh_part.part_with_feature( "SEAT_REQUIRES_BALANCE", false );

if( ( worn_with_flag( flag_REQUIRES_BALANCE ) || in_skater_vehicle ) && !is_on_ground() ) {
int rolls = 4;
if( worn_with_flag( flag_ROLLER_ONE ) && !in_skater_vehicle ) {
if( worn_with_flag( flag_REQUIRES_BALANCE ) && !has_effect( effect_downed ) ) {
int rolls = 4;
Expand Down
3 changes: 0 additions & 3 deletions src/game_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,6 @@ static constexpr units::mass JACK_LIMIT = 8500_kilogram;
// Slowest speed at which a gun can be aimed.
static constexpr int MAX_AIM_COST = 10;

// Maximum (effective) level for a skill.
static constexpr int MAX_SKILL = 10;

// Maximum (effective) level for a stat.
static constexpr int MAX_STAT = 20;

Expand Down
6 changes: 6 additions & 0 deletions src/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2226,6 +2226,11 @@ void options_manager::add_options_debug()
0.0, 100.0, 1.0, 0.1
);

add( "MAX_SKILL_LEVEL", debug, translate_marker( "Max Skill Level" ),
translate_marker( "The maximum level a skill can be trained to." ),
0, 1000, 10
);

add( "SKILL_RUST", debug, translate_marker( "Skill rust" ),
translate_marker( "Set the level of skill rust. Vanilla: Vanilla Cataclysm - Capped: Capped at skill levels 2 - Int: Intelligence dependent - IntCap: Intelligence dependent, capped - Off: None at all." ),
//~ plain, default, normal
Expand Down Expand Up @@ -3448,6 +3453,7 @@ void options_manager::cache_to_globals()
fov_3d_z_range = ::get_option<int>( "FOV_3D_Z_RANGE" );
static_z_effect = ::get_option<bool>( "STATICZEFFECT" );
PICKUP_RANGE = ::get_option<int>( "PICKUP_RANGE" );
MAX_SKILL = ::get_option<int>( "MAX_SKILL_LEVEL" );

merge_comestible_mode = ( [] {
const auto opt = ::get_option<std::string>( "MERGE_COMESTIBLES" );
Expand Down
2 changes: 1 addition & 1 deletion src/skill.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include "cata_utility.h"
#include "debug.h"
#include "game_constants.h"
#include "cached_options.h"
#include "item.h"
#include "json.h"
#include "options.h"
Expand Down
8 changes: 5 additions & 3 deletions tests/throwing_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,12 @@ static void test_throwing_player_versus(
CHECK( dmg_thresh_met );
}

constexpr int DEFAULT_MAX_SKILL = 10;

constexpr throw_test_pstats lo_skill_base_stats = { 0, 8, 8, 8 };
constexpr throw_test_pstats mid_skill_base_stats = { MAX_SKILL / 2, 8, 8, 8 };
constexpr throw_test_pstats hi_skill_base_stats = { MAX_SKILL, 8, 8, 8 };
constexpr throw_test_pstats hi_skill_athlete_stats = { MAX_SKILL, 12, 12, 12 };
constexpr throw_test_pstats mid_skill_base_stats = { DEFAULT_MAX_SKILL / 2, 8, 8, 8 };
constexpr throw_test_pstats hi_skill_base_stats = { DEFAULT_MAX_SKILL, 8, 8, 8 };
constexpr throw_test_pstats hi_skill_athlete_stats = { DEFAULT_MAX_SKILL, 12, 12, 12 };

TEST_CASE( "basic_throwing_sanity_tests", "[throwing],[balance]" )
{
Expand Down
Loading