Skip to content

Commit

Permalink
feat: make max skill level limit configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
scarf005 committed Jan 27, 2025
1 parent 77d7938 commit 053f910
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 6 deletions.
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 = 10;

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 @@ -3793,7 +3793,7 @@ void Character::practice( const skill_id &id, int amount, int cap, bool suppress

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 @@ void Character::on_hit( Creature *source, bodypart_id bp_hit,
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

0 comments on commit 053f910

Please sign in to comment.