Class: BCDice::GameSystem::UnsungDuet

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

Direct Known Subclasses

UnsungDuet_Korean

Constant Summary collapse

ID =
"UnsungDuet"
NAME =
"アンサング・デュエット"
SORT_KEY =
"あんさんくてゆえつと"
HELP_MESSAGE =
<<~MESSAGETEXT
  ■ シフター用判定 (shifter, UDS)
    1D10をダイスロールして判定を行います。
    例) shifter, UDS, shifter>=5, shifter+1>=6

  ■ バインダー用判定 (binder, UDB)
    2D6をダイスロールして判定を行います。
    例) binder, UDB, binder>=5, binder+1>=6

  ■ 変異表
    ・外傷 (HIN, HInjury)
    ・体調の変化 (HPH, HPhysical)
    ・恐怖 (HFE, HFear)
    ・幻想化 (HFA, HFantasy)
    ・精神 (HMI, HMind)
    ・そのほか (HOT, HOther)
MESSAGETEXT
ALIAS_1D10 =
["shifter", "UDS"].freeze
ALIAS_2D6 =
["binder", "UDB"].freeze
SHIFTER_ALIAS_REG =
/^#{ALIAS_1D10.join('|')}/i.freeze
BINDER_ALIAS_REG =
/^#{ALIAS_2D6.join('|')}/i.freeze
ALIAS =
{
  "HInjury" => "HIN",
  "HPhysical" => "HPH",
  "HFear" => "HFE",
  "HFantasy" => "HFA",
  "HMind" => "HMI",
  "HOther" => "HOT",
}.transform_keys(&:upcase)
TABLES =
translate_tables(:ja_jp)

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
# File 'lib/bcdice/game_system/UnsungDuet.rb', line 38

def eval_game_system_specific_command(command)
  command = ALIAS[command] || command

  roll_replaced_command_if_match(command, SHIFTER_ALIAS_REG, "1D10") ||
    roll_replaced_command_if_match(command, BINDER_ALIAS_REG, "2D6") ||
    roll_tables(command, self.class::TABLES)
end

#roll_replaced_command_if_match(command, regexp, dist) ⇒ Object



46
47
48
49
50
# File 'lib/bcdice/game_system/UnsungDuet.rb', line 46

def roll_replaced_command_if_match(command, regexp, dist)
  if command.match?(regexp)
    CommonCommand::AddDice.eval(command.sub(regexp, dist), self, @randomizer)
  end
end