-
Notifications
You must be signed in to change notification settings - Fork 179
/
SwordWorld2_0.rb
223 lines (172 loc) · 7.19 KB
/
SwordWorld2_0.rb
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
101
102
103
104
105
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
135
136
137
138
139
140
141
142
143
144
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
# -*- coding: utf-8 -*-
# frozen_string_literal: true
require 'diceBot/SwordWorld'
class SwordWorld2_0 < SwordWorld
# ゲームシステムの識別子
ID = 'SwordWorld2.0'
# ゲームシステム名
NAME = 'ソードワールド2.0'
# ゲームシステム名の読みがな
SORT_KEY = 'そおとわあると2.0'
# ダイスボットの使い方
HELP_MESSAGE = <<INFO_MESSAGE_TEXT
自動的成功、成功、失敗、自動的失敗の自動判定を行います。
・レーティング表 (Kx)
"Kキーナンバー+ボーナス"の形で記入します。
ボーナスの部分に「K20+K30」のようにレーティングを取ることは出来ません。
また、ボーナスは複数取ることが出来ます。
レーティング表もダイスロールと同様に、他のプレイヤーに隠れてロールすることも可能です。
例)K20 K10+5 k30 k10+10 Sk10-1 k10+5+2
・クリティカル値の設定
クリティカル値は"[クリティカル値]"で指定します。
指定しない場合はクリティカル値10とします。
クリティカル処理が必要ないときは13などとしてください。(防御時などの対応)
またタイプの軽減化のために末尾に「@クリティカル値」でも処理するようにしました。
例)K20[10] K10+5[9] k30[10] k10[9]+10 k10-5@9
・レーティング表の半減 (HKx)
レーティング表の先頭または末尾に"H"をつけると、レーティング表を振って最終結果を半減させます。
クリティカル値を指定しない場合、クリティカルなしと扱われます。
例)HK20 K20h HK10-5@9 K10-5@9H K20gfH
・ダイス目の修正(運命変転やクリティカルレイ用)
末尾に「$修正値」でダイス目に修正がかかります。
$+1と修正表記ならダイス目に+修正、$9のように固定値ならダイス目をその出目に差し替え。
クリティカルした場合でも固定値や修正値の適用は最初の一回だけです。
例)K20$+1 K10+5$9 k10-5@9$+2 k10[9]+10$9
・首切り刀用レーティング上昇 r10
例)K20r10 K30+24@8R10 K40+24@8$12r10
・グレイテストフォーチュンは末尾に gf
例)K20gf K30+24@8GF K40+24@8$12r10gf
・超越判定用に2d6ロールに 2D6@10 書式でクリティカル値付与が可能に。
例)2D6@10 2D6@10+11>=30
・成長 (Gr)
末尾に数字を付加することで、複数回の成長をまとめて行えます。
例)Gr3
・防御ファンブル表 (FT)
防御ファンブル表を出すことができます。
・絡み効果表 (TT)
絡み効果表を出すことができます。
INFO_MESSAGE_TEXT
setPrefixes(['H?K\d+.*', 'Gr(\d+)?', 'FT', 'TT'])
def initialize
rating_table = 2
super()
@rating_table = rating_table
end
def rollDiceCommand(command)
case command
when /^Gr(\d+)?/i
if command =~ /^Gr(\d+)/i
growth(Regexp.last_match(1).to_i)
else
growth
end
when 'FT'
get_fumble_table
when 'TT'
get_tangle_table
else
super(command)
end
end
def getRateUpFromString(string)
rateUp = 0
regexp = /r\[(\d+)\]/i
if regexp === string
rateUp = Regexp.last_match(1).to_i
string = string.gsub(regexp, '')
end
return rateUp, string
end
def getAdditionalString(string, output)
output, values = super(string, output)
isGratestFortune, string = getGratestFortuneFromString(string)
values['isGratestFortune'] = isGratestFortune
output += "gf" if isGratestFortune
return output, values
end
def rollDice(values)
unless values['isGratestFortune']
return super(values)
end
dice, diceText = roll(1, 6)
dice *= 2
diceText = "#{diceText},#{diceText}"
return dice, diceText
end
def getGratestFortuneFromString(string)
isGratestFortune = false
regexp = /gf/i
if regexp === string
isGratestFortune = true
string = string.gsub(regexp, '')
end
return isGratestFortune, string
end
def is2dCritical
true
end
# SW2.0 の超成功用
# @param (see DiceBot#check2dCritical)
def check2dCritical(critical, dice_new, dice_arry, loop_count)
return if critical.nil? || critical <= 2
if loop_count == 0
return if dice_new == 12
return if dice_new == 2
end
if dice_new >= critical
dice_arry.push(2)
end
end
def check_nD6(total, dice_total, dice_list, cmp_op, target)
result = super(total, dice_total, dice_list, cmp_op, target)
return result unless result.nil?
string = bcdice.getOriginalMessage
superSuccessValue = 41
if /@(\d+)/ === string
critical = Regexp.last_match(1).to_i
if dice_total >= critical
if total >= superSuccessValue
return " > 超成功"
end
end
end
return result
end
def growth(count = 1)
((1..count).map { growth_step }).join " | "
end
def growth_step
d1, = roll(1, 6)
d2, = roll(1, 6)
a1 = get_ability_by_dice(d1)
a2 = get_ability_by_dice(d2)
return a1 != a2 ? "[#{d1},#{d2}]->(#{a1} or #{a2})" : "[#{d1},#{d2}]->(#{a1})"
end
def get_ability_by_dice(dice)
['器用度', '敏捷度', '筋力', '生命力', '知力', '精神力'][dice - 1]
end
def get_fumble_table()
table = [
'この表を2回振り、その両方を適用する。(同じ出目による影響は累積しない)。この自動失敗により得られる経験点は、+50点される',
'ダメージに、攻撃者を強化している「剣のかけら」の数が追加される',
'ダメージに、攻撃者の「レベル」が追加される',
'ダメージ決定を2回行い、より高い方を採用する',
'合算ダメージを2倍する',
'防護点無効'
]
text, num = get_table_by_1d6(table)
return "防御ファンブル表(#{num}) → #{text}"
end
def get_tangle_table()
table = [
'頭や顔:牙や噛みつきなどにおける命中力判定及び、魔法の行使やブレスに-2のペナルティ修正を受ける',
'武器や盾:武器の使用不可、又は盾の回避力修正及び防護点を無効化する',
'腕や手:武器や爪などにおける命中力判定に-2のペナルティ修正、盾を持つ腕方の腕ならその盾の回避力修正及び防護点を無効化する',
'脚や足:移動不可、更に回避力判定に-2のペナルティ修正を受ける ※両足に絡んでも累積しない',
'胴体:生命・精神抵抗力を基準値に用いる判定を除き、あらゆる行為判定に-1のペナルティ修正を受ける',
'特殊:尻尾や翼などに命中。絡められた部位を使用する判定において-2のペナルティ修正、またはそこが使えていたことによるボーナス修正を失う ※存在しない場合は決め直し'
]
text, num = get_table_by_1d6(table)
return "絡み効果表(#{num}) → #{text}"
end
end