hdeck 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 8dfe707b9bad7ad5aca428dd0d3f65114a5f622da6e5789371559bd420bfd5e8
4
+ data.tar.gz: c9a54d89346bc7cab1675e097b6e94171618acc5d26247c7a039581acd871c16
5
+ SHA512:
6
+ metadata.gz: f4cf808485045912d2bc0f10a96b47dbeaffa50c91755c7a5ff8a649c44f755ebd342c959c37694c55c13df9c6acc49d1bff435e1803fe2c60583e4c4da6f666
7
+ data.tar.gz: 59f94f7e980e53b6a7b0dcb19e201ed4af7c974859e7b00ebbe9132bdd6c7b25cdf39989dafda7a5286530dafcc45a566c448a21de5faac565f68fe1cd32791c
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,14 @@
1
+ AllCops:
2
+ Exclude:
3
+ - "./spec/spec_helper.rb"
4
+ - "Rakefile"
5
+ - "./bin/*"
6
+
7
+ Style/GlobalVars:
8
+ Enabled: false
9
+
10
+ Metrics/MethodLength:
11
+ Max: 20
12
+
13
+ Metrics/BlockLength:
14
+ Max: 99
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.5.1
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in hdeck.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,38 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ hdeck (0.1.0)
5
+ thor
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ diff-lcs (1.3)
11
+ rake (10.5.0)
12
+ rspec (3.8.0)
13
+ rspec-core (~> 3.8.0)
14
+ rspec-expectations (~> 3.8.0)
15
+ rspec-mocks (~> 3.8.0)
16
+ rspec-core (3.8.0)
17
+ rspec-support (~> 3.8.0)
18
+ rspec-expectations (3.8.2)
19
+ diff-lcs (>= 1.2.0, < 2.0)
20
+ rspec-support (~> 3.8.0)
21
+ rspec-mocks (3.8.0)
22
+ diff-lcs (>= 1.2.0, < 2.0)
23
+ rspec-support (~> 3.8.0)
24
+ rspec-support (3.8.0)
25
+ thor (0.20.3)
26
+
27
+ PLATFORMS
28
+ ruby
29
+ x64-mingw32
30
+
31
+ DEPENDENCIES
32
+ bundler (~> 1.17)
33
+ hdeck!
34
+ rake (~> 10.0)
35
+ rspec (~> 3.0)
36
+
37
+ BUNDLED WITH
38
+ 1.17.2
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 Graham Marlow
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,57 @@
1
+ # HDeck
2
+
3
+ [![Build Status](https://travis-ci.org/mgmarlow/hdeck.svg?branch=master)](https://travis-ci.org/mgmarlow/hdeck)
4
+
5
+ CLI tool to manage decks of [harrow cards](http://pathfinder.wikia.com/wiki/List_of_harrow_cards).
6
+ Designed to make working with the
7
+ [Card Caster archetype](https://www.d20pfsrd.com/classes/base-classes/magus/archetypes/paizo-magus-archetypes/card-caster-magus-archetype/)
8
+ class easier.
9
+
10
+ ## Installation
11
+
12
+ Gem coming soon. For now,
13
+
14
+ ```
15
+ git clone https://github.com/mgmarlow/hdeck.git
16
+ cd hdeck
17
+ bundle
18
+ ./bin/console new
19
+ ```
20
+
21
+ ## Examples
22
+
23
+ ### General Use
24
+
25
+ Begin the CLI by running the console:
26
+
27
+ ```
28
+ ./bin/console new
29
+ ```
30
+
31
+ Follow the commands to manage your harrow deck.
32
+
33
+ ```
34
+ What would you like to do? (draw) (throw) (quit)
35
+ draw
36
+
37
+ (Wisdom: LE) The Eclipse
38
+ Loss of faith and purpose, and the subject's doubt about his abilities or prospects.
39
+ ```
40
+
41
+ ### Alignment (Role Dealer)
42
+
43
+ Alignment can also be factored in to take advantage of the Role
44
+ Dealer feat. You can configure alignment with the `--alignment`
45
+ flag. Defaults to CN.
46
+
47
+ ```
48
+ ./bin/console new --alignment LG
49
+ ```
50
+
51
+ ## Roadmap
52
+
53
+ - [ ] Better CLI formatting
54
+ - [ ] Better error handling
55
+ - [ ] Save & Load decks
56
+ - [ ] More deck management options (# cards, shuffling)
57
+ - [ ] Publish gem
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/abilities.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "Strength": {
3
+ "symbol": "hammer",
4
+ "summary": "Strength represents a creature's muscular and physical power, and its ability to fight in melee combat. In a harrowing, it more broadly symbolizes war, battle, and honor."
5
+ },
6
+ "Dexterity": {
7
+ "symbol": "key",
8
+ "summary": "Dexterity represents a creature's agility, reflexes, balance, and skill with ranged weapons. In a harrowing, it more broadly symbolizes trouble, children, and entertainment."
9
+ },
10
+ "Constitution": {
11
+ "symbol": "shield",
12
+ "summary": "Constitution represents a creature's health, stamina, and increased ability to survive injuries or disease. In a harrowing, it more broadly symbolizes health, the home, and pain."
13
+ },
14
+ "Intelligence": {
15
+ "name": "Intelligence",
16
+ "symbol": "tome",
17
+ "summary": "Intelligence represents a creature's ability to learn and reason, and can indicate facility with languages or arcane magic. In a harrowing, it more broadly symbolizes money, school, and literature."
18
+ },
19
+ "Wisdom": {
20
+ "name": "Wisdom",
21
+ "symbol": "star",
22
+ "summary": "Wisdom represents a creature's willpower, common sense, awareness, intuition, and perception, and can indicate facility with divine magic. In a harrowing, it more broadly symbolizes ancient history, morality, and the gods."
23
+ },
24
+ "Charisma": {
25
+ "name": "Charisma",
26
+ "symbol": "crown",
27
+ "summary": "Charisma represents a creature's personality, personal magnetism, ability to lead, and appearance, and can indicate facility with spontaneously cast magic. In a harrowing, it more broadly symbolizes love, family, and politics."
28
+ }
29
+ }
data/bin/console ADDED
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'thor'
4
+ require_relative '../lib/hdeck'
5
+
6
+ class CLI < Thor
7
+ package_name "hdeck"
8
+
9
+ desc "new", "create a new harrow deck"
10
+ option :alignment, default: 'CN'
11
+ def new()
12
+ puts 'Creating a new Harrow Deck.'
13
+ # TODO: validate alignment
14
+ player = HDeck::CardCaster.new(alignment: options[:alignment])
15
+ active = true
16
+
17
+ while active do
18
+ action = ask("What would you like to do? (draw) (throw) (quit)\n")
19
+
20
+ if action == 'draw'
21
+ player.draw_card(shuffle_before: true, replace: true)
22
+ elsif action == 'throw'
23
+ player.draw_card(shuffle_before: true, replace: false, calculate_match: true)
24
+ elsif action == 'quit' || action == 'q'
25
+ active = false
26
+ else
27
+ puts 'did not recognize command'
28
+ end
29
+ end
30
+ end
31
+ end
32
+
33
+ CLI.start(ARGV)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/cards.json ADDED
@@ -0,0 +1,381 @@
1
+ [
2
+ {
3
+ "ability": "Strength",
4
+ "symbol": "hammer",
5
+ "name": "The Paladin",
6
+ "desc": "Standing resolutely against trouble, without backing down.",
7
+ "morality": "LG"
8
+ },
9
+ {
10
+ "ability": "Strength",
11
+ "symbol": "hammer",
12
+ "name": "The Keep",
13
+ "desc": "Quiet, unshakeable strength that withstands any hardship.",
14
+ "morality": "N"
15
+ },
16
+ {
17
+ "ability": "Strength",
18
+ "symbol": "hammer",
19
+ "name": "The Big Sky",
20
+ "desc": "Momentous change, as when all the slaves of a nation are emancipated.",
21
+ "morality": "CG"
22
+ },
23
+ {
24
+ "ability": "Strength",
25
+ "symbol": "hammer",
26
+ "name": "The Forge",
27
+ "desc": "Strength through diversity, or strength from many sources united against a single trial.",
28
+ "morality": "LN"
29
+ },
30
+ {
31
+ "ability": "Strength",
32
+ "symbol": "hammer",
33
+ "name": "The Bear",
34
+ "desc": "Pure strength that cannot be truly tamed or trained.",
35
+ "morality": "N"
36
+ },
37
+ {
38
+ "ability": "Strength",
39
+ "symbol": "hammer",
40
+ "name": "The Uprising",
41
+ "desc": "Overwhelming strength that catches the subject up in something much more powerful.",
42
+ "morality": "CN"
43
+ },
44
+ {
45
+ "ability": "Strength",
46
+ "symbol": "hammer",
47
+ "name": "The Fiend",
48
+ "desc": "A devil who devours the masses of the innocent, and can represent the deaths of many in a disaster. ",
49
+ "morality": "LE"
50
+ },
51
+ {
52
+ "ability": "Strength",
53
+ "symbol": "hammer",
54
+ "name": "The Beating",
55
+ "desc": "An assault from all quarters, or the mental dissolution of the self.",
56
+ "morality": "NE"
57
+ },
58
+ {
59
+ "ability": "Strength",
60
+ "symbol": "hammer",
61
+ "name": "The Cyclone",
62
+ "desc": "An unstoppable, destructive force unleashed through the plots of intelligent creatures.",
63
+ "morality": "CE"
64
+ },
65
+ {
66
+ "ability": "Dexterity",
67
+ "symbol": "key",
68
+ "name": "The Dance",
69
+ "desc": "A complicated framework that requires the cooperation of all to avoid collapse.",
70
+ "morality": "LG"
71
+ },
72
+ {
73
+ "ability": "Dexterity",
74
+ "symbol": "key",
75
+ "name": "The Cricket",
76
+ "desc": "The grig, quick travel, and the reward at the end of a journey.",
77
+ "morality": "NG"
78
+ },
79
+ {
80
+ "ability": "Dexterity",
81
+ "symbol": "key",
82
+ "name": "The Juggler",
83
+ "desc": "Destiny, deities, and those who play with the fates of others.",
84
+ "morality": "CG"
85
+ },
86
+ {
87
+ "ability": "Dexterity",
88
+ "symbol": "key",
89
+ "name": "The Locksmith",
90
+ "desc": "The keys the subject needs to unlock his fate. The card grants the tools needed to unlock some new place, puzzle, or hoard.",
91
+ "morality": "LN"
92
+ },
93
+ {
94
+ "ability": "Dexterity",
95
+ "symbol": "key",
96
+ "name": "The Peacock",
97
+ "desc": "A great beauty that can only be preserved if petrified and frozen in time for eternity, as by a cockatrice's glare.",
98
+ "morality": "N"
99
+ },
100
+ {
101
+ "ability": "Dexterity",
102
+ "symbol": "key",
103
+ "name": "The Rabbit Prince",
104
+ "desc": "The quirky vicissitudes of melee combat. The Rabbit Prince is the personification of the capriciousness of battle, and his broken sword indicates that defeat can come to anyone. The card sometimes represents younger members of royal or noble houses.",
105
+ "morality": "CN"
106
+ },
107
+ {
108
+ "ability": "Dexterity",
109
+ "symbol": "key",
110
+ "name": "The Avalanche",
111
+ "desc": "Disaster: an unthinking panic and destruction that overruns all.[",
112
+ "morality": "LE"
113
+ },
114
+ {
115
+ "ability": "Dexterity",
116
+ "symbol": "key",
117
+ "name": "The Crows",
118
+ "desc": "Murder, theft, and the violent loss of that which is loved.[",
119
+ "morality": "NE"
120
+ },
121
+ {
122
+ "ability": "Dexterity",
123
+ "symbol": "key",
124
+ "name": "The Demon's Lantern",
125
+ "desc": "An impossible situation of traps, mind tricks, and sleight of hand.[",
126
+ "morality": "CE"
127
+ },
128
+ {
129
+ "ability": "Constitution",
130
+ "symbol": "shield",
131
+ "name": "The Trumpet",
132
+ "desc": "An archon who dives aggressively and righteously into danger.",
133
+ "morality": "LG"
134
+ },
135
+ {
136
+ "ability": "Constitution",
137
+ "symbol": "shield",
138
+ "name": "The Survivor",
139
+ "desc": "A creature that has managed to survive a terrible ordeal, when everyone thought him lost.",
140
+ "morality": "NG"
141
+ },
142
+ {
143
+ "ability": "Constitution",
144
+ "symbol": "shield",
145
+ "name": "The Desert",
146
+ "desc": "An environment too difficult for anyone to survive without help. The sphinx may represent a source of salvation from plague.",
147
+ "morality": "CG"
148
+ },
149
+ {
150
+ "ability": "Constitution",
151
+ "symbol": "shield",
152
+ "name": "The Brass Dwarf",
153
+ "desc": "A creature invulnerable to a current threat.",
154
+ "morality": "LN"
155
+ },
156
+ {
157
+ "ability": "Constitution",
158
+ "symbol": "shield",
159
+ "name": "The Teamster",
160
+ "desc": "An external force that drives the subject on.",
161
+ "morality": "N"
162
+ },
163
+ {
164
+ "ability": "Constitution",
165
+ "symbol": "shield",
166
+ "name": "The Mountain Man",
167
+ "desc": "An encounter with a physical power outside of the subject's control.",
168
+ "morality": "CN"
169
+ },
170
+ {
171
+ "ability": "Constitution",
172
+ "symbol": "shield",
173
+ "name": "The Tangled Briar",
174
+ "desc": "A historical thing or creature that will have some influence on the question.",
175
+ "morality": "LE"
176
+ },
177
+ {
178
+ "ability": "Constitution",
179
+ "symbol": "shield",
180
+ "name": "The Sickness",
181
+ "desc": "Corruption, famine, plague, pestilence, and disease.",
182
+ "morality": "NE"
183
+ },
184
+ {
185
+ "ability": "Constitution",
186
+ "symbol": "shield",
187
+ "name": "The Waxworks",
188
+ "desc": "A place of torture, imprisonment, helplessness, and paralysis.",
189
+ "morality": "CE"
190
+ },
191
+ {
192
+ "ability": "Intelligence",
193
+ "symbol": "tome",
194
+ "name": "The Hidden Truth",
195
+ "desc": "The discovery of the greater truth within.",
196
+ "morality": "LG"
197
+ },
198
+ {
199
+ "ability": "Intelligence",
200
+ "symbol": "tome",
201
+ "name": "The Wanderer",
202
+ "desc": "A centaur collector who appreciates things others discard as junk.",
203
+ "morality": "NG"
204
+ },
205
+ {
206
+ "ability": "Intelligence",
207
+ "symbol": "tome",
208
+ "name": "The Joke",
209
+ "desc": "A monster that can only be defeated through trickery, or the value of humor in circumventing difficult people.",
210
+ "morality": "CG"
211
+ },
212
+ {
213
+ "ability": "Intelligence",
214
+ "symbol": "tome",
215
+ "name": "The Inquisitor",
216
+ "desc": "An immutable object that cannot be deceived or influenced.",
217
+ "morality": "LN"
218
+ },
219
+ {
220
+ "ability": "Intelligence",
221
+ "symbol": "tome",
222
+ "name": "The Foreign Trader",
223
+ "desc": "Spies, merchants, and those who trade in information.",
224
+ "morality": "N"
225
+ },
226
+ {
227
+ "ability": "Intelligence",
228
+ "symbol": "tome",
229
+ "name": "The Vision",
230
+ "desc": "Esoteric and arcane knowledge, or madness.",
231
+ "morality": "CN"
232
+ },
233
+ {
234
+ "ability": "Intelligence",
235
+ "symbol": "tome",
236
+ "name": "The Rakshasa",
237
+ "desc": "Domination, mental control, and slavery.",
238
+ "morality": "LE"
239
+ },
240
+ {
241
+ "ability": "Intelligence",
242
+ "symbol": "tome",
243
+ "name": "The Idiot",
244
+ "desc": "Folly, greed, blackmail, bribery, or hubris.",
245
+ "morality": "NE"
246
+ },
247
+ {
248
+ "ability": "Intelligence",
249
+ "symbol": "tome",
250
+ "name": "The Snakebite",
251
+ "desc": "Poison, venom, assassination, and discord.",
252
+ "morality": "CE"
253
+ },
254
+ {
255
+ "ability": "Wisdom",
256
+ "symbol": "star",
257
+ "name": "The Winged Serpent",
258
+ "desc": "The couatl, the bridge of understanding between the towers of knowledge and judgement.",
259
+ "morality": "LG"
260
+ },
261
+ {
262
+ "ability": "Wisdom",
263
+ "symbol": "star",
264
+ "name": "The Midwife",
265
+ "desc": "The enabler or conduit of new creation, information, or arrivals.",
266
+ "morality": "NG"
267
+ },
268
+ {
269
+ "ability": "Wisdom",
270
+ "symbol": "star",
271
+ "name": "The Publican",
272
+ "desc": "Fellowship and refuge. The cyclops is a seemingly inconsequential figure who nonetheless has relevant insight.",
273
+ "morality": "CG"
274
+ },
275
+ {
276
+ "ability": "Wisdom",
277
+ "symbol": "star",
278
+ "name": "The Queen Mother",
279
+ "desc": "This formian is the personification of knowledge, who is fond of the powerless, the underclass, and those who will show her obeisance.",
280
+ "morality": "LN"
281
+ },
282
+ {
283
+ "ability": "Wisdom",
284
+ "symbol": "star",
285
+ "name": "The Owl",
286
+ "desc": "The harsh wisdom of the natural order. The owl holds a needle that can bind life together or pick it apart.",
287
+ "morality": "N"
288
+ },
289
+ {
290
+ "ability": "Wisdom",
291
+ "symbol": "star",
292
+ "name": "The Carnival",
293
+ "desc": "Illusions and false dreams.",
294
+ "morality": "CN"
295
+ },
296
+ {
297
+ "ability": "Wisdom",
298
+ "symbol": "star",
299
+ "name": "The Eclipse",
300
+ "desc": "Loss of faith and purpose, and the subject's doubt about his abilities or prospects.",
301
+ "morality": "LE"
302
+ },
303
+ {
304
+ "ability": "Wisdom",
305
+ "symbol": "star",
306
+ "name": "The Mute Hag",
307
+ "desc": "The insightful hag, a purveyor of blood pacts, treacherous secrets, and discord.",
308
+ "morality": "NE"
309
+ },
310
+ {
311
+ "ability": "Wisdom",
312
+ "symbol": "star",
313
+ "name": "The Lost",
314
+ "desc": "The permanently insane, lost among lunatics and psychopaths in insane asylums. It is a card of emptiness.",
315
+ "morality": "CE"
316
+ },
317
+ {
318
+ "ability": "Charisma",
319
+ "symbol": "crown",
320
+ "name": "The Empty Throne",
321
+ "desc": "Those who are gone, or a ghost of the past that has taught important lessons.",
322
+ "morality": "LG"
323
+ },
324
+ {
325
+ "ability": "Charisma",
326
+ "symbol": "crown",
327
+ "name": "The Theater",
328
+ "desc": "Prophecy, with a true prophet acting a part as the puppet of the gods.",
329
+ "morality": "NG"
330
+ },
331
+ {
332
+ "ability": "Charisma",
333
+ "symbol": "crown",
334
+ "name": "The Unicorn",
335
+ "desc": "One who generously offers up that which is sought.",
336
+ "morality": "CG"
337
+ },
338
+ {
339
+ "ability": "Charisma",
340
+ "symbol": "crown",
341
+ "name": "The Marriage",
342
+ "desc": "A union of peoples, ideas, or kingdoms that might be as productive or as ruinous as the bonding of a salamander and a water weird.",
343
+ "morality": "LN"
344
+ },
345
+ {
346
+ "ability": "Charisma",
347
+ "symbol": "crown",
348
+ "name": "The Twin",
349
+ "desc": "Duality of purpose or identity, or indecision and fence-sitting for the subject or the entire spread.",
350
+ "morality": "N"
351
+ },
352
+ {
353
+ "ability": "Charisma",
354
+ "symbol": "crown",
355
+ "name": "The Courtesan",
356
+
357
+ "desc": "Political intrigue and the superficiality of social niceties.",
358
+ "morality": "CN"
359
+ },
360
+ {
361
+ "ability": "Charisma",
362
+ "symbol": "crown",
363
+ "name": "The Tyrant",
364
+ "desc": "A ruler who harms those he rules.",
365
+ "morality": "LE"
366
+ },
367
+ {
368
+ "ability": "Charisma",
369
+ "symbol": "crown",
370
+ "name": "The Betrayal",
371
+ "desc": "Selfishness and envy.",
372
+ "morality": "NE"
373
+ },
374
+ {
375
+ "ability": "Charisma",
376
+ "symbol": "crown",
377
+ "name": "The Liar",
378
+ "desc": "Destructive, treacherous love. The lamia signals obsession, star-crossed lovers, or unrequited desire.",
379
+ "morality": "CE"
380
+ }
381
+ ]
data/hdeck.gemspec ADDED
@@ -0,0 +1,30 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "hdeck/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "hdeck"
8
+ spec.version = HDeck::VERSION
9
+ spec.authors = ["Graham Marlow"]
10
+ spec.email = ["mgmarlow@gmail.com"]
11
+
12
+ spec.summary = "CLI tool to manage decks of harrow cards."
13
+ spec.homepage = "https://github.com/mgmarlow/hdeck"
14
+ spec.license = "MIT"
15
+
16
+ # Specify which files should be added to the gem when it is released.
17
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
18
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
19
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
20
+ end
21
+ spec.bindir = "exe"
22
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
+ spec.require_paths = ["lib"]
24
+
25
+ spec.add_dependency "thor"
26
+
27
+ spec.add_development_dependency "bundler", "~> 1.17"
28
+ spec.add_development_dependency "rake", "~> 10.0"
29
+ spec.add_development_dependency "rspec", "~> 3.0"
30
+ end
data/lib/hdeck/card.rb ADDED
@@ -0,0 +1,17 @@
1
+ module HDeck
2
+ # An individual Harrow card unit, described on this page:
3
+ # https://pathfinder.fandom.com/wiki/List_of_harrow_cards
4
+ class Card
5
+ attr_accessor :name, :desc, :morality, :ability
6
+
7
+ def initialize(args)
8
+ args.each do |k, v|
9
+ instance_variable_set("@#{k}", v) unless v.nil?
10
+ end
11
+ end
12
+
13
+ def to_s
14
+ "(#{ability}: #{morality}) #{name}\n#{desc}"
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,50 @@
1
+ module HDeck
2
+ # Manager class for Card Caster
3
+ class CardCaster
4
+ attr_accessor :alignment, :deck
5
+
6
+ def initialize(alignment: 'CN')
7
+ @alignment = alignment
8
+ @deck = Deck.new
9
+ end
10
+
11
+ def draw_card(shuffle_before: true, replace: false, calculate_match: false)
12
+ if deck.length <= 0
13
+ puts 'Deck is out of cards'
14
+ return
15
+ end
16
+
17
+ deck.shuffle if shuffle_before
18
+
19
+ drawn_card = deck.draw(replace: replace)
20
+
21
+ if calculate_match
22
+ # Bonuses applied via Role Dealer feat
23
+ case detect_alignment_match(drawn_card)
24
+ when :full
25
+ puts "Full alignment match!\n"\
26
+ "--------------------\n"\
27
+ "crit range: 19-20\n"\
28
+ "crit damage bonus: x3\n"\
29
+ "+4 bonus to confirmation roll\n"
30
+ when :partial
31
+ puts "Partial alignment match!\n"\
32
+ "--------------------\n"\
33
+ "crit range: 19-20\n"
34
+ end
35
+ end
36
+
37
+ puts("\n#{drawn_card.to_s}\n\n")
38
+ end
39
+
40
+ def detect_alignment_match(card)
41
+ return :full if card.morality == @alignment
42
+
43
+ @alignment.each_char do |sign|
44
+ return :partial if card.morality.include?(sign)
45
+ end
46
+
47
+ :none
48
+ end
49
+ end
50
+ end
data/lib/hdeck/deck.rb ADDED
@@ -0,0 +1,48 @@
1
+ module HDeck
2
+ # Provides a Harrow deck for a Card Caster to interact with
3
+ class Deck
4
+ include Enumerable
5
+
6
+ def initialize
7
+ card_data = JSON.parse(File.read('cards.json'))
8
+ @cards = get_cards(card_data)
9
+ end
10
+
11
+ def length
12
+ @cards.length
13
+ end
14
+
15
+ def each(&block)
16
+ @cards.each(&block)
17
+ end
18
+
19
+ def draw(replace: true)
20
+ replace ? @cards.last : @cards.pop
21
+ end
22
+
23
+ def shuffle
24
+ counter = @cards.length - 1
25
+
26
+ while counter > 0
27
+ ri = rand(counter)
28
+ @cards[counter], @cards[ri] = @cards[ri], @cards[counter]
29
+ counter -= 1
30
+ end
31
+
32
+ @cards
33
+ end
34
+
35
+ private
36
+
37
+ def get_cards(card_data)
38
+ card_data.map do |data|
39
+ Card.new(
40
+ name: data['name'],
41
+ desc: data['desc'],
42
+ morality: data['morality'],
43
+ ability: data['ability']
44
+ )
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,3 @@
1
+ module HDeck
2
+ VERSION = "0.1.0"
3
+ end
data/lib/hdeck.rb ADDED
@@ -0,0 +1,10 @@
1
+ require 'json'
2
+ require_relative 'hdeck/version'
3
+ require_relative 'hdeck/card_caster'
4
+ require_relative 'hdeck/card'
5
+ require_relative 'hdeck/deck'
6
+
7
+ module HDeck
8
+ class Error < StandardError; end
9
+ # Your code goes here...
10
+ end
metadata ADDED
@@ -0,0 +1,118 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hdeck
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Graham Marlow
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-08-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.17'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.17'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.0'
69
+ description:
70
+ email:
71
+ - mgmarlow@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - ".rspec"
78
+ - ".rubocop.yml"
79
+ - ".travis.yml"
80
+ - Gemfile
81
+ - Gemfile.lock
82
+ - LICENSE.txt
83
+ - README.md
84
+ - Rakefile
85
+ - abilities.json
86
+ - bin/console
87
+ - bin/setup
88
+ - cards.json
89
+ - hdeck.gemspec
90
+ - lib/hdeck.rb
91
+ - lib/hdeck/card.rb
92
+ - lib/hdeck/card_caster.rb
93
+ - lib/hdeck/deck.rb
94
+ - lib/hdeck/version.rb
95
+ homepage: https://github.com/mgmarlow/hdeck
96
+ licenses:
97
+ - MIT
98
+ metadata: {}
99
+ post_install_message:
100
+ rdoc_options: []
101
+ require_paths:
102
+ - lib
103
+ required_ruby_version: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - ">="
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ required_rubygems_version: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: '0'
113
+ requirements: []
114
+ rubygems_version: 3.0.3
115
+ signing_key:
116
+ specification_version: 4
117
+ summary: CLI tool to manage decks of harrow cards.
118
+ test_files: []