d1lcs 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c339acdf61a0ed69d61dec2ca1ea27f40dbc24f9
4
- data.tar.gz: d48eb32147f2ce9bf01417df864e4099dd2e3d70
3
+ metadata.gz: 8ff396cdb40a2e945e4cec628228b2177522112d
4
+ data.tar.gz: 9973ddb26cc17116610c64cb6b3ef0b544ce9732
5
5
  SHA512:
6
- metadata.gz: 6e8c9bf2c5440903d85487888453fed485e37caa2e54192265372c29e62560de1c604358ce73c5abcb3afe2ee9b6f7551c6c87767e87a33da6970d0cf8536750
7
- data.tar.gz: 50dee5040376a55ec308a8f05e9e1910a44a2e8a16e1d43443f9de76121edac2a507d4374186353c11efe62842536d4dc5ef40edc02d1caf33499256e33bba01
6
+ metadata.gz: cc1a6bceb5bc02075aaf6dd4825cd39ee7c4b71d659178d829e1194d2fa80b21478acdbe825afb367ec30ebf835a9dd144f82ebcd076d0d3ea9a7105d6d1aac3
7
+ data.tar.gz: 57dd8098387c3a0e74acace3d37f329219de49e1eccc5477fa339fe645782c6e784a7df6164092d382588cb7e4fc7b3a4c1c4032b592bbb014cb20dafe252409
data/Rakefile CHANGED
@@ -1,7 +1,7 @@
1
1
  require "bundler/gem_tasks"
2
- #require "rspec/core/rake_task"
2
+ require "rspec/core/rake_task"
3
3
 
4
- #RSpec::Core::RakeTask.new(:spec)
4
+ RSpec::Core::RakeTask.new(:spec)
5
5
  Bundler::GemHelper.install_tasks
6
6
 
7
- #task :default => :spec
7
+ task :default => :spec
data/lib/d1lcs/element.rb CHANGED
@@ -36,20 +36,22 @@ module D1lcs
36
36
  return
37
37
  end
38
38
 
39
- @pcname = pcname
40
- @level = level
41
- @hpmp = hpmp
42
- @classes = classes
43
- @skills = skills
44
- @timing, @janre = timing_janre
45
- @charaID = charaID
46
- @plname = plname
39
+ @formatted = [pcname,
40
+ level,
41
+ hpmp,
42
+ classes,
43
+ position_skill,
44
+ skills,
45
+ timing_janre,
46
+ charaID,
47
+ plname
48
+ ].flatten
47
49
  end
48
50
 
49
51
  # 1行キャラクターシートを出力する
50
52
  # @return [String]
51
53
  def chara_sheet_line
52
- [@pcname, @level, @hpmp, @classes, @skills, @janre, @charaID, @plname].join('|')
54
+ @formatted.clone.fill(nil, 6..6).compact.join('|')
53
55
  end
54
56
  alias :print :chara_sheet_line
55
57
  alias :to_s :chara_sheet_line
@@ -90,15 +92,31 @@ module D1lcs
90
92
  @chara_sheet['skill'].map { |array| array['name'].chars.first }.join
91
93
  end
92
94
 
95
+ # ポジションスキル
96
+ # @return [String]/[nil]
97
+ def position_skill
98
+ if(@chara_sheet['position'])
99
+ positionID_short(@chara_sheet['position']['id'])
100
+ else
101
+ '  '
102
+ end
103
+ end
104
+
93
105
  # スキルタイミング・ジャンル
94
106
  # @return [Array<String>] [timing, string] の順番
95
107
  def timing_janre
96
- timing = [0, 2, 1, 0]
97
- janre = Array.new(6, 0)
108
+ timing = [0, 1, 2, 0] # 常時, 対応, 行動, 誘発
109
+ janre = Array.new(6, 0) # 意志, 感覚, 交渉, 肉体, 技術, 知識
98
110
  @chara_sheet['skill'].each { |skill|
99
- timing[skill['timing'].to_i - 1] += 1
111
+ timing[skill['timing'].to_i] += 1
100
112
  janre[skill['janre'].to_i - 1] += 1
113
+ p skill['timing_name']
101
114
  }
115
+ if(@chara_sheet['position'])
116
+ timing[@chara_sheet['position_skill']['timing'].to_i] += 1
117
+ janre[@chara_sheet['position_skill']['janre'].to_i - 1] += 1
118
+ end
119
+ p timing
102
120
  [timing, janre].map { |array|
103
121
  array.map { |value|
104
122
  unify_dispsize2(value.to_s).tr('0', ' ')
@@ -175,5 +193,16 @@ module D1lcs
175
193
  ]
176
194
  class_ids[class_id.to_i - 1]
177
195
  end
196
+
197
+ # ポジションIDから全角2文字の短縮形に変換する
198
+ # @param [Fixnum] position_id JSONから読み込むことを考慮し文字列型
199
+ # @return [String]
200
+ def positionID_short(position_id)
201
+ position_ids = ['冒険', '凡人', '夢追', '神話', '負犬', '守護',
202
+ '悪党', 'カリ', '修羅', '遊人', '従者', '不明',
203
+ '迷子', '伝説', '罪人', '傷追', '型破', '裏住'
204
+ ]
205
+ position_ids[position_id - 1]
206
+ end
178
207
  end
179
208
  end
data/lib/d1lcs/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module D1lcs
2
- VERSION = "0.4.0"
2
+ VERSION = "0.5.0"
3
3
  USER_AGENT = "Ruby/#{RUBY_VERSION} (#{RUBY_DESCRIPTION}) d1lcs-gem/#{VERSION}"
4
4
  end
data/lib/d1lcs.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  # coding: UTF-8
2
+
2
3
  require 'd1lcs/version'
3
4
  require 'd1lcs/string'
4
5
  require 'd1lcs/element'
@@ -14,6 +15,7 @@ module D1lcs
14
15
  'Lv',
15
16
  '体力 気力 旗',
16
17
  'クラス ',
18
+ 'ポジ',
17
19
  'スキル   ',
18
20
  '意感交肉技知',
19
21
  'ID ',
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: d1lcs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - koi-chan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-17 00:00:00.000000000 Z
11
+ date: 2015-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler