File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1616 glow!
1717 end
1818 end
19- # charges '>= 2' do
20- # glow!
21- # end
2219 end
23- # glow if cryopathy stacks >= 10?
24- #
2520 end
2621
2722 icon 'Ring of Fire' do
28- action_usable! do
23+ action_usable!
2924 end
3025
3126 action_usable 'Comet Storm'
Original file line number Diff line number Diff line change 3636 end
3737 action_usable 'Bladestorm'
3838 action_usable 'Wrecking Throw'
39- # TODO: cleave instead of MS display when more than N targets?
4039 action_usable 'Cleave'
41- # action_usable 'Whirlwind'
42-
43- # TODO: add `stacks` to glow! instead
44- # Min-maxing OP>MS is not recommended.
45- # action_usable 'Mortal Strike', if_stacks: { 'Overpower' => 2 } do
46- # glow!
47- # end
48- # action_usable 'Overpower' do
49- # glow! charges: 2
50- # end
5140
5241 action_usable [ 'Mortal Strike' , 'Overpower' ]
53- # action_usable 'Thunder Clap', requires: { target_debuffs_missing: ['Rend'] }
5442 action_usable 'Rend' , requires : { target_debuffs_missing : [ 'Rend' ] }
5543 action_usable 'Sweeping Strikes'
5644end
Original file line number Diff line number Diff line change @@ -215,15 +215,16 @@ def glow!(options = {}) # rubocop:disable Metrics/MethodLength
215215 end
216216
217217 if options [ :charges ]
218+ charges_value , charges_op = parse_operator ( options [ :charges ] )
218219 check = {
219220 "variable" : 'charges' ,
220- "op" : '==' ,
221- "value" : options [ :charges ] . to_s ,
221+ "op" : charges_op ,
222+ "value" : charges_value . to_s ,
222223 "trigger" : 1
223224 }
224225 end
225226
226- @conditions ||= { }
227+ @conditions ||= [ ]
227228 @conditions << {
228229 check : check ,
229230 changes : [
@@ -235,8 +236,28 @@ def glow!(options = {}) # rubocop:disable Metrics/MethodLength
235236 }
236237 end
237238
239+ def aura ( name , **options , &block )
240+ # Add an aura trigger for conditional logic
241+ options [ :parent_node ] = self
242+ trigger = Trigger ::Auras . new ( aura_names : name , **options )
243+ triggers << trigger
244+
245+ # Execute block in context of trigger for nested conditions
246+ trigger . instance_eval ( &block ) if block_given?
247+ trigger
248+ end
249+
250+ def parse_operator ( value )
251+ return [ value , '==' ] if value . is_a? ( Integer )
252+
253+ value_str = value . to_s
254+ operator = value_str . match ( /^[<>!=]+/ ) &.[]( 0 ) || '=='
255+ parsed_value = value_str . gsub ( /^[<>!=]+\s */ , '' ) . to_i
256+ [ parsed_value , operator ]
257+ end
258+
238259 def hide_ooc! # rubocop:disable Metrics/MethodLength
239- @conditions ||= { }
260+ @conditions ||= [ ]
240261 @conditions << {
241262 check : {
242263 trigger : -1 ,
Original file line number Diff line number Diff line change @@ -7,9 +7,10 @@ def all_triggers!
77 end
88
99 def action_usable! ( **kwargs , &block )
10- kwargs = { spell : id } . merge ( kwargs )
11- triggers << Trigger ::ActionUsable . new ( **kwargs )
12- block . call if block_given?
10+ kwargs = { spell : id , parent_node : self } . merge ( kwargs )
11+ trigger = Trigger ::ActionUsable . new ( **kwargs )
12+ triggers << trigger
13+ trigger . instance_eval ( &block ) if block_given?
1314 end
1415
1516 def as_json # rubocop:disable Metrics/MethodLength,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
Original file line number Diff line number Diff line change @@ -20,13 +20,30 @@ def parse_count_operator(count, default_operator = '==')
2020 end
2121
2222 def charges ( count_op , &block )
23- @options [ :charges ] = count_op
24- block . call if block_given?
23+ @options [ :charges ] = count_op
24+
25+ # Create a context for conditional logic
26+ if block_given?
27+ # Store the parent node context for glow! to work
28+ @parent_node = @options [ :parent_node ] if @options [ :parent_node ]
29+ instance_eval ( &block )
30+ end
2531 end
2632
2733 def stacks ( count_op , &block )
28- @options [ :stacks ] = count_op
29- block . call if block_given?
34+ @options [ :stacks ] = count_op
35+
36+ # Create a context for conditional logic
37+ if block_given?
38+ # Store the parent node context for glow! to work
39+ @parent_node = @options [ :parent_node ] if @options [ :parent_node ]
40+ instance_eval ( &block )
41+ end
42+ end
43+
44+ def glow! ( options = { } )
45+ # Forward glow! to parent node if available
46+ @parent_node . glow! ( options ) if @parent_node &.respond_to? ( :glow! )
3047 end
3148
3249 def remaining_time ( count_op , &block )
You can’t perform that action at this time.
0 commit comments