Class: BCDice::GameSystem::WorldOfDarkness
- Defined in:
- lib/bcdice/game_system/WorldOfDarkness.rb
Constant Summary collapse
- ID =
ゲームシステムの識別子
'WorldOfDarkness'
- NAME =
ゲームシステム名
'ワールド・オブ・ダークネス'
- SORT_KEY =
ゲームシステム名の読みがな
'わあるとおふたあくねす'
- HELP_MESSAGE =
ダイスボットの使い方
<<~INFO_MESSAGE_TEXT ・判定コマンド(xSTn+y or xSTSn+y or xSTAn+y) (ダイス個数)ST(難易度)+(自動成功) (ダイス個数)STS(難易度)+(自動成功) ※出目10で振り足し (ダイス個数)STA(難易度)+(自動成功) ※出目10は2成功 [20thルール] 難易度=省略時6 自動成功=省略時0 INFO_MESSAGE_TEXT
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
- #eval_game_system_specific_command(command) ⇒ Object
-
#initialize(command) ⇒ WorldOfDarkness
constructor
A new instance of WorldOfDarkness.
-
#roll_wod(dice_pool, diff, enabled_botch = true, auto_success_value = 1) ⇒ Object
Revised Edition 出目10は1自動成功 振り足し 出目1は大失敗: 成功を1つ相殺.
Methods inherited from Base
#change_text, #check_result, command_pattern, #enable_debug, #enabled_d9?, #eval, eval, #grich_text, prefixes_pattern, register_prefix, register_prefix_from_super_class, #sort_add_dice?, #sort_barabara_dice?
Methods included from Translate
Constructor Details
#initialize(command) ⇒ WorldOfDarkness
Returns a new instance of WorldOfDarkness.
28 29 30 31 32 33 |
# File 'lib/bcdice/game_system/WorldOfDarkness.rb', line 28 def initialize(command) super(command) @successDice = 0 @botchDice = 0 @rerollDice = 0 end |
Instance Method Details
#eval_game_system_specific_command(command) ⇒ Object
35 36 37 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 92 |
# File 'lib/bcdice/game_system/WorldOfDarkness.rb', line 35 def eval_game_system_specific_command(command) diff = 6 auto_success = 0 enabled_reroll = false enabled_20th = false md = command.match(/\A(\d+)(ST[SA]?)(\d+)?([+-]\d+)?/) dice_pool = md[1].to_i case md[2] when 'STS' enabled_reroll = true when 'STA' enabled_20th = true end diff = md[3].to_i if md[3] auto_success = md[4].to_i if md[4] diff = 6 if diff < 2 sequence = [] sequence.push "DicePool=#{dice_pool}, Difficulty=#{diff}, AutomaticSuccess=#{auto_success}" # 出力では Difficulty=11..12 もあり得る diff = 10 if diff > 10 total_success = auto_success total_botch = 0 dice, success, botch, auto_success = roll_wod(dice_pool, diff, true, enabled_20th ? 2 : 1) sequence.push dice.join(',') total_success += success total_botch += botch if enabled_reroll # 振り足し while auto_success > 0 dice_pool = auto_success # 振り足しの出目1は大失敗ではない dice, success, botch, auto_success = roll_wod(dice_pool, diff, false) sequence.push dice.join(',') total_success += success total_botch += botch end end if total_success > 0 sequence.push "成功数#{total_success}" elsif total_botch > 0 sequence.push "大失敗" else sequence.push "失敗" end output = sequence.join(' > ') return output end |
#roll_wod(dice_pool, diff, enabled_botch = true, auto_success_value = 1) ⇒ Object
Revised Edition 出目10は1自動成功 振り足し 出目1は大失敗: 成功を1つ相殺
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/bcdice/game_system/WorldOfDarkness.rb', line 97 def roll_wod(dice_pool, diff, enabled_botch = true, auto_success_value = 1) # FIXME: まとめて振る dice = Array.new(dice_pool) do dice_now = @randomizer.roll_once(10) dice_now end dice.sort! success = 0 botch = 0 auto_success = 0 dice.each do |d| case d when 10 auto_success += auto_success_value when diff..10 success += 1 when 1 botch += 1 if enabled_botch end end # 自動成功を成功に加算する success += auto_success if enabled_botch # 成功と大失敗を相殺する c = [success, botch].min success -= c botch -= c end return dice, success, botch, auto_success end |