gloomhaven 1.0.5 → 1.0.6
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 +4 -4
- data/Gemfile.lock +1 -1
- data/changelog.md +3 -0
- data/gloomhaven.gemspec +1 -1
- data/lib/gloomhaven/player.rb +13 -3
- data/lib/gloomhaven/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2add0e7f10741e013730ec49e2fa74b41c0697a1e83c86efc26461890c61ba9d
|
4
|
+
data.tar.gz: 9a9a707767100ddcb3f0646edadb101fccb994419fe9f0652049f901251f96f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 29cb890057f73eb0edce73463054b8596314382094cfd84bb075a65ee4b13afa3da7b7ace5c2c9147ae819ae9917dd61abec6567fc97e9adfc8427f391cedf85
|
7
|
+
data.tar.gz: bff3c169b51ecb80f7e25cad49df6cbcc2e55e458062d7ce913c14c063b63f4a76f5f4f15782f1eccad31d925eb117c83303b83069b93f4b33a57652e7aa1e81
|
data/Gemfile.lock
CHANGED
data/changelog.md
CHANGED
data/gloomhaven.gemspec
CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
|
|
17
17
|
|
18
18
|
# spec.metadata["homepage_uri"] = spec.homepage
|
19
19
|
spec.metadata["source_code_uri"] = "https://github.com/teoucsb82/gloomhaven"
|
20
|
-
spec.metadata["changelog_uri"] = "https://github.com/teoucsb82/gloomhaven/changelog.md"
|
20
|
+
spec.metadata["changelog_uri"] = "https://github.com/teoucsb82/gloomhaven/blob/master/changelog.md"
|
21
21
|
|
22
22
|
# Specify which files should be added to the gem when it is released.
|
23
23
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
data/lib/gloomhaven/player.rb
CHANGED
@@ -5,7 +5,7 @@ module Gloomhaven
|
|
5
5
|
attr_accessor :gold, :items, :perks, :xp
|
6
6
|
|
7
7
|
def initialize(options = { character_class: nil, name: nil } )
|
8
|
-
|
8
|
+
validate!(options)
|
9
9
|
|
10
10
|
@character_class = options[:character_class].downcase
|
11
11
|
@deck = Deck.new
|
@@ -18,7 +18,7 @@ module Gloomhaven
|
|
18
18
|
|
19
19
|
def add_perk!(perk)
|
20
20
|
raise TypeError.new('Perk must be a Gloomhaven::Perk') unless perk.is_a?(Gloomhaven::Perk)
|
21
|
-
raise ArgumentError.new("#{character_class} cannot select #{perk.description}") unless
|
21
|
+
raise ArgumentError.new("#{character_class} cannot select #{perk.description}. Must be one of the following: #{character_class_perks}") unless character_class_perks.include?(perk.key)
|
22
22
|
raise ArgumentError.new("#{character_class} has the maximum number of #{perk.description} perks") if existing_perk_count(perk) >= character_perk_limit(perk)
|
23
23
|
update_attack_modifier_deck_from!(perk)
|
24
24
|
@perks << perk
|
@@ -26,7 +26,7 @@ module Gloomhaven
|
|
26
26
|
|
27
27
|
private
|
28
28
|
|
29
|
-
def
|
29
|
+
def character_class_perks
|
30
30
|
CHARACTERS[character_class]['perks'].keys
|
31
31
|
end
|
32
32
|
|
@@ -43,6 +43,11 @@ module Gloomhaven
|
|
43
43
|
perk.cards['remove'].each { |card| deck.remove!(card) }
|
44
44
|
end
|
45
45
|
|
46
|
+
def validate!(options)
|
47
|
+
validate_character_class!(options[:character_class])
|
48
|
+
validate_name!(options[:name])
|
49
|
+
end
|
50
|
+
|
46
51
|
def validate_character_class!(character_class)
|
47
52
|
raise ArgumentError.new("options[:character_class] cannot be blank") if character_class.nil?
|
48
53
|
|
@@ -50,5 +55,10 @@ module Gloomhaven
|
|
50
55
|
raise TypeError.new("Invalid character_class: #{character_class} is not supported. Must be one of the following: #{Gloomhaven::CHARACTERS.keys}")
|
51
56
|
end
|
52
57
|
end
|
58
|
+
|
59
|
+
def validate_name!(name)
|
60
|
+
raise ArgumentError.new("options[:name] cannot be blank") if name.nil?
|
61
|
+
raise ArgumentError.new("options[:name] must be a String") unless name.is_a?(String)
|
62
|
+
end
|
53
63
|
end
|
54
64
|
end
|
data/lib/gloomhaven/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gloomhaven
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Teo Dell'Amico
|
@@ -113,7 +113,7 @@ licenses:
|
|
113
113
|
- MIT
|
114
114
|
metadata:
|
115
115
|
source_code_uri: https://github.com/teoucsb82/gloomhaven
|
116
|
-
changelog_uri: https://github.com/teoucsb82/gloomhaven/changelog.md
|
116
|
+
changelog_uri: https://github.com/teoucsb82/gloomhaven/blob/master/changelog.md
|
117
117
|
post_install_message:
|
118
118
|
rdoc_options: []
|
119
119
|
require_paths:
|