Class: BCDice::GameSystem::TrinitySeven

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

Constant Summary collapse

ID =

ゲームシステムの識別子

'TrinitySeven'
NAME =

ゲームシステム名

'トリニティセブンRPG'
SORT_KEY =

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

'とりにていせふんRPG'
HELP_MESSAGE =

ダイスボットの使い方

<<~MESSAGETEXT
  クリティカルが変動した命中及び、7の出目がある場合のダメージ計算が行なえます。
  なお、通常の判定としても利用できます。

  ・発動/命中 [TR(±c*)<=(x)±(y*)又は TR<=(x)など]*は必須ではない項目です。
  "TR(クリティカルの修正値*)<=(発動/命中)±(発動/命中の修正値*)"
  加算減算のみ修正値も付けられます。 [修正値]は必須ではありません。
  例)TR<=50	TR<=60+20	TR7<=40	TR-7<=80	TR+10<=80+20

  ・ダメージ計算 [(x)DM(c*)±(y*)又は(x)DM(c*)又は(x)DM±(y*)]*は必須ではない項目です。
  "(ダイス数)DM(7の出目の数*)+(修正*)"
  加算減算のみ修正値も付けられます。 [7の出目の数]および[修正値]は必須ではありません。
  例)6DM2+1	5DM2	4DM		3DM+3
  後から7の出目に変更する場合はC(7*6+5)のように入力して計算してください。

  ・名前表 [TRNAME]
  名字と名前を出します。PCや突然現れたNPCの名付けにどうぞ。

MESSAGETEXT

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_1D100(_total, dice_total, _cmp_op, _target) ⇒ Object



136
137
138
139
140
141
142
# File 'lib/bcdice/game_system/TrinitySeven.rb', line 136

def check_1D100(_total, dice_total, _cmp_op, _target)
  if dice_total >= 96
    " > ファンブル"
  elsif dice_total <= 7
    " > クリティカル"
  end
end

#eval_game_system_specific_command(command) ⇒ Object

スパゲッティなコードだけど許して!!! → 絶対に許さない。全力でリファクタリングした。



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

def eval_game_system_specific_command(command) # スパゲッティなコードだけど許して!!! → 絶対に許さない。全力でリファクタリングした。
  debug("eval_game_system_specific_command command", command)

  if /TRNAME/ =~ command
    firstName, = get_NAME_table
    secondName, = get_NAMEtwo_table
    return "#{firstName} , #{secondName}"
  end

  if /^TR([+\-\d]*)<=(\d*)([+\-\d]*)/ =~ command
    critical = Regexp.last_match(1).to_i + 7
    target = Regexp.last_match(2).to_i
    modify = Regexp.last_match(3).to_i
    return rollHit(command, critical, target, modify)
  end

  if /^(\d*)DM(\d*)([+\-\d]*)$/ =~ command
    diceCount = Regexp.last_match(1).to_i
    critical = Regexp.last_match(2).to_i
    modify = Regexp.last_match(3).to_i
    return rollDamage(command, diceCount, critical, modify)
  end

  return ''
end

#get_NAME_tableObject

名前表



145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
# File 'lib/bcdice/game_system/TrinitySeven.rb', line 145

def get_NAME_table
  table = [
    [1, '春日'],
    [2, '浅見'],
    [3, '風間'],
    [4, '神無月'],
    [5, '倉田'],
    [6, '不動'],
    [7, '山奈'],
    [8, 'シャルロック'],
    [9, '霧隠'],
    [10, '果心'],
    [11, '今井'],
    [12, '長瀬'],
    [13, '明智'],
    [14, '風祭'],
    [15, '志貫'],
    [16, '一文字'],
    [17, '月夜野'],
    [18, '桜田門'],
    [19, '果瀬'],
    [20, '九十九'],
    [21, '速水'],
    [22, '片桐'],
    [23, '葉月'],
    [24, 'ウィンザー'],
    [25, '時雨里'],
    [26, '神城'],
    [27, '水際'],
    [28, '一ノ江'],
    [29, '仁藤'],
    [30, '北千住'],
    [31, '西村'],
    [32, '諏訪'],
    [33, '藤宮'],
    [34, '御代'],
    [35, ''],
    [36, '霧生'],
    [37, '白石'],
    [38, '椎名'],
    [39, '綾小路'],
    [40, '二条'],
    [41, '光明寺'],
    [42, '春秋'],
    [43, '雪見'],
    [44, '刀条院'],
    [45, 'ランカスター'],
    [46, 'ハクア'],
    [47, 'エルタニア'],
    [48, 'ハーネス'],
    [49, 'アウグストゥス'],
    [50, '椎名町'],
    [51, '鍵守'],
    [52, '茜ヶ崎'],
    [53, '鎮宮'],
    [54, '美柳'],
    [55, '鎖々塚'],
    [56, '櫻ノ杜'],
    [57, '鏡ヶ守'],
    [58, '輝井'],
    [59, '南陽'],
    [60, '雪乃城'],
    [61, '六角屋'],
    [62, '鈴々'],
    [63, '東三条'],
    [64, '朱雀院'],
    [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, '達人'],
    [93, '賢者'],
    [94, '疾風'],
    [95, '海の'],
    [96, '最強'],
    [97, '凶器'],
    [98, '灼熱'],
    [99, '人間兵器'],
    [100, '魔王'],
  ]

  dice_now = @randomizer.roll_once(100)

  return get_table_by_number(dice_now, table)
end

#get_NAMEtwo_tableObject



254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
# File 'lib/bcdice/game_system/TrinitySeven.rb', line 254

def get_NAMEtwo_table
  table = [
    [1, 'アラタ/聖'],
    [2, 'アビィス/リリス'],
    [3, 'ルーグ/レヴィ'],
    [4, 'ラスト/アリン'],
    [5, 'ソラ/ユイ'],
    [6, 'イーリアス/アキオ'],
    [7, 'アカーシャ/ミラ'],
    [8, 'アリエス/リーゼロッテ'],
    [9, 'ムラサメ/シャルム'],
    [10, '龍貴/竜姫'],
    [11, '英樹/春菜'],
    [12, '準一/湊'],
    [13, '急司郎/光理'],
    [14, '夕也/愛奈'],
    [15, '晴彦/アキ'],
    [16, '疾風/ヤシロ'],
    [17, 'カガリ/灯花'],
    [18, '次郎/優都'],
    [19, '春太郎/静理'],
    [20, 'ジン/時雨'],
    [21, 'イオリ/伊織'],
    [22, 'ユウヒ/優姫'],
    [23, 'サツキ/翠名'],
    [24, 'シュライ/サクラ'],
    [25, 'ミナヅキ/姫乃'],
    [26, 'カエデ/優樹菜'],
    [27, 'ハル/フユ'],
    [28, 'オdール/瑞江'],
    [29, 'ニトゥレスト/キリカ'],
    [30, 'スカー/綾瀬'],
    [31, '真夏/小夏'],
    [32, '光一/ののか'],
    [33, '彩/翠'],
    [34, 'トウカ/柊花'],
    [35, '命/ミコト'],
    [36, '司/つかさ'],
    [37, 'ゆとり/なごみ'],
    [38, '冬彦/観月'],
    [39, 'カレン/華恋'],
    [40, '清次郎/亜矢'],
    [41, 'サード/夢子'],
    [42, 'ボックス/詩子'],
    [43, 'ヘリオス/カエデ'],
    [44, 'ゲート/京香'],
    [45, 'オンリー/パトリシア'],
    [46, 'ザッハーク/アーリ'],
    [47, 'ラスタバン/ラスティ'],
    [48, '桜花/燁澄'],
    [49, '計都/リヴィア'],
    [50, 'カルヴァリオ/香夜'],
    [51, '悠人/夜々子'],
    [52, '太子/羽菜'],
    [53, '夕立/夕凪'],
    [54, 'アルフ/愛美'],
    [55, 'ファロス/灯利'],
    [56, 'スプートニク/詩姫'],
    [57, 'アーネスト/累'],
    [58, 'ナイン/カグヤ'],
    [59, 'クリア/ヒマワリ'],
    [60, 'ウォーカー/オリビア'],
    [61, 'ダーク/クオン'],
    [62, 'ウェイヴ/凛'],
    [63, 'ルーン/マリエ'],
    [64, 'エンギ/セイギ'],
    [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, 'スポーツ選手の名前(ベッカム、沙保里など)'],
    [93, '学者の名前(ソクラテス、エレナなど)'],
    [94, 'アイドルの名前(タクヤ、聖子など)'],
    [95, '土地、国、町の名前(イングランド、ワシントンなど)'],
    [96, 'モンスターの名前(ドラゴン、ラミアなど)'],
    [97, '武器防具の名前(ソード、メイルなど)'],
    [98, '自然現象の名前(カザンハリケーンなど)'],
    [99, '機械の名前(洗濯機、テレビなど)'],
    [100, '目についた物の名前(シャーペン、メガネなど)'],
  ]

  dice_now = @randomizer.roll_once(100)

  return get_table_by_number(dice_now, table)
end

#getHitRollResult(total, target, critical) ⇒ Object



76
77
78
79
80
81
82
83
# File 'lib/bcdice/game_system/TrinitySeven.rb', line 76

def getHitRollResult(total, target, critical)
  return "ファンブル" if total >= 96
  return "クリティカル" if total <= critical

  return "成功" if total <= target

  return "失敗"
end

#getRollDamageCritialText(diceCount, critical, total, diceText, modify) ⇒ Object



106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/bcdice/game_system/TrinitySeven.rb', line 106

def getRollDamageCritialText(diceCount, critical, total, diceText, modify)
  diceList = []

  if critical == 0
    total += modify
    return total, diceList
  end

  diceList = diceText.split(/,/).map(&:to_i)

  diceList.sort!
  restDice = diceList.clone

  critical = diceCount if critical > diceCount

  critical.times do
    restDice.shift
    diceList.shift
    diceList.push(7)
  end

  max = restDice.pop
  max = 1 if max.nil?

  total = max * (7**critical) + modify
  restDice.each { |i| total += i }

  return total, diceList
end

#rollDamage(command, diceCount, critical, modify) ⇒ Object



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/bcdice/game_system/TrinitySeven.rb', line 85

def rollDamage(command, diceCount, critical, modify)
  return "" if diceCount < critical

  dice_list = @randomizer.roll_barabara(diceCount, 6)
  total = dice_list.sum()
  diceText = dice_list.join(",")

  additionalListText = ""
  total, additionalList = getRollDamageCritialText(diceCount, critical, total, diceText, modify)

  additionalListText = "→[#{additionalList.join(',')}]" unless additionalList.empty?

  modifyText = ""
  modifyText = "+#{modify}" if modify > 0
  modifyText = modify.to_s if modify < 0

  text = "(#{command}) [#{diceText}]#{additionalListText}#{modifyText}#{total}"

  return text
end

#rollHit(command, critical, target, modify) ⇒ Object



64
65
66
67
68
69
70
71
72
73
74
# File 'lib/bcdice/game_system/TrinitySeven.rb', line 64

def rollHit(command, critical, target, modify)
  target += modify

  total = @randomizer.roll_once(100)
  result = getHitRollResult(total, target, critical)

  text = "(#{command}) > #{total}[#{total}] > #{result}"
  debug("eval_game_system_specific_command result text", text)

  return text
end