Class: BCDice::GameSystem::Gundog

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

Direct Known Subclasses

GundogZero

Constant Summary collapse

ID =

ゲームシステムの識別子

'Gundog'
NAME =

ゲームシステム名

'ガンドッグ'
SORT_KEY =

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

'かんとつく'
HELP_MESSAGE =

ダイスボットの使い方

<<~INFO_MESSAGE_TEXT
  失敗、成功、クリティカル、ファンブルとロールの達成値の自動判定を行います。
  nD9ロールも対応。
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

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

#translate

Constructor Details

#initialize(command) ⇒ Gundog

Returns a new instance of Gundog.



21
22
23
24
# File 'lib/bcdice/game_system/Gundog.rb', line 21

def initialize(command)
  super(command)
  @enabled_d9 = true
end

Instance Method Details

#result_1d100(total, _dice_total, cmp_op, target) ⇒ Object

ゲーム別成功度判定(1d100)



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/bcdice/game_system/Gundog.rb', line 27

def result_1d100(total, _dice_total, cmp_op, target)
  return nil unless cmp_op == :<=

  if total >= 100
    Result.fumble("ファンブル")
  elsif total <= 1
    Result.critical("絶対成功(達成値1+SL)")
  elsif target == "?"
    Result.nothing
  elsif total <= target
    dig10 = total / 10
    dig1 = total - dig10 * 10
    dig10 = 0 if dig10 >= 10
    dig1 = 0 if dig1 >= 10 # 条件的にはあり得ない(笑

    if dig1 <= 0
      Result.critical("クリティカル(達成値20+SL)")
    else
      Result.success("成功(達成値#{dig10 + dig1}+SL)")
    end
  else
    Result.failure("失敗")
  end
end