@@ -31,6 +31,9 @@ class SetupProcess
31
31
echo(" @ignore_weapon_mindstate: #{@ignore_weapon_mindstate}") if $debug_mode_ct
32
32
@gearsets = settings.gear_sets
33
33
34
+ @offhand_trainables = settings.combat_trainer_offhand_trainables
35
+ echo(" @offhand_trainables: #{@offhand_trainables}") if $debug_mode_ct
36
+
34
37
validate_regalia(settings)
35
38
end
36
39
@@ -188,7 +191,49 @@ class SetupProcess
188
191
189
192
# Exclude current skill so that a new one is selected.
190
193
new_weapon_skills = weapon_training.keys.reject { |skill| skill == game_state.weapon_skill }
191
- new_weapon_skill = game_state.sort_by_rate_then_rank(new_weapon_skills, @priority_weapons).first
194
+
195
+ # optional & advanced feature:
196
+ # offhand_trainables is used to preference bows first, and aiming_trainables in mainhand last, to indirectly force
197
+ # aiming_trainables to be used in the offhand rather than pushing out the training for mainhand only weapons.
198
+ # It is only active when focus_threshold is active, after all the mindstates are off zero and have a drain buffer.
199
+ # There are three selection pools, one for bows, one for mainhand and one for aiming_trainables in mainhand, and skill is chosen
200
+ # preferentially in that order
201
+ # Each selection pool has a threshold that is needed to "break out" of a selection pool. e.g. when all bow weapons are > 30
202
+ # the code will move onto the mainhand selection pool.
203
+ # 30 is a magic number and there are multiple factors determining what would be an optimal value, which may not practically
204
+ # exist for the wide range of CT use cases.
205
+
206
+ if @offhand_trainables && game_state.focus_threshold_active
207
+
208
+ # define what mainhand skills look like
209
+ mainhand_skills = $melee_skills + $thrown_skills + $martial_skills - game_state.aiming_trainables
210
+
211
+ # create selection pools of bow/mainhand/offhand groupings
212
+ bow_selection_pool = new_weapon_skills.select { |skill| $aim_skills.include?(skill) && DRSkill.getxp(skill) < 30 }
213
+ mainhand_selection_pool = new_weapon_skills.select { |skill| mainhand_skills.include?(skill) && DRSkill.getxp(skill) < 30 }
214
+ offhand_selection_pool = new_weapon_skills.select { |skill| game_state.aiming_trainables.include?(skill) && DRSkill.getxp(skill) < 30 }
215
+
216
+ echo("bow_selection_pool #{bow_selection_pool}") if $debug_mode_ct
217
+ echo("mainhand_selection_pool #{mainhand_selection_pool}") if $debug_mode_ct
218
+ echo("offhand_selection_pool #{offhand_selection_pool}") if $debug_mode_ct
219
+
220
+ if bow_selection_pool.length > 0
221
+ # choose a bow from this restricted pool (i.e. preferencing bow)
222
+ new_weapon_skill = game_state.sort_by_rate_then_rank(bow_selection_pool).first
223
+ elsif mainhand_selection_pool.length > 0
224
+ # choose a mainhander from this restricted pool (once bows are done)
225
+ new_weapon_skill = game_state.sort_by_rate_then_rank(mainhand_selection_pool).first
226
+ elsif offhand_selection_pool.length > 0
227
+ # choose an offhand weapon (wielded in the main hand) from this restricted pool
228
+ new_weapon_skill = game_state.sort_by_rate_then_rank(offhand_selection_pool).first
229
+ else
230
+ # use normal selection method as a default when everything is above 30 as maintenance
231
+ new_weapon_skill = game_state.sort_by_rate_then_rank(new_weapon_skills, @priority_weapons).first
232
+ end
233
+ else
234
+ # normal selection method
235
+ new_weapon_skill = game_state.sort_by_rate_then_rank(new_weapon_skills, @priority_weapons).first
236
+ end
192
237
193
238
# Update weapon skill to train next, if a new one was chosen.
194
239
# If you're training exactly one weapon then won't change.
0 commit comments