tabletop-companion/app/models/dice_roll_type.rb

21 lines
380 B
Ruby
Raw Normal View History

2024-06-21 14:47:07 +00:00
# frozen_string_literal: true
class DiceRollType < ApplicationRecord
belongs_to :rollable, polymorphic: true
validates :name, length: { maximum: 100 }
validates :roll_command, length: { maximum: 100 }
def roll(table)
roller = DiceRoller.new(roll_command, stat: rollable)
end
def value
rollable.value
end
def character
rollable.character
end
end