From 8b9191b20faf7473e42b08f5cbf73783f4353b4a Mon Sep 17 00:00:00 2001 From: David Gay Date: Wed, 16 Jun 2021 19:45:34 -0400 Subject: Stinging Rays spell as the first DoT --- app/lib/activity_processor.rb | 11 +++++++++++ app/models/character.rb | 4 ++++ 2 files changed, 15 insertions(+) (limited to 'app') 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 -- cgit v1.2.3