Skip to content

Commit 56d2ddf

Browse files
authored
Merge pull request #7073 from mdr55/CT-offhand-trainables
[script][combat-trainer] YACTOM: "offhand_trainables"
2 parents ae152f0 + 9dceaa5 commit 56d2ddf

File tree

2 files changed

+50
-1
lines changed

2 files changed

+50
-1
lines changed

combat-trainer.lic

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ class SetupProcess
3131
echo(" @ignore_weapon_mindstate: #{@ignore_weapon_mindstate}") if $debug_mode_ct
3232
@gearsets = settings.gear_sets
3333

34+
@offhand_trainables = settings.combat_trainer_offhand_trainables
35+
echo(" @offhand_trainables: #{@offhand_trainables}") if $debug_mode_ct
36+
3437
validate_regalia(settings)
3538
end
3639

@@ -188,7 +191,49 @@ class SetupProcess
188191

189192
# Exclude current skill so that a new one is selected.
190193
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
192237

193238
# Update weapon skill to train next, if a new one was chosen.
194239
# If you're training exactly one weapon then won't change.

profiles/base.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,10 +381,14 @@ combat_trainer_ignore_weapon_mindstate: false
381381
combat_trainer_target_increment: 3
382382
# how many actions to do if you dont hit the mindstate goal before swapping weapons
383383
combat_trainer_action_count: 10
384+
# Optional feature to preference using aiming_trainables on the offhand ONLY, to reduce competition from aiming_trainables using mainhand attacks
385+
# It is contingent on combat_trainer_focus_threshold being active.
386+
combat_trainer_offhand_trainables: false
384387
# minimum mindstate threshold (for all weapons being trained) to begin focussing on single weapons to minimise weapon switching.
385388
# default is 0 which means feature is not active. Change to 10 or higher to activate.
386389
combat_trainer_focus_threshold: 0
387390

391+
388392
dual_load: false
389393
# use_stealth_attacks true will train stealth by hiding and attacking/backstabbing from stealth. Thieves also use backstab: below
390394
use_stealth_attacks: false

0 commit comments

Comments
 (0)