Skip to content

Commit

Permalink
add trigger shortcuts for charges, etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
fx committed Sep 28, 2024
1 parent 8a5c3ea commit d2091b3
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 11 deletions.
3 changes: 2 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/base:jammy",
"features": {
"ghcr.io/devcontainers/features/node:1": {}
"ghcr.io/devcontainers/features/node:1": {},
"mcr.microsoft.com/devcontainers/ruby:1.1.11-bullseye": {}
}
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
Expand Down
19 changes: 19 additions & 0 deletions public/examples/mage/frost.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,25 @@
hide_ooc!

dynamic_group 'Frost Mage WhackAuras' do
icon 'Ray of Frost' do
action_usable! do
aura 'Cryopathy' do
stacks '>= 2' do
glow!
end
end
# charges '>= 2' do
# glow!
# end
end
# glow if cryopathy stacks >= 10?
#
end

icon 'Ring of Fire' do
action_usable! do
end

action_usable 'Comet Storm'
action_usable 'Glacial Spike' do
glow!
Expand Down
39 changes: 30 additions & 9 deletions public/examples/warrior/arms.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,41 @@
# title: 'Warrior: Arms'
# ---

title 'Arms Warrior'
load spec: :arms_warrior
hide_ooc!

dynamic_group 'Arms Stay Big' do
scale 0.7
offset y: -40, x: 60

action_usable 'Avatar'
action_usable 'Bladestorm'
end

dynamic_group 'Arms Stay Small' do
scale 0.7
offset y: -40, x: -60

action_usable 'Recklessness'
action_usable 'Thunderous Roar'
action_usable 'Colossus Smash'
end

dynamic_group 'Arms WhackAuras' do
scale 0.8
offset y: -80

action_usable 'Skullsplitter'
action_usable 'Colossus Smash'
# action_usable 'Warbreaker'
action_usable 'Execute'
action_usable 'Execute' do
glow! # todo: glow on sudden death only
end
action_usable 'Bladestorm'
action_usable 'Wrecking Throw'
# TODO: cleave instead of MS display when more than N targets?
# action_usable 'Cleave'
action_usable 'Cleave'
# action_usable 'Whirlwind'
action_usable 'Thunderous Roar'

# TODO: add `stacks` to glow! instead
# Min-maxing OP>MS is not recommended.
Expand All @@ -27,9 +50,7 @@
# end

action_usable ['Mortal Strike', 'Overpower']
action_usable 'Thunder Clap', requires: { target_debuffs_missing: ['Rend'] }
# action_usable 'Thunder Clap', requires: { target_debuffs_missing: ['Rend'] }
action_usable 'Rend', requires: { target_debuffs_missing: ['Rend'] }
action_usable 'Sweeping Strikes'
action_usable 'Avatar' do
glow!
end
end
end
21 changes: 21 additions & 0 deletions public/examples/warrior/protection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,28 @@
load spec: :protection_warrior
hide_ooc!

dynamic_group 'Prot Stay Big' do
scale 0.7
offset y: -40, x: 60

action_usable 'Avatar'
action_usable "Champion's Spear"
action_usable 'Shield Wall'
action_usable 'Last Stand'
end

dynamic_group 'Prot Stay Small' do
scale 0.7
offset y: -40, x: -60

action_usable 'Thunderous Roar'
action_usable 'Demolish'
end

dynamic_group 'Prot WhackAuras' do
scale 0.8
offset y: -80

action_usable 'Revenge'
action_usable 'Shield Slam'
action_usable 'Shield Block'
Expand Down
3 changes: 2 additions & 1 deletion public/weak_aura/icon.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ def all_triggers!
trigger_options.merge!({ disjunctive: 'all' })
end

def action_usable!(**kwargs)
def action_usable!(**kwargs, &block)
kwargs = { spell: id }.merge(kwargs)
triggers << Trigger::ActionUsable.new(**kwargs)
block.call if block_given?
end

def as_json # rubocop:disable Metrics/MethodLength,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
Expand Down
15 changes: 15 additions & 0 deletions public/weak_aura/triggers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,21 @@ def parse_count_operator(count, default_operator = '==')
count = count.to_s.gsub(/^[<>!=]+/, '').to_i
[count, operator]
end

def charges(count_op, &block)
@options[:charges] = count_op
block.call if block_given?
end

def stacks(count_op, &block)
@options[:stacks] = count_op
block.call if block_given?
end

def remaining_time(count_op, &block)
@options[:remaining_time] = count_op
block.call if block_given?
end
end
end

Expand Down
6 changes: 6 additions & 0 deletions public/weak_aura/triggers_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# frozen_string_literal: true

require './spec/spec_helper'

RSpec.describe Trigger::Base do
end

0 comments on commit d2091b3

Please sign in to comment.