From 5f76daf2e8ad440bc40483d2b4309a0a78c944b4 Mon Sep 17 00:00:00 2001 From: David Gay Date: Thu, 8 Jul 2021 10:05:46 -0400 Subject: Change how power works so that it can no longer more than double the rolled damage of each damage type --- CHANGELOG.md | 5 +++++ app/lib/activity_processor.rb | 12 +++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4682cc9..45e8df9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ All notable changes to this project will be documented in this file. ## [Unreleased] +### Skills +- Beastslay: Power has been changed so that it can no longer more than double the rolled damage of each damage type. + Power is applied to random damage types until either the resulting damage of each type has been maxed out by this + max-double rule, or until there is no more power left to apply. + ### Hearth - Aetherloom level 2 now increases aetherweave speed by 4, similar to other level 2 amenities. diff --git a/app/lib/activity_processor.rb b/app/lib/activity_processor.rb index 5d80b15..72aa85d 100644 --- a/app/lib/activity_processor.rb +++ b/app/lib/activity_processor.rb @@ -289,9 +289,15 @@ class ActivityProcessor end end - # Apply power to random damages - actor.power.times do - dealt_damage[dealt_damage.keys.sample] += 1 + # Apply power to random damages, not allowing power to more than double the damage output + base_damage = dealt_damage.clone + remaining_power_to_distribute = actor.power + while remaining_power_to_distribute > 0 && dealt_damage.keys.select { |type| dealt_damage[type] < (base_damage[type] * 2) }.any? do + damage_type = dealt_damage.keys.sample + if dealt_damage[damage_type] < (base_damage[damage_type] * 2) + dealt_damage[dealt_damage.keys.sample] += 1 + remaining_power_to_distribute -= 1 + end end resolved_damage = {} -- cgit v1.2.3