diff options
author | David Gay <david@davidgay.org> | 2021-06-15 19:54:29 -0400 |
---|---|---|
committer | David Gay <david@davidgay.org> | 2021-06-15 20:00:06 -0400 |
commit | d2a31e04d19796a600a932a3491e056fe2c89af2 (patch) | |
tree | 36c43f03b12883c6dc4e2899e3c0ab1b8726b307 /app/lib | |
parent | 53c9df5feb8ad4ebef8f40840d29255a81edb6df (diff) |
Basic spellcasting
Diffstat (limited to 'app/lib')
-rw-r--r-- | app/lib/activity_processor.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/app/lib/activity_processor.rb b/app/lib/activity_processor.rb index 4a06a98..9b03f55 100644 --- a/app/lib/activity_processor.rb +++ b/app/lib/activity_processor.rb @@ -90,6 +90,13 @@ class ActivityProcessor item = Item.find_by_gid(result[:gid]) hp = @character.hearth.hearth_plantings.create(item: item) @results.push({ type: type, hearth_planting: hp }) + when "condition" + Character.transaction do + condition = Condition.find_by_gid(result[:gid]) + @character.states.create!(condition: condition, expires_at: Time.now + result[:duration]) + @results.push({ type: "message", body: result[:message] }) + @results.push({ type: type, condition: condition }) + end when "activity" next if rand > (result[:chance] || 1) table_roll = rand |