Class: BCDice::GameSystem::BeastBindTrinity::BBCommand
- Inherits:
-
Object
- Object
- BCDice::GameSystem::BeastBindTrinity::BBCommand
- Defined in:
- lib/bcdice/game_system/BeastBindTrinity.rb
Instance Method Summary collapse
-
#initialize(command) ⇒ BBCommand
constructor
A new instance of BBCommand.
- #roll(randomizer) ⇒ Object
Constructor Details
#initialize(command) ⇒ BBCommand
Returns a new instance of BBCommand.
61 62 63 64 |
# File 'lib/bcdice/game_system/BeastBindTrinity.rb', line 61 def initialize(command) @command = command parse() end |
Instance Method Details
#roll(randomizer) ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/bcdice/game_system/BeastBindTrinity.rb', line 66 def roll(randomizer) if @parse_error return nil end @randomizer = randomizer dice_list_org = roll_with_dice_pool() if dice_list_org.empty? return "ERROR:振るダイスの数が0個です" end dice_list_filtered = dice_list_org.map { |dice| [dice, @dice_value_lower_limit].max }.sort @dice_total = dice_list_filtered.last(2).inject(0, :+) total = calc_total() dice_list_org_str = "[#{dice_list_org.join(',')}]" if dice_list_filtered != dice_list_org sequence = [ command_expr(), dice_list_org_str, interim_expr(dice_list_filtered), dice_status(), total.to_s, result_compare(total) ].compact return sequence.join(" > ") end |