class BCDice::GameSystem::Chill
Constants
- HELP_MESSAGE
ダイスボットの使い方
- ID
ゲームシステムの識別子
- NAME
ゲームシステム名
- SORT_KEY
ゲームシステム名の読みがな
Public Instance Methods
check_strike_rank(strikeRank)
click to toggle source
# File lib/bcdice/game_system/Chill.rb, line 106 def check_strike_rank(strikeRank) strikeRank = strikeRank.to_i dice = '' dice_add = '' dice_str = '' damage = 0 if strikeRank < 1 damage = 0 dice_str = '-' dice_add = '-' dice = '-' elsif strikeRank < 2 dice = '0or1' damage = @randomizer.roll_once(2) dice_str = damage.to_s damage -= 1 dice_add = damage.to_s elsif strikeRank < 3 dice = '1or2' damage = @randomizer.roll_once(2) dice_str = damage.to_s dice_add = damage.to_s elsif strikeRank < 4 dice = '1d5' damage = @randomizer.roll_once(5) dice_str = damage.to_s dice_add = damage.to_s elsif strikeRank < 10 dice = (strikeRank - 3).to_s + 'd10' dice_list = @randomizer.roll_barabara(strikeRank - 3, 10) damage = dice_list.sum() dice_add = damage.to_s dice_str = dice_list.join(",") elsif strikeRank < 13 dice = (strikeRank - 6).to_s + 'd10*2' dice_list = @randomizer.roll_barabara(strikeRank - 6, 10) total = dice_list.sum() dice_add = "#{total}*2" damage = total * 2 dice_str = "(#{dice_list.join(',')})*2" else dice = '5d10*3' dice_list = @randomizer.roll_barabara(5, 10) total = dice_list.sum() dice_add = "#{total}*3" damage = total * 3 dice_str = "(#{dice_list.join(',')})*3" end return damage, dice, dice_add, dice_str end
eval_game_system_specific_command(command)
click to toggle source
# File lib/bcdice/game_system/Chill.rb, line 46 def eval_game_system_specific_command(command) roll_strike_rank_result(command) end
result_1d100(total, _dice_total, cmp_op, target)
click to toggle source
# File lib/bcdice/game_system/Chill.rb, line 27 def result_1d100(total, _dice_total, cmp_op, target) return nil if target == '?' return nil if cmp_op != :<= if total >= 100 Result.fumble("ファンブル") elsif total > target Result.failure("失敗") elsif total >= (target * 0.9) Result.success("L成功") elsif total >= (target / 2) Result.success("M成功") elsif total >= (target / 10) Result.success("H成功") else Result.critical("C成功") end end
roll_strike_rank_result(string)
click to toggle source
# File lib/bcdice/game_system/Chill.rb, line 50 def roll_strike_rank_result(string) debug('strike_rank begin string', string) wounds = 0 sta_loss = 0 dice = '' dice_add = "" dice_str = "" unless /(^|\s)[sS]?(SR|sr)(\d+)($|\s)/ =~ string debug('invalid string', string) return "1" end strikeRank = Regexp.last_match(3).to_i if strikeRank < 14 sta_loss, dice, dice_add, dice_str = check_strike_rank(strikeRank) wounds, dice_w, dice_wa, dice_ws = check_strike_rank(strikeRank - 3) dice = dice + ', ' + dice_w dice_add += ', ' + dice_wa dice_str = dice_str + ', ' + dice_ws else sta_loss, _dice, dice_add, dice_str = check_strike_rank(13) dice_list = @randomizer.roll_barabara(4, 10) wounds = dice_list.sum() dice_ws = dice_list.join(",") dice = '5d10*3, 4d10+' + ((strikeRank - 13) * 2).to_s + 'd10' dice_add += ', ' + wounds.to_s dice_str = "#{dice_str}, #{dice_ws}" dice_list = @randomizer.roll_barabara((strikeRank - 13) * 2, 10) wounds_wk = dice_list.sum() dice_ws = dice_list.join(",") dice_str += "+#{dice_ws}" dice_add += "+#{wounds_wk}" wounds += wounds_wk end output = "#{dice_str} > #{dice_add} > スタミナ損失#{sta_loss}, 負傷#{wounds}" string += ':' + dice if output.empty? return "1" end output = "(#{string}) > #{output}" debug('strike_rank end output', output) return output end