smite_ruby 1.5.0 → 1.5.1

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: 9f9a4cc076631a270e034c469e8e3f22ce095373
4
- data.tar.gz: 9f9839c006db93cb1df653ac77df88863f8a38dd
3
+ metadata.gz: 97929724f336dab713e837fff95c08b90ba671cf
4
+ data.tar.gz: ccd5b5111ce4d5c9f0a6d9f3d1dc497c4165bda8
5
5
  SHA512:
6
- metadata.gz: 00aa0449f24960adb8bb5f91234e52cfc5b295b684eaed8243ccf01ad9a5e70f6b0538093b63ce55f0423955338028350713719d6681580af9e317fd3d225b45
7
- data.tar.gz: 1ed19147cd0c392b5fa8c9baea2dd797c662c113f72fd21b7d941c1d8c35df64153a9310a62578741057bd9caf0433f4b4d9210cb7572ea8335ca1cce9e6d7b4
6
+ metadata.gz: 52e8a7b71d3cdf517607abea7570c763ba5b226dbcfd93d70d967fd00f23a85b5e05f7a82a04f84aa2dc67c3d9892ae6cd88449c6f9685576e39d8fe0baa06df
7
+ data.tar.gz: 08d928ae5d9ada988c5a8f469005dfcbac64e22bedbace02dbc80e92924b76623f5abdf405bd56817a3979d0c864ff69da86cdea614d4d25a3cefc076cfea6cd
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- smite_ruby (1.4.673)
4
+ smite_ruby (1.5.0)
5
5
  activesupport
6
6
  httparty
7
7
 
@@ -49,7 +49,15 @@ module Smite
49
49
 
50
50
  def with_items(new_items, stacks = @stacks)
51
51
  stacks.delete_if { |k,v| v.nil? }
52
- GodStats.new(name, @data, { level: level, items: new_items, stacks: stacks })
52
+ stack_map = new_items.each_with_object({}) do |item, hash|
53
+ base_stacks = item.stacking? ? 0 : 1
54
+
55
+ given_stacks = stacks[item.name.downcase] || base_stacks
56
+ actual_stacks = [given_stacks, base_stacks].max
57
+ actual_stacks = [actual_stacks, item.max_stacks ].min.to_i
58
+ hash[item.name.downcase] = actual_stacks
59
+ end
60
+ GodStats.new(name, @data, { level: level, items: new_items, stacks: stack_map })
53
61
  end
54
62
 
55
63
  def bonus_from_items
@@ -146,13 +154,7 @@ module Smite
146
154
  item.passive_effects.each do |effect|
147
155
  next unless attributes.include?(effect.attribute)
148
156
 
149
- base_stacks = item.stacking? ? 0 : 1
150
- multiplier = if @stacks.empty? || @stacks[item.name.downcase].nil?
151
- base_stacks
152
- else
153
- [ [@stacks[item.name.downcase], base_stacks].max , item.max_stacks ].min.to_i
154
- end
155
-
157
+ multiplier = @stacks[item.name.downcase]
156
158
  if effect.percentage?
157
159
  @item_bonus[:perc][effect.attribute.to_sym] += multiplier * effect.amount/100.0
158
160
  else
@@ -1,7 +1,7 @@
1
1
  $:.push File.expand_path("../lib", __FILE__)
2
2
  Gem::Specification.new do |s|
3
3
  s.name = 'smite_ruby'
4
- s.version = '1.5.0'
4
+ s.version = '1.5.1'
5
5
  s.date = '2016-02-22'
6
6
  s.summary = 'Ruby Smite API'
7
7
  s.description = 'Ruby Client for consuming the Smite API'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smite_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - NcUltimate