class BCDice::GameSystem::YearZeroEngine
Constants
- ABILITY_INDEX
- COMMAND_TYPE_INDEX
- DIFFICULTY_INDEX
- HELP_MESSAGE
ダイスボットの使い方
- ID
ゲームシステムの識別子
- MODIFIED_INDEX
- NAME
ゲームシステム名
- SKILL_INDEX
- SORT_KEY
ゲームシステム名の読みがな
Public Instance Methods
dice_info_init()
click to toggle source
# File lib/bcdice/game_system/YearZeroEngine.rb, line 34 def dice_info_init() @total_success_dice = 0 @total_botch_dice = 0 @base_botch_dice = 0 @skill_botch_dice = 0 @gear_botch_dice = 0 @push_dice = 0 @difficulty = 0 end
eval_game_system_specific_command(command)
click to toggle source
# File lib/bcdice/game_system/YearZeroEngine.rb, line 44 def eval_game_system_specific_command(command) m = /\A(\d+)?(YZE|MYZ)(\d+)(\+(\d+))?(\+(\d+))?/.match(command) unless m return '' end dice_info_init @difficulty = m[DIFFICULTY_INDEX].to_i command_type = m[COMMAND_TYPE_INDEX] @total_success_dice = 0 dice_pool = m[ABILITY_INDEX].to_i ability_dice_text, success_dice, botch_dice = make_dice_roll(dice_pool) @total_success_dice += success_dice @total_botch_dice += botch_dice @base_botch_dice += botch_dice # 能力ダメージ @push_dice += (dice_pool - (success_dice + botch_dice)) dice_count_text = "(#{dice_pool}D6)" dice_text = ability_dice_text if m[SKILL_INDEX] dice_pool = m[SKILL_INDEX].to_i skill_dice_text, success_dice, botch_dice = make_dice_roll(dice_pool) @total_success_dice += success_dice @total_botch_dice += botch_dice @skill_botch_dice += botch_dice # 技能ダイスの1はpushで振り直し可能 @push_dice += (dice_pool - success_dice) # 技能ダイスのみ1を含む dice_count_text += "+(#{dice_pool}D6)" dice_text += "+#{skill_dice_text}" end if m[MODIFIED_INDEX] dice_pool = m[MODIFIED_INDEX].to_i modified_dice_text, success_dice, botch_dice = make_dice_roll(dice_pool) @total_success_dice += success_dice @total_botch_dice += botch_dice @gear_botch_dice += botch_dice # ギアダメージ @push_dice += (dice_pool - (success_dice + botch_dice)) dice_count_text += "+(#{dice_pool}D6)" dice_text += "+#{modified_dice_text}" end return make_result_text(command_type, dice_count_text, dice_text) end
make_dice_roll(dice_pool)
click to toggle source
# File lib/bcdice/game_system/YearZeroEngine.rb, line 125 def make_dice_roll(dice_pool) dice_list = @randomizer.roll_barabara(dice_pool, 6) success_dice = dice_list.count(6) botch_dice = dice_list.count(1) return "[#{dice_list.join(',')}]", success_dice, botch_dice end
make_result_text(command_type, dice_count_text, dice_text)
click to toggle source
# File lib/bcdice/game_system/YearZeroEngine.rb, line 97 def make_result_text(command_type, dice_count_text, dice_text) if command_type == 'YZE' return make_result_with_yze(dice_count_text, dice_text) elsif command_type == 'MYZ' return make_result_with_myz(dice_count_text, dice_text) end return 'Error' # 到達しないはず end
make_result_with_myz(dice_count_text, dice_text)
click to toggle source
# File lib/bcdice/game_system/YearZeroEngine.rb, line 119 def make_result_with_myz(dice_count_text, dice_text) result_text = make_result_with_yze(dice_count_text, dice_text) return "#{result_text}\n出目1:[能力:#{@base_botch_dice},技能:#{@skill_botch_dice},アイテム:#{@gear_botch_dice}) プッシュ可能=#{@push_dice}ダイス" end
make_result_with_yze(dice_count_text, dice_text)
click to toggle source
# File lib/bcdice/game_system/YearZeroEngine.rb, line 107 def make_result_with_yze(dice_count_text, dice_text) result_text = "#{dice_count_text} > #{dice_text} 成功数:#{@total_success_dice}" if @difficulty > 0 if @total_success_dice >= @difficulty result_text = "#{result_text} 難易度=#{@difficulty}:判定成功!" else result_text = "#{result_text} 難易度=#{@difficulty}:判定失敗!" end end return result_text end