Skip to content

Commit

Permalink
Ambush stun enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
rcuhljr committed Jul 1, 2016
1 parent 81ca2cd commit 8818940
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 8 deletions.
40 changes: 38 additions & 2 deletions combat-trainer.lic
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,8 @@ class SpellProcess
name, data = recastable_buffs.find do |name, data|
if data['recast_every']
check_spell_timer(data)
elsif data['expire'] && Flags["ct-#{name}"]
true
else
!DRSpells.active_spells[name] || DRSpells.active_spells[name].to_i <= data['recast']
end
Expand Down Expand Up @@ -818,7 +820,7 @@ class TrainerProcess
'Perc' => 'Attunement', 'Astro' => 'Astrology', 'App' => 'Appraisal',
'App Quick' => 'Appraisal', 'App Careful' => 'Appraisal', 'Tactics' => 'Tactics',
'Scream' => 'Bardic Lore', 'Perc Health' => 'Empathy', 'Khri Prowess' => 'Debilitation',
'Stealth' => 'Stealth' }
'Stealth' => 'Stealth', 'Ambush Stun' => 'Debilitation' }

@no_app = []
end
Expand Down Expand Up @@ -855,13 +857,40 @@ class TrainerProcess
pause
waitrt?
fput('stalk') if checkhidden
when 'Ambush Stun'
return ambush_stun(game_state)
end
waitrt?
false
end

private

def ambush_stun(game_state)
return unless game_state.can_ambush_stun
return if game_state.npcs.empty?
dead_count = DRRoom.dead_npcs.size

EquipmentManager.instance.stow_weapon(game_state.weapon_name)
EquipmentManager.instance.wield_weapon(game_state.ambush_stun_weapon, ['Small Blunt'])

unless checkhidden
fput('hide')
pause
waitrt?
end
fput('stalk')
pause
waitrt?
return unless checkhidden
bput('Ambush stun', 'You don\'t have enough focus', 'Roundtime')
waitrt?

EquipmentManager.instance.stow_weapon(game_state.ambush_stun_weapon)
EquipmentManager.instance.wield_weapon(game_state.weapon_name, game_state.weapon_skill)
DRRoom.dead_npcs.size > dead_count
end

def appraise(game_state, modifier)
return if game_state.retreating?
return if game_state.npcs.empty?
Expand Down Expand Up @@ -1203,7 +1232,7 @@ class GameState
$aim_skills = %w(Bow Slings Crossbow)
$ranged_skills = $thrown_skills + $aim_skills

attr_accessor :mob_died, :last_weapon_skill, :danger, :parrying, :casting, :need_bundle, :cooldown_timers, :no_stab_current_mob, :loaded, :selected_maneuver, :cast_timer, :casting_moonblade
attr_accessor :mob_died, :last_weapon_skill, :danger, :parrying, :casting, :need_bundle, :cooldown_timers, :no_stab_current_mob, :loaded, :selected_maneuver, :cast_timer, :casting_moonblade, :can_ambush_stun

def initialize(settings)
echo('New GameState') if $debug_mode_ct
Expand Down Expand Up @@ -1270,6 +1299,9 @@ class GameState
@weapons_to_train = settings.weapon_training({})
echo(" @weapons_to_train: #{@weapons_to_train}") if $debug_mode_ct

@can_ambush_stun = @weapons_to_train['Small Blunt']
echo(" @can_ambush_stun: #{@can_ambush_stun}") if $debug_mode_ct

@use_stealth_attacks = settings.use_stealth_attacks(false)
echo(" @use_stealth_attacks: #{@use_stealth_attacks}") if $debug_mode_ct

Expand Down Expand Up @@ -1334,6 +1366,10 @@ class GameState
@clean_up_step == 'done'
end

def ambush_stun_weapon
@weapons_to_train['Small Blunt']
end

def update_weapon_info(weapon_skill)
@last_weapon_skill = @current_weapon_skill
@current_weapon_skill = weapon_skill
Expand Down
12 changes: 6 additions & 6 deletions crossing-training.lic
Original file line number Diff line number Diff line change
Expand Up @@ -1065,7 +1065,7 @@ class CrossingTraining

def train_outfitting
if @settings.train_workorders([]).include?('Tailoring')
return unless check_money_for_training(5000, 'Outfitting')
return unless have_money_for_training?(5000, 'Outfitting')
wait_for_script_to_complete('workorders', ['Tailoring'])
wait_for_script_to_complete('sell-loot')
return
Expand All @@ -1092,7 +1092,7 @@ class CrossingTraining
end

def train_engineering
return unless check_money_for_training(5000, 'Engineering')
return unless have_money_for_training?(5000, 'Engineering')
wait_for_script_to_complete('workorders', ['Shaping'])
wait_for_script_to_complete('sell-loot')
end
Expand All @@ -1110,15 +1110,15 @@ class CrossingTraining

discipline = disciplines.min_by { |s| DRSkill.getxp(@disciplines_to_skill[s]) }

return unless check_money_for_training(5000, 'Trading')
return unless have_money_for_training?(5000, 'Trading')
wait_for_script_to_complete('workorders', [discipline])
wait_for_script_to_complete('sell-loot')
end

# https://elanthipedia.play.net/mediawiki/index.php/Blacksmithing_Products
def train_forging
if @settings.train_workorders([]).include?('Blacksmithing')
return unless check_money_for_training(5000, 'Forging')
return unless have_money_for_training?(5000, 'Forging')
wait_for_script_to_complete('workorders', ['Blacksmithing'])
wait_for_script_to_complete('sell-loot')
return
Expand Down Expand Up @@ -1157,7 +1157,7 @@ class CrossingTraining
end
end

def check_money_for_training(amount, skill)
def have_money_for_training?(amount, skill)
if ensure_copper_on_hand(amount)
true
else
Expand Down Expand Up @@ -1186,7 +1186,7 @@ class CrossingTraining
end

def buy_yarn
return unless check_money_for_training(700, 'Outfitting')
return unless have_money_for_training?(700, 'Outfitting')
walk_to 16_667
fput('order 13')
fput('order 13')
Expand Down

0 comments on commit 8818940

Please sign in to comment.