From 943e49eb877ab0aaaba6e876e3ca7aef5688e158 Mon Sep 17 00:00:00 2001 From: David Gay Date: Sun, 11 Jul 2021 17:40:14 -0400 Subject: Second worldcall spell: Project Thought --- app/lib/activity_processor.rb | 5 +++++ app/views/application/_results.html.erb | 2 ++ 2 files changed, 7 insertions(+) (limited to 'app') diff --git a/app/lib/activity_processor.rb b/app/lib/activity_processor.rb index 3f62d28..4ba3609 100644 --- a/app/lib/activity_processor.rb +++ b/app/lib/activity_processor.rb @@ -115,6 +115,11 @@ class ActivityProcessor location = @character.hearth&.location || Location.find_by_gid("floret") @character.update(location: location) @results.push({ type: type, location: location }) + when "create_monster_spawn" + next if rand > (result[:chance] || 1) + monster = Monster.find_by_gid(result[:gid]) + MonsterSpawn.create(monster: monster, location: @character.location) + @results.push({ type: type, monster: monster }) else raise "Invalid result type (#{type})" # TODO: Improve this. end diff --git a/app/views/application/_results.html.erb b/app/views/application/_results.html.erb index d1ec927..71d6992 100644 --- a/app/views/application/_results.html.erb +++ b/app/views/application/_results.html.erb @@ -26,6 +26,8 @@ <% when "monster_spawn" %>

You found the <%= result[:monster_spawn].monster.name %>!

<%= result[:monster_spawn].monster.description %>

+ <% when "create_monster_spawn" %> +

You've called a <%= result[:monster].name %>!

<% when "xp" %>

You gained <%= result[:xp] %> <%= result[:skill].name %> XP.

<% when "title" %> -- cgit v1.2.3