From ecf1d03813e75b2929dce4cfc68352ad5b1a1377 Mon Sep 17 00:00:00 2001 From: David Gay Date: Wed, 16 Jun 2021 17:44:38 -0400 Subject: [data] New activity: havencast_dazzle --- CHANGELOG.md | 1 + app/lib/activity_processor.rb | 5 +++++ app/models/character.rb | 4 ++++ data/activities.yml | 28 ++++++++++++++++++++++++++++ 4 files changed, 38 insertions(+) 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 -- cgit v1.2.3