Class: BCDice::GameSystem::Sengensyou

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

Constant Summary collapse

ID =

ゲームシステムの識別子

'Sengensyou'
NAME =

ゲームシステム名

'千幻抄'
SORT_KEY =

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

'せんけんしよう'
HELP_MESSAGE =

ダイスボットの使い方

<<~INFO_MESSAGE_TEXT
  ・SGS 命中判定・回避判定
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, #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



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/bcdice/game_system/Sengensyou.rb', line 22

def eval_game_system_specific_command(command)
  # 命中判定・回避判定
  parser = Command::Parser.new('SGS', round_type: @round_type).restrict_cmp_op_to(nil)
  command = parser.parse(command)

  unless command
    return nil
  end

  dice_list = @randomizer.roll_barabara(3, 6)
  dice_total = dice_list.sum()
  is_critical = dice_total >= 16
  is_fumble = dice_total <= 5
  additional_text =
    if is_critical
      "クリティカル"
    elsif is_fumble
      "ファンブル"
    end
  modify_text = "#{dice_total}#{Format.modifier(command.modify_number)}" if command.modify_number != 0
  sequence = [
    "(3D6#{Format.modifier(command.modify_number)})",
    "#{dice_total}[#{dice_list.join(',')}]",
    modify_text,
    (dice_total + command.modify_number).to_s,
    additional_text,
  ].compact

  result = Result.new.tap do |r|
    r.text = sequence.join("")
    r.critical = is_critical
    r.fumble = is_fumble
  end
  return result
end