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 =
"\u25A0 \u30B7\u30D5\u30BF\u30FC\u7528\u5224\u5B9A (shifter, UDS)\n  1D10\u3092\u30C0\u30A4\u30B9\u30ED\u30FC\u30EB\u3057\u3066\u5224\u5B9A\u3092\u884C\u3044\u307E\u3059\u3002\n  \u4F8B\uFF09 shifter, UDS, shifter>=5, shifter+1>=6\n\n\u25A0 \u30D0\u30A4\u30F3\u30C0\u30FC\u7528\u5224\u5B9A (binder, UDB)\n  2D6\u3092\u30C0\u30A4\u30B9\u30ED\u30FC\u30EB\u3057\u3066\u5224\u5B9A\u3092\u884C\u3044\u307E\u3059\u3002\n  \u4F8B\uFF09 binder, UDB, binder>=5, binder+1>=6\n\n\u25A0 \u5909\u7570\u8868\n  \u30FB\u5916\u50B7 (HIN, HInjury)\n  \u30FB\u4F53\u8ABF\u306E\u5909\u5316 (HPH, HPhysical)\n  \u30FB\u6050\u6016 (HFE, HFear)\n  \u30FB\u5E7B\u60F3\u5316 (HFA, HFantasy)\n  \u30FB\u7CBE\u795E (HMI, HMind)\n  \u30FB\u305D\u306E\u307B\u304B (HOT, HOther)\n"
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