diff options
Diffstat (limited to 'app/lib')
-rw-r--r-- | app/lib/activity_processor.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/app/lib/activity_processor.rb b/app/lib/activity_processor.rb index 4ba3609..d3bf5cb 100644 --- a/app/lib/activity_processor.rb +++ b/app/lib/activity_processor.rb @@ -118,8 +118,12 @@ class ActivityProcessor 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 }) + monster_spawn = MonsterSpawn.new(monster: monster, location: @character.location) + if monster_spawn.save + @results.push({ type: type, monster: monster }) + else + @results.push({ type: "message", body: "A leviathan did not appear since there is already a leviathan at #{@character.location.name}." }) + end else raise "Invalid result type (#{type})" # TODO: Improve this. end |