drpedia_lite 0.0.10 → 0.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 150897cbb97eaaf71dbe69cb1a24e21d470aaf74
4
- data.tar.gz: 987c33a54b5ec8da734a2d979c9e1a17271381c3
3
+ metadata.gz: 358ad75f9e4734dff6d4a472ab2f64a49f774c4d
4
+ data.tar.gz: 610ea0637481581fffe2ff0bc8f393b78584d3c0
5
5
  SHA512:
6
- metadata.gz: 275f58052320e70b4828d4328a98d18f91ff8b3aabfd0c3efcdb97a8fb53d61cdbe5fdbc2d1835846eff33682bcd4d275a2889d92c69b4e8c8c86cb6cb5b5a54
7
- data.tar.gz: c17282dc9f1e20566c3fda34f2f9b22db74b371888226c1d793123c4ecbb484094a11baa073067124abc081f28ebcad6a3ea93882150baa54ec12afd1426da6a
6
+ metadata.gz: 665d5e323f6cd5b045f4bcbb565a6fa63ecdc9c3f6bbeb83ad17dbe4794754f0a5d6dfe4d8c52e6f46063e121d61d88e7032d1c833d4a9976aa262be00cbb81d
7
+ data.tar.gz: d0b195d516f122590288d53f9cb3a549f22e0abcadac4532a86e66fc18979f1b7bce4889d98e34afcad1fa898e8630c9a476e5e0a1db15fac8c6a0dd7e70e021
data/lib/Builder.rb CHANGED
@@ -10,7 +10,9 @@ class Builder
10
10
  skill_group: raw_reader.skill_group,
11
11
  skill_cat: raw_reader.skill_cat,
12
12
  strains: raw_reader.strains,
13
- professions: raw_reader.professions
13
+ professions: raw_reader.professions,
14
+ strain_stats: raw_reader.strain_stats,
15
+ strain_specs: raw_reader.strain_specs
14
16
 
15
17
  File.open(File.join(base_output_path, 'strains.json'), 'w') { |f| f.write raw_reader.strains.to_a.to_json }
16
18
  File.open(File.join(base_output_path, 'professions.json'), 'w') { |f| f.write raw_reader.professions.to_a.to_json }
@@ -18,5 +20,7 @@ class Builder
18
20
  File.open(File.join(base_output_path, 'skill_cat.json'), 'w') { |f| f.write raw_reader.skill_cat.to_json }
19
21
  File.open(File.join(base_output_path, 'skill_group.json'), 'w') { |f| f.write raw_reader.skill_group.to_json }
20
22
  File.open(File.join(base_output_path, 'skill_list.json'), 'w') { |f| f.write raw_reader.skill_list.to_json }
23
+ File.open(File.join(base_output_path, 'strain_stats.json'), 'w') { |f| f.write raw_reader.strain_stats.to_json }
24
+ File.open(File.join(base_output_path, 'strain_specs.json'), 'w') { |f| f.write raw_reader.strain_specs.to_json }
21
25
  end
22
26
  end
data/lib/RawReader.rb CHANGED
@@ -1,16 +1,19 @@
1
1
  require 'set'
2
2
 
3
3
  class RawReader
4
- attr_reader :skill_list, :skill_cat, :strains, :professions, :strain_restrictions, :skill_group
4
+ attr_reader :skill_list, :skill_cat, :strains, :professions, :strain_restrictions, :skill_group, :strain_stats, :strain_specs
5
5
  STATE_TRANSITION = {
6
- :undef => { pattern: /== Advantage Skill ==/, next: :innate },
7
- :innate => { pattern: /== Innate Skill Prerequisite ==/, next: :innate_preq },
8
- :innate_preq => { pattern: /== Strain Profession Restriction ==/, next: :strain_rtrs },
9
- :strain_rtrs => { pattern: /== Open Skill ==/, next: :open },
10
- :open => { pattern: /==/, next: :profession },
11
- :profession => { pattern: /== Skill Group ==/, next: :skill_group },
12
- :skill_group => { pattern: /== Skill List ==/, next: :list },
13
- :list => { pattern: /./, next: :list }
6
+ :undef => { pattern: /== Advantage Skill ==/, next: :innate },
7
+ :innate => { pattern: /== Disadvantage Skill ==/, next: :strain_disadv },
8
+ :strain_disadv => { pattern: /== Innate Skill Prerequisite ==/, next: :innate_preq },
9
+ :innate_preq => { pattern: /== Strain Profession Restriction ==/, next: :strain_rtrs },
10
+ :strain_rtrs => { pattern: /== Strain Stats ==/, next: :strain_stats },
11
+ :strain_stats => { pattern: /== Strain Specific Skills ==/, next: :strain_specs },
12
+ :strain_specs => { pattern: /== Open Skill ==/, next: :open },
13
+ :open => { pattern: /==/, next: :profession },
14
+ :profession => { pattern: /== Skill Group ==/, next: :skill_group },
15
+ :skill_group => { pattern: /== Skill List ==/, next: :list },
16
+ :list => { pattern: /./, next: :list }
14
17
  }
15
18
 
16
19
  def initialize filepath:
@@ -20,6 +23,8 @@ class RawReader
20
23
  @strains = Set.new
21
24
  @strain_restrictions = Hash.new
22
25
  @skill_group = Hash.new
26
+ @strain_specs = Hash.new
27
+ @strain_stats = Hash.new
23
28
  @professions = Set.new
24
29
 
25
30
  begin
@@ -40,6 +45,7 @@ private
40
45
  def post_process_sets
41
46
  @skill_cat.each do |_junk, data|
42
47
  data[:innate] = data[:innate].to_a
48
+ data[:innate_disadvantage] = data[:innate_disadvantage].to_a
43
49
  end
44
50
  end
45
51
 
@@ -79,8 +85,11 @@ private
79
85
 
80
86
  case state
81
87
  when :innate then process_innate_skills line: line
88
+ when :strain_disadv then process_innate_skills line: line, disadvantage: true
82
89
  when :innate_preq then process_innate_preqs line: line
83
90
  when :strain_rtrs then process_strain_restrictions line: line
91
+ when :strain_stats then process_strain_stats line: line
92
+ when :strain_specs then process_strain_specs line: line
84
93
  when :open then process_open_skills line: line
85
94
  when :profession then process_profession_skills line: line, profession: profession
86
95
  when :skill_group then process_skill_group line: line
@@ -88,12 +97,12 @@ private
88
97
  end
89
98
  end
90
99
 
91
- def process_innate_skills line:
100
+ def process_innate_skills line:, disadvantage: false
92
101
  innate_skill = line.split(/:/)
93
102
  strain = innate_skill[0].to_sym
94
103
  skills = innate_skill[1].split(/,/)
95
104
 
96
- smart_insert strain: strain, skills: skills
105
+ smart_insert strain: strain, skills: skills, disadvantage: disadvantage
97
106
  end
98
107
 
99
108
  def process_innate_preqs line:
@@ -120,6 +129,33 @@ private
120
129
  end
121
130
  end
122
131
 
132
+ def process_strain_specs line:
133
+ clusters = line.split(/:/)
134
+ right_cluster = clusters[1].split(/\|/)
135
+
136
+ strain = clusters[0].strip.to_sym
137
+ adv = Array.new
138
+ dis = Array.new
139
+ right_cluster[0].split(/\,/).each { |x| adv.push(x.strip.to_sym )}
140
+ right_cluster[1].split(/\,/).each { |x| dis.push(x.strip.to_sym )}
141
+
142
+ @strain_specs[strain] = {
143
+ advantages: adv,
144
+ disadvantages: dis
145
+ }
146
+ end
147
+
148
+ def process_strain_stats line:
149
+ clusters = line.split(/:/)
150
+ right_cluster = clusters[1].split(/\,/)
151
+
152
+ @strain_stats[clusters[0].strip.to_sym] = {
153
+ hp: right_cluster[0].strip.to_i,
154
+ mp: right_cluster[1].strip.to_i,
155
+ infection: right_cluster[2].strip.to_i
156
+ }
157
+ end
158
+
123
159
  def process_skill_group line:
124
160
  @skill_group[line.strip.to_sym] = Hash.new
125
161
  end
@@ -172,7 +208,7 @@ private
172
208
  end
173
209
  end
174
210
 
175
- def smart_insert strain: nil, skills: nil, open_skills: nil, profession_skills: nil
211
+ def smart_insert strain: nil, skills: nil, open_skills: nil, profession_skills: nil, disadvantage: false
176
212
  if strain and skills
177
213
  @strains.add strain
178
214
  skills.each do |_skill|
@@ -180,9 +216,15 @@ private
180
216
  skill = _skill.strip.to_sym
181
217
  @skill_cat[skill] ||= Hash.new
182
218
  @skill_cat[skill][:innate] ||= Set.new
183
- skill_cat_innate = @skill_cat[skill][:innate]
184
-
185
- skill_cat_innate.add strain.to_sym
219
+ @skill_cat[skill][:innate_disadvantage] ||= Set.new
220
+
221
+ if !disadvantage
222
+ skill_cat_innate = @skill_cat[skill][:innate]
223
+ skill_cat_innate.add strain.to_sym
224
+ else
225
+ skill_cat_innate = @skill_cat[skill][:innate_disadvantage]
226
+ skill_cat_innate.add strain.to_sym
227
+ end
186
228
  end
187
229
  elsif open_skills
188
230
  @skill_cat[open_skills[:skill]] ||= Hash.new
data/lib/Validator.rb CHANGED
@@ -2,15 +2,25 @@ require 'test/unit/assertions'
2
2
 
3
3
  class Validator
4
4
  include Test::Unit::Assertions
5
- def initialize skill_list:, skill_group:, skill_cat:, strains:, professions:
5
+ def initialize skill_list:,
6
+ skill_group:,
7
+ skill_cat:,
8
+ strains:,
9
+ professions:,
10
+ strain_stats:,
11
+ strain_specs:
6
12
  @skill_list = skill_list
7
13
  @skill_group = skill_group
8
14
  @skill_cat = skill_cat
9
15
  @strains = strains
10
16
  @professions = professions
17
+ @strain_stats = strain_stats
18
+ @strain_specs = strain_specs
11
19
 
12
20
  validate_non_empty
13
21
  validate_skill_name_matches
22
+ validate_stats
23
+ validate_strain_specs
14
24
  end
15
25
 
16
26
  private
@@ -21,6 +31,28 @@ private
21
31
  assert(@professions.length > 0, "Empty professions")
22
32
  end
23
33
 
34
+ def validate_strain_specs
35
+ cumulative_strain_specs = Hash.new
36
+
37
+ @strain_specs.each do |strain, specs|
38
+ is_in_strain?(strain)
39
+ specs[:advantages].concat(specs[:disadvantages]).each do |spec|
40
+ assert(cumulative_strain_specs[spec] == nil,
41
+ "Duplicate strain-specific skill: [#{strain}] [#{spec}]")
42
+
43
+ cumulative_strain_specs[spec] = true
44
+ end
45
+ end
46
+ end
47
+
48
+ def validate_stats
49
+ @strain_stats.each do |strain, stats|
50
+ is_in_strain?(strain)
51
+ assert(stats.keys.sort == [:hp, :mp, :infection].sort,
52
+ "Strain stats must contain HP, MP and Infection")
53
+ end
54
+ end
55
+
24
56
  def validate_skill_name_matches
25
57
  mismatches = Array.new
26
58
  @skill_cat.each do |skill_name, sdata|
@@ -32,7 +64,7 @@ private
32
64
 
33
65
  sdata.each do |stype, stdata|
34
66
  case stype
35
- when :innate
67
+ when :innate, :innate_disadvantage
36
68
  stdata.each do |strain|
37
69
  is_in_strain?(strain)
38
70
  end
data/lib/input/input.txt CHANGED
@@ -21,11 +21,68 @@ Unborn of Teixiptla: Melee Weapon - Two Handed, Psionic Skill - Basic, Throwing
21
21
  Vegasians: Backstab, Black Market Connections, Cheat, Entertain, Lie, Literacy
22
22
  Yorker: Barricade, Bomb Awareness, Chase, Entertain, Interfere, Melee Weapon - Standard
23
23
 
24
+ == Disadvantage Skill ==
25
+ Natural Ones: Bolt Action
26
+
24
27
  == Innate Skill Prerequisite ==
25
28
  Iron Slaves: Iron Fists: Brawling
26
29
 
27
30
  == Strain Profession Restriction ==
31
+ Baywalkers: Sawbones, Primitive, Thug
32
+ Diesel Jocks: Farmer, Politician, Publican
33
+ Lascarians: Charlatan, Entertainer, Gambler, Hook-Up, Merchant, Officer, Politician, Ring Leader
28
34
  Mericans: Martial Artist, Spy
35
+ The Red Star: Caravan Driver, Charlatan, Entertainer, Gambler, Priest
36
+ Semper Mort: Pugilist
37
+ Unborn of Teixiptla: Engineer, Mad Scientist, Psionist
38
+ Vegasians: Guard, Gun Slinger, Martial Artist, Officer
39
+ Yorker: Charlatan, Officer, Politician
40
+
41
+ == Strain Stats ==
42
+ Baywalkers: 8, 10, 4
43
+ Diesel Jocks: 10, 10, 3
44
+ Full Dead: 20, 10, 1
45
+ Genjian: 6, 6, 5
46
+ Iron Slaves: 7, 4, 4
47
+ Lascarians: 10, 5, 5
48
+ Mericans: 13, 10, 2
49
+ Nation of Accensor: 8, 8, 5
50
+ Natural Ones: 10, 6, 4
51
+ Pure Blood: 6, 12, 3
52
+ Reclaimers: 8, 13, 2
53
+ The Red Star: 6, 6, 6
54
+ Remnants: 5, 5, 6
55
+ Retrogrades: 10, 10, 4
56
+ Rovers: 8, 8, 4
57
+ Saltwise: 13, 8, 3
58
+ Semper Mort: 10, 10, 3
59
+ Solestros: 6, 6, 4
60
+ Unborn of Teixiptla: 4, 4, 7
61
+ Vegasians: 5, 10, 5
62
+ Yorker: 15, 5, 4
63
+
64
+ == Strain Specific Skills ==
65
+ Baywalkers: Fast Learner, Old Wounds | Toxic Shock, A Tale of Two Cities, Too Clever
66
+ Diesel Jocks: Need of Food | Road Bound, Endless Miles of Road
67
+ Full Dead: Gnaw, Legion | One of Us, Grave Mind, Diverse Background
68
+ Genjian: Social Observer, Know Your Enemy | The Long Walk, Honor Bound
69
+ Iron Slaves: Able Helper, Strong Back | Bioluminescent, Humble Roots
70
+ Lascarians: Cannibalism | Light Sensitivity, Savage Culture
71
+ Mericans: Merican Mob | Social Pariah, Yeeee-Haaaaw!
72
+ Nation of Accensor: Meditation, Blessed Life | Code of Ethics, First In Last Out
73
+ Natural Ones: Natural Aim | Shun the Boomstick, Xenophobic, Backward
74
+ Pure Blood: Investment | Weakness to Radiation, Peacocks
75
+ Reclaimers: Dead Nerves | Selective Breeding
76
+ The Red Star: Collective Pride | Reject Free Enterprise, Opiate of the Masses
77
+ Remnants: Dabbler | Rootless, Love Me, Not Like the Others
78
+ Retrogrades: Half-Life | Rot Face, Unfriendly Face
79
+ Rovers: Bond of Salt | Word of Bond
80
+ Saltwise: Oceanic Masters, Water Breathers | Ocean Bound, Debts Owed
81
+ Semper Mort: Hunter's Claws, Mortal Bonds, Blood is the Life | Curse of Slumber, Predator's Need, Twisted Hands
82
+ Solestros: Middle Manager | Second in Command, Glass Ceiling
83
+ Unborn of Teixiptla: Undead Hearts | Limited Potential, Called to the Grave
84
+ Vegasians: Meat Market, Coward's Way Out (AKA Buddy Fucker) | Born Coward, Bad Rap, Shady Dealers
85
+ Yorker: Pissed-Off Yorker | Commitment Issues, Angry Streak, Mean Streets
29
86
 
30
87
  == Open Skill ==
31
88
  Avoid 9
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: drpedia_lite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gloria Budiman