Skip to content

Commit

Permalink
Mainline INT based learning changes (#37465)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhilkinSerg committed Jan 29, 2020
1 parent 0f3aa32 commit 9d46c12
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 21 deletions.
15 changes: 11 additions & 4 deletions data/json/game_balance.json
Expand Up @@ -190,9 +190,16 @@
},
{
"type": "EXTERNAL_OPTION",
"name": "INT_BASED_LEARNING",
"info": "INT Based Learning mod. Enables rebalance of practice and reading gains.",
"stype": "bool",
"value": false
"name": "INT_BASED_LEARNING_BASE_VALUE",
"info": "The amount of INT which is used as base point for focus adjustments",
"stype": "int",
"value": 8
},
{
"type": "EXTERNAL_OPTION",
"name": "INT_BASED_LEARNING_FOCUS_ADJUSTMENT",
"info": "The amount of focus gained per each INT point above INT_BASED_LEARNING_BASE_VALUE",
"stype": "int",
"value": 5
}
]
10 changes: 0 additions & 10 deletions data/mods/intbasedlearning/modinfo.json
Expand Up @@ -9,15 +9,5 @@
"category": "rebalance",
"dependencies": [ "dda" ],
"obsolete": true
},
{
"type": "EXTERNAL_OPTION",
"name": "INT_BASED_LEARNING",
"stype": "bool",
"value": true
},
{
"type": "TRAIT_BLACKLIST",
"traits": [ "SLOWLEARNER", "FASTLEARNER" ]
}
]
8 changes: 4 additions & 4 deletions src/avatar.cpp
Expand Up @@ -743,10 +743,10 @@ void avatar::do_read( item &book )
if( has_active_bionic( bio_memory ) ) {
min_ex += 2;
}
if( get_option<bool>( "INT_BASED_LEARNING" ) ) {
min_ex = adjust_for_focus( min_ex );
max_ex = adjust_for_focus( max_ex );
}

min_ex = adjust_for_focus( min_ex );
max_ex = adjust_for_focus( max_ex );

if( max_ex < 2 ) {
max_ex = 2;
}
Expand Down
5 changes: 2 additions & 3 deletions src/player.cpp
Expand Up @@ -4578,9 +4578,8 @@ int player::adjust_for_focus( int amount ) const
if( has_trait( trait_SLOWLEARNER ) ) {
effective_focus -= 15;
}
if( get_option<bool>( "INT_BASED_LEARNING" ) ) {
effective_focus += ( get_int_base() - 8 ) * 5;
}
effective_focus += ( get_int_base() - get_option<int>( "INT_BASED_LEARNING_BASE_VALUE" ) ) *
get_option<int>( "INT_BASED_LEARNING_FOCUS_ADJUSTMENT" );
double tmp = amount * ( effective_focus / 100.0 );
return roll_remainder( tmp );
}
Expand Down

0 comments on commit 9d46c12

Please sign in to comment.