From 90bd793227f02c83c20286091ab363832c99ea52 Mon Sep 17 00:00:00 2001 From: 1n17 <59138068+1n17@users.noreply.github.com> Date: Mon, 20 Jan 2020 07:49:44 +0100 Subject: [PATCH] [MOD] INT Based Learning (#37075) --- data/json/game_balance.json | 7 +++++++ data/mods/intbasedlearning/modinfo.json | 22 ++++++++++++++++++++++ src/avatar.cpp | 4 ++++ src/player.cpp | 3 +++ 4 files changed, 36 insertions(+) create mode 100644 data/mods/intbasedlearning/modinfo.json diff --git a/data/json/game_balance.json b/data/json/game_balance.json index c75869e9be708..df8a8a0226738 100644 --- a/data/json/game_balance.json +++ b/data/json/game_balance.json @@ -194,5 +194,12 @@ "info": "Stats through Kills. A mod that allows your stats to increase by killing zombies.", "stype": "bool", "value": false + }, + { + "type": "EXTERNAL_OPTION", + "name": "INT_BASED_LEARNING", + "info": "INT Based Learning mod. Enables rebalance of practice and reading gains.", + "stype": "bool", + "value": false } ] diff --git a/data/mods/intbasedlearning/modinfo.json b/data/mods/intbasedlearning/modinfo.json new file mode 100644 index 0000000000000..7a1bb54a30d38 --- /dev/null +++ b/data/mods/intbasedlearning/modinfo.json @@ -0,0 +1,22 @@ +[ + { + "type": "MOD_INFO", + "ident": "intbasedlearning", + "name": "INT Based Learning", + "authors": [ "1n17" ], + "maintainers": [ "1n17" ], + "description": "Learning through practice and reading is highly dependent on INT and focus. Respective traits are disabled.", + "category": "rebalance", + "dependencies": [ "dda" ] + }, + { + "type": "EXTERNAL_OPTION", + "name": "INT_BASED_LEARNING", + "stype": "bool", + "value": true + }, + { + "type": "TRAIT_BLACKLIST", + "traits": [ "SLOWLEARNER", "FASTLEARNER" ] + } +] diff --git a/src/avatar.cpp b/src/avatar.cpp index dd71f8450ea96..16f13562d92e1 100644 --- a/src/avatar.cpp +++ b/src/avatar.cpp @@ -776,6 +776,10 @@ void avatar::do_read( item &book ) if( has_active_bionic( bio_memory ) ) { min_ex += 2; } + if( get_option( "INT_BASED_LEARNING" ) ) { + min_ex = adjust_for_focus( min_ex ); + max_ex = adjust_for_focus( max_ex ); + } if( max_ex < 2 ) { max_ex = 2; } diff --git a/src/player.cpp b/src/player.cpp index 47ffe2eb7a81f..3603aba2ecf46 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -5575,6 +5575,9 @@ int player::adjust_for_focus( int amount ) const if( has_trait( trait_SLOWLEARNER ) ) { effective_focus -= 15; } + if( get_option( "INT_BASED_LEARNING" ) ) { + effective_focus += ( get_int_base() - 8 ) * 5; + } double tmp = amount * ( effective_focus / 100.0 ); return roll_remainder( tmp ); }