bcdice 3.2.0 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +27 -3
  3. data/README.md +1 -1
  4. data/i18n/MagicaLogia/zh_hans.yml +564 -0
  5. data/i18n/StellarKnights/ja_jp.yml +2 -0
  6. data/i18n/StellarKnights/ko_kr.yml +498 -0
  7. data/i18n/zh_hans.yml +7 -0
  8. data/lib/bcdice/command/parsed.rb +11 -3
  9. data/lib/bcdice/command/parser.rb +179 -100
  10. data/lib/bcdice/common_command/barabara_dice/node.rb +2 -2
  11. data/lib/bcdice/common_command/barabara_dice/result.rb +6 -0
  12. data/lib/bcdice/game_system.rb +3 -0
  13. data/lib/bcdice/game_system/Amadeus.rb +110 -93
  14. data/lib/bcdice/game_system/AnimaAnimus.rb +15 -8
  15. data/lib/bcdice/game_system/BattleTech.rb +109 -28
  16. data/lib/bcdice/game_system/BeastBindTrinity.rb +28 -12
  17. data/lib/bcdice/game_system/BlindMythos.rb +38 -37
  18. data/lib/bcdice/game_system/CodeLayerd.rb +39 -39
  19. data/lib/bcdice/game_system/ColossalHunter.rb +34 -47
  20. data/lib/bcdice/game_system/DeadlineHeroes.rb +9 -8
  21. data/lib/bcdice/game_system/DoubleCross.rb +2 -0
  22. data/lib/bcdice/game_system/Emoklore.rb +22 -17
  23. data/lib/bcdice/game_system/FutariSousa.rb +12 -10
  24. data/lib/bcdice/game_system/GardenOrder.rb +11 -6
  25. data/lib/bcdice/game_system/KemonoNoMori.rb +25 -38
  26. data/lib/bcdice/game_system/KurayamiCrying.rb +86 -0
  27. data/lib/bcdice/game_system/LiveraDoll.rb +254 -304
  28. data/lib/bcdice/game_system/LogHorizon.rb +10 -7
  29. data/lib/bcdice/game_system/MagicaLogia_SimplifiedChinese.rb +66 -0
  30. data/lib/bcdice/game_system/MeikyuKingdomBasic.rb +2 -1
  31. data/lib/bcdice/game_system/Nechronica.rb +57 -91
  32. data/lib/bcdice/game_system/NinjaSlayer.rb +2 -3
  33. data/lib/bcdice/game_system/SRS.rb +17 -16
  34. data/lib/bcdice/game_system/SamsaraBallad.rb +38 -11
  35. data/lib/bcdice/game_system/Satasupe.rb +31 -31
  36. data/lib/bcdice/game_system/ScreamHighSchool.rb +3 -3
  37. data/lib/bcdice/game_system/Skynauts.rb +101 -140
  38. data/lib/bcdice/game_system/StarryDolls.rb +318 -0
  39. data/lib/bcdice/game_system/SteamPunkers.rb +11 -6
  40. data/lib/bcdice/game_system/StellarKnights.rb +28 -12
  41. data/lib/bcdice/game_system/StellarKnights_Korean.rb +79 -0
  42. data/lib/bcdice/game_system/TokumeiTenkousei.rb +4 -3
  43. data/lib/bcdice/game_system/TrinitySeven.rb +275 -276
  44. data/lib/bcdice/game_system/Utakaze.rb +52 -47
  45. data/lib/bcdice/game_system/Yggdrasill.rb +1 -1
  46. data/lib/bcdice/game_system/ZettaiReido.rb +20 -25
  47. data/lib/bcdice/version.rb +1 -1
  48. metadata +8 -2
@@ -18,87 +18,92 @@ module BCDice
18
18
  n個のサイコロで行為判定ロール。ゾロ目の最大個数を成功レベルとして表示。nを省略すると2UK扱い。
19
19
  例)3UK :サイコロ3個で行為判定
20
20
  例)UK :サイコロ2個で行為判定
21
- 不等号用いた成否判定は現時点では実装してません。
21
+ ・難易度付き行為判定ロール(nUK>=t)
22
+ tに難易度を指定した行為判定ロール。
23
+ 成功レベルと難易度tを比べて成否を判定します。
24
+ 例)6UK>=3 :サイコロ6個で行為判定して、成功レベル3が出れば成功。
22
25
  ・クリティカルコール付き行為判定ロール(nUK@c or nUKc)
23
-  cに「龍のダイス目」を指定した行為判定ロール。
24
- ゾロ目ではなく、cと同じ値の出目数x2が成功レベルとなります。
26
+ cに「龍のダイス目」を指定した行為判定ロール。
27
+ ゾロ目ではなく、cと同じ値の出目数x2が成功レベルとなります。難易度の指定も可能です。
25
28
  例)3UK@5 :龍のダイス「月」でクリティカルコール宣言したサイコロ3個の行為判定
26
29
  MESSAGETEXT
27
30
 
28
31
  register_prefix('\d*UK')
29
32
 
30
- def initialize(command)
31
- super(command)
32
- @arrayDragonDiceName = ['', '風', '雨', '雲', '影', '月', '歌']
33
- @enabled_upcase_input = false
34
- end
35
-
36
33
  def eval_game_system_specific_command(command)
37
34
  debug('eval_game_system_specific_command command', command)
38
35
 
39
- result = ''
36
+ check_roll(command)
37
+ end
40
38
 
41
- case command
42
- when /(\d+)?UK(@?(\d))?(>=(\d+))?/i
43
- base = (Regexp.last_match(1) || 2).to_i
44
- crit = Regexp.last_match(3).to_i
45
- diff = Regexp.last_match(5).to_i
46
- result = checkRoll(base, crit, diff)
47
- end
39
+ private
48
40
 
49
- return nil if result.empty?
41
+ DRAGON_DICE_NAME = {
42
+ 1 => "風",
43
+ 2 => "雨",
44
+ 3 => "雲",
45
+ 4 => "影",
46
+ 5 => "月",
47
+ 6 => "歌"
48
+ }.freeze
50
49
 
51
- return "#{command} > #{result}"
52
- end
50
+ def check_roll(command)
51
+ m = /^(\d+)?UK(@?(\d))?(>=(\d+))?$/i.match(command)
52
+ return nil unless m
53
53
 
54
- def checkRoll(base, crit, diff = 0)
55
- result = ""
54
+ base = (m[1] || 2).to_i
55
+ crit = m[3].to_i
56
+ diff = m[5].to_i
56
57
 
57
58
  base = getValue(base)
58
59
  crit = getValue(crit)
59
60
 
60
- return result if base < 1
61
+ return nil if base < 1
61
62
 
62
63
  crit = 6 if crit > 6
63
64
 
64
- result += "(#{base}d6)"
65
+ dice_list = @randomizer.roll_barabara(base, 6).sort
66
+ result = get_roll_result(dice_list, crit, diff)
65
67
 
66
- diceList = @randomizer.roll_barabara(base, 6).sort
67
-
68
- result += " > [#{diceList.join(',')}] > "
69
- result += getRollResultString(diceList, crit, diff)
68
+ sequence = [
69
+ command,
70
+ "(#{base}D6)",
71
+ "[#{dice_list.join(',')}]",
72
+ result.text
73
+ ]
74
+ result.text = sequence.join(" > ")
70
75
 
71
76
  return result
72
77
  end
73
78
 
74
- def getRollResultString(diceList, crit, diff)
75
- success, maxnum, setCount = getSuccessInfo(diceList, crit, diff)
79
+ def get_roll_result(diceList, crit, diff)
80
+ success, maxnum, setCount = getSuccessInfo(diceList, crit)
76
81
 
77
- result = ""
82
+ sequence = []
78
83
 
79
84
  if isDragonDice(crit)
80
- result += "龍のダイス「#{@arrayDragonDiceName[crit]}」(#{crit})を使用"
85
+ sequence.push("龍のダイス「#{DRAGON_DICE_NAME[crit]}」(#{crit})を使用")
81
86
  end
82
87
 
83
- if success
84
- result += "成功レベル:#{maxnum} (#{setCount}セット)"
85
- if diff != 0
86
- diffSuccess = (maxnum >= diff)
87
- if diffSuccess
88
- result += " > 成功"
89
- else
90
- result += " > 失敗"
91
- end
92
- end
93
-
88
+ if success
89
+ sequence.push("成功レベル:#{maxnum} (#{setCount}セット)")
94
90
  else
95
- result += "失敗"
91
+ sequence.push("失敗")
92
+ return Result.failure(sequence.join(" > "))
96
93
  end
97
94
 
98
- return result
95
+ if diff == 0
96
+ return Result.success(sequence.join(" > ")) # 難易度なしでも成功として扱う
97
+ elsif maxnum >= diff
98
+ sequence.push("成功")
99
+ return Result.success(sequence.join(" > "))
100
+ else
101
+ sequence.push("失敗")
102
+ return Result.failure(sequence.join(" > "))
103
+ end
99
104
  end
100
105
 
101
- def getSuccessInfo(diceList, crit, _diff)
106
+ def getSuccessInfo(diceList, crit)
102
107
  debug("checkSuccess diceList, crit", diceList, crit)
103
108
 
104
109
  diceCountHash = getDiceCountHash(diceList, crit)
@@ -109,7 +114,7 @@ module BCDice
109
114
  countThreshold = (isDragonDice(crit) ? 1 : 2)
110
115
 
111
116
  diceCountHash.each do |dice, count|
112
- maxnum = count if count > maxnum
117
+ maxnum = count if count > maxnum
113
118
  successDiceList << dice if count >= countThreshold
114
119
  end
115
120
 
@@ -88,7 +88,7 @@ module BCDice
88
88
 
89
89
  add_dice_randomizer = CommonCommand::AddDice::Randomizer.new(@randomizer, self)
90
90
  total = node.lhs.eval(self, add_dice_randomizer)
91
- rand_values = @randomizer.rand_results.map(&:first)
91
+ rand_values = add_dice_randomizer.rand_results.map(&:value)
92
92
 
93
93
  n1 = count_fumble(rand_values, lucky_state)
94
94
  n_max = count_critical(rand_values, lucky_state)
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'bcdice/base'
4
+
3
5
  module BCDice
4
6
  module GameSystem
5
7
  class ZettaiReido < Base
@@ -38,20 +40,23 @@ module BCDice
38
40
  mod, modText = getModInfo(modText)
39
41
  diff, diffText = getDiffInfo(diffValue)
40
42
 
41
- output = ""
42
- output += "(#{baseAvility}-2DR#{modText}#{diffText})"
43
- output += " > #{baseAvility}-#{diceTotal}[#{diceText}]#{modText}"
44
-
43
+ baseCommandText = "(#{baseAvility}-2DR#{modText}#{diffText})"
44
+ diceCommandText = "#{baseAvility}-#{diceTotal}[#{diceText}]#{modText}"
45
45
  total = baseAvility - diceTotal + mod
46
- output += " > #{total}"
47
46
 
48
- successText = getSuccessText(diceTotal, total, diff)
49
- output += successText
47
+ result = getResult(diceTotal, total, diff)
50
48
 
51
- darkPointText = getDarkPointResult(total, diff, darkPoint)
52
- output += darkPointText
49
+ darkPointText = "#{darkPoint}DP" if darkPoint > 0
53
50
 
54
- return output
51
+ result.text = [
52
+ baseCommandText,
53
+ diceCommandText,
54
+ total.to_i,
55
+ result.text,
56
+ darkPointText,
57
+ ].compact.join(" > ")
58
+
59
+ return result
55
60
  end
56
61
 
57
62
  def roll2DarkDice()
@@ -107,23 +112,13 @@ module BCDice
107
112
  return diffValue, diffText
108
113
  end
109
114
 
110
- def getDarkPointResult(_total, _diff, darkPoint)
111
- text = ''
112
-
113
- if darkPoint > 0
114
- text = " > #{darkPoint}DP"
115
- end
116
-
117
- return text
118
- end
119
-
120
- def getSuccessText(diceTotal, total, diff)
115
+ def getResult(diceTotal, total, diff)
121
116
  if diceTotal == 0
122
- return "クリティカル"
117
+ return Result.critical("クリティカル")
123
118
  end
124
119
 
125
120
  if diceTotal == 10
126
- return "ファンブル"
121
+ return Result.fumble("ファンブル")
127
122
  end
128
123
 
129
124
  if diff.nil?
@@ -132,10 +127,10 @@ module BCDice
132
127
 
133
128
  successLevel = (total - diff)
134
129
  if successLevel >= 0
135
- return "#{successLevel} 成功"
130
+ return Result.success("#{successLevel} 成功")
136
131
  end
137
132
 
138
- return ' > 失敗'
133
+ return Result.failure("失敗")
139
134
  end
140
135
  end
141
136
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BCDice
4
- VERSION = "3.2.0"
4
+ VERSION = "3.3.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bcdice
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.0
4
+ version: 3.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - SAKATA Sinji
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-23 00:00:00.000000000 Z
11
+ date: 2021-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
@@ -59,15 +59,18 @@ files:
59
59
  - i18n/LogHorizon/ko_kr.yml
60
60
  - i18n/MagicaLogia/ja_jp.yml
61
61
  - i18n/MagicaLogia/ko_kr.yml
62
+ - i18n/MagicaLogia/zh_hans.yml
62
63
  - i18n/MonotoneMuseum/ja_jp.yml
63
64
  - i18n/MonotoneMuseum/ko_kr.yml
64
65
  - i18n/Nechronica/ja_jp.yml
65
66
  - i18n/Nechronica/ko_kr.yml
66
67
  - i18n/StellarKnights/ja_jp.yml
68
+ - i18n/StellarKnights/ko_kr.yml
67
69
  - i18n/StratoShout/ja_jp.yml
68
70
  - i18n/StratoShout/ko_kr.yml
69
71
  - i18n/ja_jp.yml
70
72
  - i18n/ko_kr.yml
73
+ - i18n/zh_hans.yml
71
74
  - i18n/zh_hant.yml
72
75
  - lib/bcdice.rb
73
76
  - lib/bcdice/arithmetic.rb
@@ -232,6 +235,7 @@ files:
232
235
  - lib/bcdice/game_system/LostRoyal.rb
233
236
  - lib/bcdice/game_system/MagicaLogia.rb
234
237
  - lib/bcdice/game_system/MagicaLogia_Korean.rb
238
+ - lib/bcdice/game_system/MagicaLogia_SimplifiedChinese.rb
235
239
  - lib/bcdice/game_system/MeikyuDays.rb
236
240
  - lib/bcdice/game_system/MeikyuKingdom.rb
237
241
  - lib/bcdice/game_system/MeikyuKingdomBasic.rb
@@ -289,8 +293,10 @@ files:
289
293
  - lib/bcdice/game_system/ShoujoTenrankai.rb
290
294
  - lib/bcdice/game_system/Skynauts.rb
291
295
  - lib/bcdice/game_system/SkynautsBouken.rb
296
+ - lib/bcdice/game_system/StarryDolls.rb
292
297
  - lib/bcdice/game_system/SteamPunkers.rb
293
298
  - lib/bcdice/game_system/StellarKnights.rb
299
+ - lib/bcdice/game_system/StellarKnights_Korean.rb
294
300
  - lib/bcdice/game_system/SterileLife.rb
295
301
  - lib/bcdice/game_system/StrangerOfSwordCity.rb
296
302
  - lib/bcdice/game_system/StratoShout.rb