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 | |
parent | c016637230c4af69e7effa3a146a3ecba95338e6 (diff) |
[data] New activity: havencast_dazzle
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | app/lib/activity_processor.rb | 5 | ||||
-rw-r--r-- | app/models/character.rb | 4 | ||||
-rw-r--r-- | data/activities.yml | 28 |
4 files changed, 38 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 6bcdd0b..b6fd397 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,7 @@ All notable changes to this project will be documented in this file. - Purify iron ingot 115 -> 70 - Level requirements changes - Arcanite longsword 15 -> 17 (setting it to 15 was a programming error) +- The first havencast spells: Light, Dazzle ### Items - New item: faint mana 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 diff --git a/data/activities.yml b/data/activities.yml index 2940973..c9ea218 100644 --- a/data/activities.yml +++ b/data/activities.yml @@ -2849,3 +2849,31 @@ havencast_light: - type: "xp" gid: "havencast" base: 3 +havencast_dazzle: + name: "Cast Dazzle" + description: "Cast the Dazzle cantrip." + whatnot: + tags: + - "cantrip" + duration: + base: 32 + minimum: 10 + scaling: + - type: "skill" + gid: "havencast" + scale_value: 1 + requirements: + - type: "skill" + gid: "havencast" + level: 2 + - type: "stat" + gid: "mana" + value: 1 + results: + - type: "condition" + gid: "dazzle" + duration: 600 # 10 minutes + message: "Sparkling lights distract your enemies." + - type: "xp" + gid: "havencast" + base: 6 |