Skip to content

Commit

Permalink
detatoko-darkness: 定数データの構造を変更した
Browse files Browse the repository at this point in the history
  • Loading branch information
koi-chan committed Dec 26, 2016
1 parent e0000a6 commit 1ec9ac4
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 16 deletions.
55 changes: 43 additions & 12 deletions lib/rgrb/plugin/trpg/detatoko/gamedatas.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,22 +60,53 @@ class Generator
}

# クラス表
CLASSES = [
'勇者', '魔王', 'お姫様', 'ドラゴン', '戦士', '魔法使い',
'神聖', '暗黒', 'マスコット', 'モンスター', '謎', 'ザコ',
'メカ', '商人', '占い師' # フロンティア
]
CLASSES = {
'勇者' => 1,
'魔王' => 2,
'お姫様' => 3,
'ドラゴン' => 4,
'戦士' => 5,
'魔法使い' => 6,
'神聖' => 7,
'暗黒' => 8,
'マスコット' => 9,
'モンスター' => 10,
'謎' => 11,
'ザコ' => 12,
# フロンティア
'メカ' => 13,
'商人' => 14,
'占い師' => 15,
# ダークネス
'' => '',
'' => '',
'' => ''
}

# ポジション
POSITIONS = {
:pc => [
'冒険者', '凡人', '夢追い', '神話の住人', '負け犬', '守護者',
'悪党', 'カリスマ', '修羅', '遊び人', '従者', '正体不明',
'迷い子', '生ける伝説', '罪人', '傷追人', '型破り', '裏の住人'
],
:npc => [
:pc => {
:pages => 0,
:contents => [
'冒険者', '凡人', '夢追い', '神話の住人', '負け犬',
'守護者', '悪党', 'カリスマ', '修羅', '遊び人', '従者',
'正体不明', '迷い子', '生ける伝説', '罪人', '傷追人',
'型破り', '裏の住人'
]
},
:npc => {
:pages => 0,
:contents => [
'裏切者', '帝王', '悪の化身', '黒幕', '災厄', '侵略者'
]
]
},
:dark => {
:pages => 0,
:contents => [
'悪の華', '堕落者', '幹部', 'トリックスター', '無能', '支配者',
'狂的天才', '必要悪', '外道', '野獣', '死の使い', '破滅の因子'
]
}
}
end
end
Expand Down
6 changes: 4 additions & 2 deletions lib/rgrb/plugin/trpg/detatoko/generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ def ground(type = :normal)
# クラスを1つ選ぶ
# @return [String]
def character_class
result = @random.rand(1..15)
"%02d -> #{CLASSES.at(result - 1)}" % result
result = CLASSES.to_a.sample
"%02d -> #{result[0]}" % result[1]
end

# ポジションを1つ選ぶ
Expand All @@ -131,6 +131,8 @@ def position(type)
[@random.rand(POSITIONS[:pc].size), 42]
when :npc
[@random.rand(POSITIONS[:npc].size), 68]
when :dark
[@random.rand(POSITIONS[:dark].size), 46]
end

"#{POSITIONS[type][result]} (フロンティアp.#{result + page})"
Expand Down
7 changes: 5 additions & 2 deletions lib/rgrb/plugin/trpg/detatoko/irc_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class IrcAdapter

match(/c(?:[^s]|$)/i, method: :character_class)

match(/(|n)pp/i, method: :position)
match(/(|n|d)pp/i, method: :position)

match(/cs #{LCSIDS_RE}/io, method: :lcs)

Expand All @@ -48,7 +48,7 @@ class IrcAdapter
match(/ラスボス立場/i, method: :lastboss_ground, :prefix => prefix_ja)
match(/悪へのラスボス立場/i, method: :darkboss_ground, :prefix => prefix_ja)
match(/クラス/i, method: :character_class, :prefix => prefix_ja)
match(/(|敵)ポジション/i, method: :position, :prefix => prefix_ja)
match(/(|敵|悪)ポジション/i, method: :position, :prefix => prefix_ja)

def initialize(*args)
super
Expand Down Expand Up @@ -145,6 +145,9 @@ def position(m, type)
when 'n', '敵'
header[-10, 0] = '敵N'
:npc
when 'd', '悪'
header[-10, 0] = '悪の'
:dark
end
message = @generator.position(type)
m.target.send(header + message, true)
Expand Down

0 comments on commit 1ec9ac4

Please sign in to comment.