Class: BCDice::GameSystem::SamsaraBallad

Inherits:
Base
  • Object
show all
Defined in:
lib/bcdice/game_system/SamsaraBallad.rb

Constant Summary collapse

ID =

ゲームシステムの識別子

'SamsaraBallad'
NAME =

ゲームシステム名

'サンサーラ・バラッド'
SORT_KEY =

ゲームシステム名の読みがな

「ゲームシステム名の読みがなの設定方法」(docs/dicebot_sort_key.md)を参考にして設定してください

'さんさあらはらつと'
HELP_MESSAGE =

ダイスボットの使い方

"SB   \u901A\u5E38\u306ED100\u30ED\u30FC\u30EB\u3092\u884C\u3046\nSBS  \u30B9\u30EF\u30C3\u30D7\u30ED\u30FC\u30EB\u3067D100\u30ED\u30FC\u30EB\u3092\u884C\u3046\nSB#x@y   F\u5024\u3092x\u3001C\u5024\u3092y\u3068\u3057\u3066\u901A\u5E38\u306ED100\u30ED\u30FC\u30EB\u3092\u884C\u3046\nSBS#x@y  F\u5024\u3092x\u3001C\u5024\u3092y\u3068\u3057\u3066\u30B9\u30EF\u30C3\u30D7\u30ED\u30FC\u30EB\u3067D100\u30ED\u30FC\u30EB\u3092\u884C\u3046\n\n\u4F8B\uFF1A\nSB<=85 \u901A\u5E38\u306E\u6280\u80FD\u3067\u6210\u529F\u738785%\u306E\u5224\u5B9A\nSBS<=70 \u7FD2\u719F\u3092\u5F97\u305F\u6280\u80FD\u3067\u6210\u529F\u738770%\u306E\u5224\u5B9A\nSBS#3@7<=80 \u7FD2\u719F\u3092\u5F97\u305F\u6280\u80FD\u3067\u3001F\u50243\u3001C\u50247\u3067\u6210\u529F\u738780%\u306E\u653B\u6483\u5224\u5B9A\nSB<57 \u901A\u5E38\u306E\u6280\u80FD\u3067\u3001\u80FD\u52D5\u5074\u306E\u9054\u6210\u5024\u304C57\u306E\u53D7\u52D5\u5224\u5B9A\nSBS<70 \u7FD2\u719F\u3092\u5F97\u305F\u6280\u80FD\u3067\u3001\u80FD\u52D5\u5074\u306E\u9054\u6210\u5024\u304C70\u306E\u53D7\u52D5\u5224\u5B9A\n"

Instance Attribute Summary

Attributes inherited from Base

#d66_sort_type, #default_cmp_op, #default_target_number, #randomizer, #reroll_dice_reroll_threshold, #round_type, #sides_implicit_d, #upper_dice_reroll_threshold

Instance Method Summary collapse

Methods inherited from Base

#change_text, #check_result, command_pattern, #enable_debug, #enabled_d9?, #eval, eval, #grich_text, #initialize, prefixes_pattern, register_prefix, register_prefix_from_super_class, #sort_add_dice?, #sort_barabara_dice?

Methods included from Translate

#translate

Constructor Details

This class inherits a constructor from BCDice::Base

Instance Method Details

#eval_game_system_specific_command(command) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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
# File 'lib/bcdice/game_system/SamsaraBallad.rb', line 38

def eval_game_system_specific_command(command)
  debug("eval_game_system_specific_command Begin")

  parser = Command::Parser.new('SBS', 'SB', round_type: round_type)
                          .enable_critical
                          .enable_fumble
                          .restrict_cmp_op_to(nil, :<=, :<)
  cmd = parser.parse(command)

  unless cmd
    return nil
  end

  if cmd.command == 'SB'
    places_text = nil
    total = @randomizer.roll_once(100)
  else
    a = @randomizer.roll_once(10)
    b = @randomizer.roll_once(10)
    places_text = "#{a},#{b}"
    places = [a, b].map { |n| n == 10 ? 0 : n }.sort

    total = places[0] * 10 + places[1]
    total = 100 if total == 0
  end

  result = compare(total, cmd)

  result_str =
    if result.failure?
      "失敗"
    elsif result.success?
      "成功"
    end

  additional_str =
    if result.fumble?
      "ファンブル"
    elsif result.critical?
      "クリティカル"
    end

  sequence = [
    "(D100#{cmd.cmp_op}#{cmd.target_number})",
    places_text,
    total.to_s,
    result_str,
    additional_str,
  ].compact

  result.text = sequence.join(" > ")

  return result
end