diff options
author | David Gay <david@davidgay.org> | 2021-06-16 17:44:38 -0400 |
---|---|---|
committer | David Gay <david@davidgay.org> | 2021-06-16 17:45:23 -0400 |
commit | ecf1d03813e75b2929dce4cfc68352ad5b1a1377 (patch) | |
tree | 19d65cbd3043dde7c3693e423b3084f52aef5cdf /app | |
parent | c016637230c4af69e7effa3a146a3ecba95338e6 (diff) |
[data] New activity: havencast_dazzle
Diffstat (limited to 'app')
-rw-r--r-- | app/lib/activity_processor.rb | 5 | ||||
-rw-r--r-- | app/models/character.rb | 4 |
2 files changed, 9 insertions, 0 deletions
diff --git a/app/lib/activity_processor.rb b/app/lib/activity_processor.rb index 79c8f3e..248ed9d 100644 --- a/app/lib/activity_processor.rb +++ b/app/lib/activity_processor.rb @@ -256,8 +256,13 @@ class ActivityProcessor turn_order = [[char, mon], [mon, char]].shuffle end turn_order.cycle do |actor, target| + base_accuracy_roll = roll(20) accuracy_roll = base_accuracy_roll + actor.accuracy(with_combat_style: true) + if actor == mon + accuracy_roll += char.total_enemy_stat_change("accuracy") + end + evasion_roll = roll(20) + target.evasion(with_combat_style: true) if accuracy_roll >= evasion_roll || base_accuracy_roll == 20 diff --git a/app/models/character.rb b/app/models/character.rb index 7f26ad4..9db3f8c 100644 --- a/app/models/character.rb +++ b/app/models/character.rb @@ -367,6 +367,10 @@ class Character < ApplicationRecord effects.filter_map { |e| e[:modifier] if e[:type] == "stat_change" && e[:gid] == gid }.sum end + def total_enemy_stat_change(gid) + effects.filter_map { |e| e[:modifier] if e[:type] == "enemy_stat_change" && e[:gid] == gid }.sum + end + def damage_ranges effects.filter_map { |e| { gid: e[:gid], min: e[:min], max: e[:max] } if e[:type] == "damage" } end |