Class: BCDice::GameSystem::YuMyoKishi
- Defined in:
- lib/bcdice/game_system/YuMyoKishi.rb
Constant Summary collapse
- ID =
ゲームシステムの識別子
'YuMyoKishi'
- NAME =
ゲームシステム名
'幽冥鬼使'
- SORT_KEY =
ゲームシステム名の読みがな
「ゲームシステム名の読みがなの設定方法」(docs/dicebot_sort_key.md)を参考にして設定してください
'ゆうみようきし'
- HELP_MESSAGE =
ダイスボットの使い方
<<~MESSAGETEXT ■判定 YM+a>=b a:技能値(省略可) b:目標値(省略可) 例:YM+4>=8: 技能値による修正が+4で、目標値8の克服判定を行う YM>=8 : 技能値による修正なしで、目標値8の克服判定を行う YM+6 : 技能値による修正が+6で、達成値を確認する ■代償表 COT ■転禍表 TRT MESSAGETEXT
- TABLES =
{ "COT" => DiceTable::Table.new( "代償表", "2D6", [ "不慮の出逢い", "深淵を覗くとき", "時間の消費", "奇妙な情報", "優柔不断", "注意散漫", "心身耗弱", "不穏な情報", "遺留品", "迫りくる危機", "正体の露見", ] ), "TRT" => DiceTable::Table.new( "転禍表", "2D6", [ "○○と瓜二つ", "絶対絶命", "悪癖災う", "冷酷な指令", "おびえる視線", "絡みつく妖気", "容赦ない評定", "無力な市民", "未練阻む", "縁の枷", "邪悪な刻印", ] ), }.freeze
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
- #roll_command(command) ⇒ Object
-
#sip_pat_a(dice_list) ⇒ Object
十八仔.
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
Constructor Details
This class inherits a constructor from BCDice::Base
Instance Method Details
#eval_game_system_specific_command(command) ⇒ Object
71 72 73 74 75 |
# File 'lib/bcdice/game_system/YuMyoKishi.rb', line 71 def eval_game_system_specific_command(command) debug("eval_game_system_specific_command Begin") return roll_command(command) || roll_tables(command, TABLES) end |
#roll_command(command) ⇒ Object
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/YuMyoKishi.rb', line 77 def roll_command(command) parser = Command::Parser.new('YM', round_type: round_type) .restrict_cmp_op_to(:>=, nil) cmd = parser.parse(command) unless cmd return nil end dice_list = @randomizer.(4, 6) value, status = sip_pat_a(dice_list) achievement = status == :wumian ? 0 : value + cmd.modify_number roll_text = [ cmd.to_s, dice_list.join(','), value, value == achievement ? nil : achievement, ].compact.join(" > ") if cmd.target_number.nil? if status == :wumian Result.failure(roll_text) elsif status == :yise Result.critical(roll_text) else Result.new(roll_text) end elsif status == :wumian Result.failure([roll_text, "可"].join(" > ")) elsif status == :yise Result.critical([roll_text, "優"].join(" > ")) elsif achievement >= cmd.target_number Result.success([roll_text, "良"].join(" > ")) else Result.failure([roll_text, "可"].join(" > ")) end end |
#sip_pat_a(dice_list) ⇒ Object
十八仔
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
# File 'lib/bcdice/game_system/YuMyoKishi.rb', line 115 def sip_pat_a(dice_list) # 十八仔 result = dice_list.each_with_object(Hash.new(0)) do |cur, acc| acc[cur] += 1 end case result.count when 1 # 全てゾロ目 [20, :yise] # 一色 when 2 if result.values == [2, 2] # 同値のダイスが2つずつ [result.keys.max * 2, :normal] else # 3つの同値と1つの目のダイス [result.keys.sum, :normal] end when 3 # 2つの同値と1つずつの目のダイス [result.select { |_k, v| v == 1 }.keys.sum, :normal] else # 全部バラバラ [0, :wumian] # 無面 end end |