summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Gay <david@davidgay.org>2021-07-14 17:54:58 -0400
committerDavid Gay <david@davidgay.org>2021-07-14 17:54:58 -0400
commit3f17361f21165fc8e7af6193a75d0a8d564a4e3f (patch)
treebd7bede08b8eeb2cbd1401fc6e0e1d49caa75974
parent456cfb0df874ac8cfb217c19c723a3cf738e524f (diff)
Add output for when a character would learn to do a new activity, but already knows that activity
-rw-r--r--CHANGELOG.md2
-rw-r--r--app/lib/activity_processor.rb4
2 files changed, 5 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 782d0d2..c3e9bc2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,6 +13,8 @@ All notable changes to this project will be documented in this file.
### Activities
- Changed references to "Floret Region" in leviathan hunting activity to just "Floret", as per the rename.
+- Added message output when you would learn how to do a new activity (e.g. cast a new spell), but you already know how
+ how to do it.
### Hearth
- Hearths now have locations, like characters do. All existing hearths are now located at Floret.
diff --git a/app/lib/activity_processor.rb b/app/lib/activity_processor.rb
index 8e5df1b..d9b694e 100644
--- a/app/lib/activity_processor.rb
+++ b/app/lib/activity_processor.rb
@@ -108,7 +108,9 @@ class ActivityProcessor
if table_roll >= score
new_activity = Activity.find_by_gid(table_entry[:gid])
raise "Invalid activity gid (#{table_entry[:gid]})" unless new_activity
- unless @character.learned_activities.exists?(activity: new_activity)
+ if @character.learned_activities.exists?(activity: new_activity)
+ @results.push({ type: "message", body: "You already know how to #{new_activity.name}." })
+ else
@character.learned_activities.create(activity: new_activity)
@results.push({ type: type, activity: new_activity })
end