Skip to content

Commit

Permalink
Merge pull request #7100 from mdr55/CT-conditional-nonspellbuffs
Browse files Browse the repository at this point in the history
[script][combat-trainer] Arbitrary condition checks for non-spell buffs
  • Loading branch information
MahtraDR authored Feb 12, 2025
2 parents 5e7a6b1 + 529401d commit 0068ef8
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions combat-trainer.lic
Original file line number Diff line number Diff line change
Expand Up @@ -2710,13 +2710,23 @@ class AbilityProcess
end

def check_nonspell_buffs(game_state)
@buffs.each do |action, cooldown|
@buffs.each do |action, blob|
timer = game_state.cooldown_timers[action]

# break apart the blob into OG cooldown timer and the new optional conditional string using a fake && as a delimiter
blob_array = blob.to_s.split(/ && /, 2)
cooldown = blob_array[0].to_i
conditional = blob_array[1][1..-2] # strip out the leading and following double quotes

next unless !timer || (Time.now - timer).to_i > cooldown

game_state.cooldown_timers[action] = Time.now
fput action
waitrt?

# do action if there is no conditional (OG behaviour), or do action if there is a conditional and it evaluated as true
if conditional.nil? || (conditional && eval(conditional))
fput action
waitrt?
end
end

@khri
Expand Down

0 comments on commit 0068ef8

Please sign in to comment.