status.rb 754 B

1234567891011121314151617181920212223242526272829303132
  1. def status_list
  2. # Create Status lists
  3. # Split Statuses by stackable, and non-stackable, saving only their names
  4. stackable, non_stackable = Status.all.partition { |s| s.amount }
  5. # Push the categorized Statuses into embed fields
  6. fields = []
  7. unless stackable.empty?
  8. fields.push(
  9. { name: 'Stackable Effects', value: stackable.map(&:name).join(', ')}
  10. )
  11. end
  12. unless non_stackable.empty?
  13. fields.push(
  14. { name: 'Non-Stackable Effects', value: non_stackable.map(&:name).join(', ')}
  15. )
  16. end
  17. # Create Embed
  18. Embed.new(
  19. title: 'Statuses',
  20. fields: fields
  21. )
  22. end
  23. def status_details(status)
  24. Embed.new(
  25. title: status.name,
  26. description: "#{status.effect.capitalize}\n(Stacks: #{status.amount})"
  27. )
  28. end