Skip to content

Commit

Permalink
Merge pull request #7085 from mdr55/CT-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
MahtraDR authored Jan 31, 2025
2 parents 382b780 + 9ca4990 commit 5842c41
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions combat-trainer.lic
Original file line number Diff line number Diff line change
Expand Up @@ -1312,7 +1312,6 @@ class SpellProcess

@magic_last_spell = nil
@magic_last_exp = -1
@magic_last_exp_sorc = -1

@magic_gain_check = settings.combat_trainer_magic_gain_check
echo(" @magic_gain_check: #{@magic_gain_check}") if $debug_mode_ct
Expand Down Expand Up @@ -1875,6 +1874,7 @@ class SpellProcess
echo 'Preparing a sorcery spell, held items will be stowed to prevent item loss' if $debug_mode_ct
game_state.casting_sorcery = true
end

prepare_spell(data, game_state)
Flags.reset('ct-spelllost')
end
Expand Down Expand Up @@ -2097,7 +2097,7 @@ class SpellProcess
echo "Blacklisting non-training spells:" if $debug_mode_ct

# if there has been no gain from last cast, and its been flagged with cast_only_to_train its a little black cross against the skill
if (DRSkill.getxp(@magic_last_spell['skill']) <= @magic_last_exp) && @magic_last_spell['cast_only_to_train'] && (DRSkill.getxp(@magic_last_spell['skill']) < 34)
if (DRSkill.getxp(@magic_last_spell['skill']) <= @magic_last_exp) && (@magic_last_spell['cast_only_to_train'] || @cast_only_to_train) && (DRSkill.getxp(@magic_last_spell['skill']) < 34)
@magic_no_gain_list[@magic_last_spell['skill']] += 1
else
@magic_no_gain_list[@magic_last_spell['skill']] = 0
Expand All @@ -2109,6 +2109,10 @@ class SpellProcess
DRC.message("WARNING: Suppressing #{@magic_last_spell['skill']} due to cast_only_to_train spells within that skill not gaining mindstates.")
@offensive_spells.reject! { |spell| spell['skill'] == @magic_last_spell['skill'] }
end

# clear magic_gain_check variables and wait for them to be set by the next applicable casting def (OST only at this point)
@magic_last_spell = nil
@magic_last_exp = -1
end

def check_offensive(game_state)
Expand Down

0 comments on commit 5842c41

Please sign in to comment.