diff options
author | David Gay <david@davidgay.org> | 2021-06-16 19:45:34 -0400 |
---|---|---|
committer | David Gay <david@davidgay.org> | 2021-06-16 19:45:34 -0400 |
commit | 8b9191b20faf7473e42b08f5cbf73783f4353b4a (patch) | |
tree | 61f36978f917ac30f322b05fe82999d27ed467ba | |
parent | 361acfad2162e08a962c63c4443641fbbd812089 (diff) |
Stinging Rays spell as the first DoT
-rw-r--r-- | app/lib/activity_processor.rb | 11 | ||||
-rw-r--r-- | app/models/character.rb | 4 | ||||
-rw-r--r-- | data/activities.yml | 2 | ||||
-rw-r--r-- | data/conditions.yml | 5 |
4 files changed, 19 insertions, 3 deletions
diff --git a/app/lib/activity_processor.rb b/app/lib/activity_processor.rb index 18fdece..6509b44 100644 --- a/app/lib/activity_processor.rb +++ b/app/lib/activity_processor.rb @@ -305,6 +305,17 @@ class ActivityProcessor combat_message.call("#{target.name} evaded #{actor.name}'s attack.") end + # HACK: DoT is char-only, and one-damage-type-only for now. + if actor == char + actor.dots.each do |data| + damage_roll = rand(data[:min]..data[:max]) + effective_resistance = [target.resistance(data[:gid]), damage_roll].min + resolved_damage = damage_roll - (effective_resistance * rand(0.5..1)).round + mon_hp -= resolved_damage + combat_message.call("#{data[:message]} (#{resolved_damage} #{data[:gid]})") + end + end + if char_hp < 1 || mon_hp < 1 @character.do_equipment_break_checks.each do |broken_item| @results.push({ type: "warning", message: "Your #{broken_item.name} was damaged beyond repair!" }) diff --git a/app/models/character.rb b/app/models/character.rb index a26fb93..b7649c3 100644 --- a/app/models/character.rb +++ b/app/models/character.rb @@ -383,6 +383,10 @@ class Character < ApplicationRecord effects.filter_map { |e| { gid: e[:gid], min: e[:min], max: e[:max] } if e[:type] == "damage" } end + def dots + effects.filter_map { |e| { gid: e[:gid], min: e[:min], max: e[:max], message: e[:message] } if e[:type] == "dot" } + end + def planting_spots [total_stat_change("planting_spots"), 0].max end diff --git a/data/activities.yml b/data/activities.yml index 3202e7f..316b3de 100644 --- a/data/activities.yml +++ b/data/activities.yml @@ -3001,7 +3001,7 @@ havencast_stinging_rays: results: - type: "condition" gid: "stinging_rays" - duration: 300 # 10 minutes + duration: 600 # 10 minutes message: "Beams of arcane energy shoot at your enemies from the air around you." - type: "xp" gid: "havencast" diff --git a/data/conditions.yml b/data/conditions.yml index c72cf36..95d2bda 100644 --- a/data/conditions.yml +++ b/data/conditions.yml @@ -115,11 +115,12 @@ dazzle: gid: "accuracy" modifier: -1 stinging_rays: - name: "stinging_rays" + name: "stinging rays" description: "Adds arcane damage to your attacks." whatnot: effects: - - type: "damage" + - type: "dot" gid: "arcane" min: 1 max: 3 + message: "Stinging rays spring from the air around you and hit your enemy." |