From d2091b335aeb32c5e50ee5eec53e790bf3da69ff Mon Sep 17 00:00:00 2001 From: Marian Rudzynski Date: Sat, 28 Sep 2024 02:18:04 +0000 Subject: [PATCH] add trigger shortcuts for charges, etc. --- .devcontainer/devcontainer.json | 3 ++- public/examples/mage/frost.rb | 19 +++++++++++++ public/examples/warrior/arms.rb | 39 ++++++++++++++++++++------- public/examples/warrior/protection.rb | 21 +++++++++++++++ public/weak_aura/icon.rb | 3 ++- public/weak_aura/triggers.rb | 15 +++++++++++ public/weak_aura/triggers_spec.rb | 6 +++++ 7 files changed, 95 insertions(+), 11 deletions(-) create mode 100644 public/weak_aura/triggers_spec.rb diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index fc9d415..8b364f5 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -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": {}, diff --git a/public/examples/mage/frost.rb b/public/examples/mage/frost.rb index 582a26e..61e028a 100644 --- a/public/examples/mage/frost.rb +++ b/public/examples/mage/frost.rb @@ -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! diff --git a/public/examples/warrior/arms.rb b/public/examples/warrior/arms.rb index a561242..5d4982b 100644 --- a/public/examples/warrior/arms.rb +++ b/public/examples/warrior/arms.rb @@ -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. @@ -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 \ No newline at end of file diff --git a/public/examples/warrior/protection.rb b/public/examples/warrior/protection.rb index abaf113..ce34b1c 100644 --- a/public/examples/warrior/protection.rb +++ b/public/examples/warrior/protection.rb @@ -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' diff --git a/public/weak_aura/icon.rb b/public/weak_aura/icon.rb index 297bf91..80d4399 100644 --- a/public/weak_aura/icon.rb +++ b/public/weak_aura/icon.rb @@ -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 diff --git a/public/weak_aura/triggers.rb b/public/weak_aura/triggers.rb index b632180..05f53a0 100644 --- a/public/weak_aura/triggers.rb +++ b/public/weak_aura/triggers.rb @@ -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 diff --git a/public/weak_aura/triggers_spec.rb b/public/weak_aura/triggers_spec.rb new file mode 100644 index 0000000..29169e7 --- /dev/null +++ b/public/weak_aura/triggers_spec.rb @@ -0,0 +1,6 @@ +# frozen_string_literal: true + +require './spec/spec_helper' + +RSpec.describe Trigger::Base do +end