Class: BCDice::GameSystem::Siren

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

Constant Summary collapse

ID =

ゲームシステムの識別子

"Siren"
NAME =

ゲームシステム名

"終末アイドル育成TRPG セイレーン"
SORT_KEY =

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

"せいれえん"
HELP_MESSAGE =
"\u30FB\u5224\u5B9A: SL+a<=b\u00B1c\n  a=\u9054\u6210\u5024\u3078\u306E\u4FEE\u6B63(0\u306E\u5834\u5408\u306F\u7701\u7565)\n  b=\u80FD\u529B\u5024\n  c=\u5224\u5B9A\u3078\u306E\u4FEE\u6B63(0\u306E\u5834\u5408\u306F\u7701\u7565\u3001\u8907\u6570\u53EF)\n\u4F8B)\u5224\u5B9A\u4FEE\u6B63-10\u306E\u88C5\u5099\u3092\u88C5\u7740\u3057\u306A\u304C\u3089\u3010\u6280\u8853\uFF1A60\u3011\u3008\u5175\u5668\uFF1A2\u3009\u3067\u5224\u5B9A\u3059\u308B\u5834\u5408\u3002\nSL+2<=60+40-10\n\n\u30FB\u80B2\u6210: TR$a<=b\n  a=\u80B2\u6210\u3057\u305F\u56DE\u6570\n  b=\u30D8\u30EB\u30B9\n\u4F8B\uFF09\u30D8\u30EB\u30B9\u306E\u73FE\u5728\u5024\u304C60\u30672\u56DE\u76EE\u306E\u3010\u8EAB\u4F53\u3011\u306E\u80B2\u6210\u3092\u884C\u3046\u5834\u5408\u3002\nTR$2<=60\n"

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

#check_action(command) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/bcdice/game_system/Siren.rb', line 40

def check_action(command)
  parser = Command::Parser.new('SL', round_type: @round_type).restrict_cmp_op_to(:<=)
  parsed = parser.parse(command)
  return nil if parsed.nil?

  target = parsed.target_number

  dice = @randomizer.roll_once(100)

  if dice > target
    return Result.failure("(1D100<=#{target}) > #{dice} > 失敗")
  end

  dig10 = dice / 10
  dig1 = dice % 10
  if dig10 == 0
    dig10 = 10
  end
  if dig1 == 0
    dig1 = 10
  end
  achievement_value = dig10 + dig1 + parsed.modify_number
  return Result.success("(1D100<=#{target}) > #{dice} > 成功(達成値:#{achievement_value})")
end

#check_training(command) ⇒ Object



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/bcdice/game_system/Siren.rb', line 65

def check_training(command)
  parser = Command::Parser.new('TR', round_type: @round_type).restrict_cmp_op_to(:<=).enable_dollar.disable_modifier
  parsed = parser.parse(command)
  return nil if parsed.nil?

  count = parsed.dollar
  return nil if count.nil?

  target = parsed.target_number

  dice = @randomizer.roll_once(100)

  dig10 = dice / 10
  dig1 = dice % 10
  if dig10 == 0
    dig10 = 10
  end
  if dig1 == 0
    dig1 = 10
  end
  achievement_value = dig10 + dig1

  if dice > target
    return Result.failure("(1D100<=#{target}) > #{dice} > 失敗(能力値減少:10 / ヘルス減少:#{achievement_value})")
  end

  return Result.success("(1D100<=#{target}) > #{dice} > 成功(能力値上昇:#{count * 5 + achievement_value} / ヘルス減少:#{achievement_value})")
end

#eval_game_system_specific_command(command) ⇒ Object



32
33
34
35
36
37
38
# File 'lib/bcdice/game_system/Siren.rb', line 32

def eval_game_system_specific_command(command)
  case command
  when /^SL/ then check_action(command)
  when /^TR/ then check_training(command)
  else return nil
  end
end