From 3f17361f21165fc8e7af6193a75d0a8d564a4e3f Mon Sep 17 00:00:00 2001 From: David Gay Date: Wed, 14 Jul 2021 17:54:58 -0400 Subject: Add output for when a character would learn to do a new activity, but already knows that activity --- app/lib/activity_processor.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'app') 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 -- cgit v1.2.3