summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md1
-rw-r--r--app/lib/activity_processor.rb3
-rw-r--r--app/models/concerns/has_whatnot.rb12
-rw-r--r--app/models/monster.rb2
-rw-r--r--data/monsters.yml14
5 files changed, 30 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a06acbd..b6f9f7e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -36,6 +36,7 @@ All notable changes to this project will be documented in this file.
### Monsters
- Pit leech, stalk beast, and grinpad damage reduced.
+- Bollyrots and crypt writhes now have double the damage capacity at night.
- XP awards reduced (except balgoloth).
### Bazaar
diff --git a/app/lib/activity_processor.rb b/app/lib/activity_processor.rb
index cca2185..5d80b15 100644
--- a/app/lib/activity_processor.rb
+++ b/app/lib/activity_processor.rb
@@ -271,8 +271,9 @@ class ActivityProcessor
dealt_damage = {}
actor.damage_ranges.each do |data|
+ dealt_damage[data[:gid]] ||= 0
damage_roll = rand(data[:min]..data[:max])
- dealt_damage[data[:gid]] = damage_roll
+ dealt_damage[data[:gid]] += damage_roll
end
# If you can't do damage any other way, hit 'em with your fists!
diff --git a/app/models/concerns/has_whatnot.rb b/app/models/concerns/has_whatnot.rb
index 22322c0..987c969 100644
--- a/app/models/concerns/has_whatnot.rb
+++ b/app/models/concerns/has_whatnot.rb
@@ -18,5 +18,17 @@ module HasWhatnot
def where_has_tag(tag)
where("whatnot->'tags' ? :tag", tag: tag)
end
+
+ def conditions_met?(data)
+ data[:conditions]&.each do |conditions_data|
+ case conditions_data[:type]
+ when "time_of_day"
+ return false unless conditions_data[:times].include? World.time_of_day.to_s
+ else
+ raise "Invalid condition type GID (#{conditions_data[:type]})"
+ end
+ end
+ true
+ end
end
end
diff --git a/app/models/monster.rb b/app/models/monster.rb
index 40018fd..9e3060f 100644
--- a/app/models/monster.rb
+++ b/app/models/monster.rb
@@ -22,7 +22,7 @@ class Monster < ApplicationRecord
end
def damage_ranges
- self.whatnot[:hit_effects].filter_map { |e| { gid: e[:gid], min: e[:min], max: e[:max] } if e[:type] == "damage" }
+ self.whatnot[:hit_effects].filter_map { |e| { gid: e[:gid], min: e[:min], max: e[:max] } if e[:type] == "damage" && conditions_met?(e) }
end
def resistance(damage_type)
diff --git a/data/monsters.yml b/data/monsters.yml
index 8d4cc86..6411d97 100644
--- a/data/monsters.yml
+++ b/data/monsters.yml
@@ -210,6 +210,13 @@ bollyrot:
gid: "necrotic"
min: 1
max: 4
+ - type: "damage"
+ conditions:
+ - type: "time_of_day"
+ times: "night"
+ gid: "necrotic"
+ min: 1
+ max: 4
awards:
- type: "xp"
gid: "beastslay"
@@ -259,6 +266,13 @@ crypt_writhe:
gid: "necrotic"
min: 4
max: 10
+ - type: "damage"
+ conditions:
+ - type: "time_of_day"
+ times: "night"
+ gid: "necrotic"
+ min: 4
+ max: 10
awards:
- type: "xp"
gid: "beastslay"