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 =
<<~TEXT
  ・判定: SL+a<=b±c
    a=達成値への修正(0の場合は省略)
    b=能力値
    c=判定への修正(0の場合は省略、複数可)
  例)判定修正-10の装備を装着しながら【技術:60】〈兵器:2〉で判定する場合。
  SL+2<=60+40-10

  ・育成: TR$a<=b
    a=育成した回数
    b=ヘルス
  例)ヘルスの現在値が60で2回目の【身体】の育成を行う場合。
  TR$2<=60
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

#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