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 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# 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 result = result_compare(total) result.critical = critical? result.fumble = fumble? dice_status = if result.fumble? "ファンブル" elsif result.critical? "クリティカル" end result_str = if result.success? "成功" elsif result.failure? "失敗" end sequence = [ command_expr(), dice_list_org_str, interim_expr(dice_list_filtered), dice_status, total.to_s, result_str ].compact result.text = sequence.join(" > ") return result end |