Skip to content

Commit

Permalink
Trpg::Detatoko 更新
Browse files Browse the repository at this point in the history
* スキルランクから判定値を求めるコマンドを、分かりやすく ".dsr" でも実行できるようにした
* 一部のコードの可読性を高めた
  • Loading branch information
koi-chan committed Mar 25, 2015
1 parent ae17327 commit 40a7766
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
6 changes: 3 additions & 3 deletions lib/rgrb/plugin/trpg/detatoko/constants.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ module Plugin
module Trpg
module Detatoko
# スキルランクを表す正規表現
SR_RE = /s(\d+)/
SR_RE = /(?:s|sr)(\d+)/
# 固定値での四則演算を表す正規表現
SOLID_RE = %r|([+*\-/])(\d+)|
# フラグを指定した時の正規表現
FLAG_RE = /@(\d+)/
# フラグを指定した時の正規表現
FLAG_RE = /@(\d+)/
# コマンドのパターンの最後を表す正規表現
END_RE = /(?:[\s ]|$)/
# スタンス系統にマッチする正規表現
Expand Down
11 changes: 8 additions & 3 deletions lib/rgrb/plugin/trpg/detatoko/irc_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,15 @@ class IrcAdapter
match(/#{SR_RE}#{SOLID_RE}#{FLAG_RE}/io, method: :skill_decision)
match(/#{SR_RE}#{FLAG_RE}#{END_RE}/io, method: :skill_decision_flag)
match(/#{SR_RE}#{FLAG_RE}#{SOLID_RE}/io, method: :skill_decision_flag)

match(/(v|m|s|w)s/i, method: :stigma)
match(/(t|k)r/i, method: :stigma)
match(/(体|気)力烙印/i, method: :stigma)

match(/(v|m|s|w)be/i, method: :badend)
match(/(t|k)b/i, method: :badend)
match(/(体|気)力バッドエンド/i, method: :badend)

match(/stance[\s ]+(#{STANCE_RE})/io, method: :stance)
match(/スタンス[\s ]+(#{STANCE_RE})/io, method: :stance)

Expand All @@ -39,9 +42,11 @@ def initialize(*args)
# @return [void]
def skill_decision(m, skill_rank, calc = '+', solid = 0, flag = 0)
header = "#{@header}[#{m.user.nick}]: "
@generator.skill_decision(skill_rank.to_i, calc, solid.to_i, flag.to_i).each_line { |line|
m.target.send(header + line.chomp, true)
}
@generator
.skill_decision(skill_rank.to_i, calc, solid.to_i, flag.to_i)
.each_line { |line|
m.target.send(header + line.chomp, true)
}
end

# skill_decision のフラグ先行コマンド用ラッパー
Expand Down

0 comments on commit 40a7766

Please sign in to comment.