oakdex-pokemon 0.0.11 → 0.0.12

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: 82c5209a5ec9f13269d3cfc1c8cfcf677434ef10
4
- data.tar.gz: bea6eed9a714601ffa3dab265c960d23fe64cb0c
3
+ metadata.gz: 33739e140231dab3dc2db14bd05db0e3ad088d23
4
+ data.tar.gz: 6bdd39674613deffa1851185223b6e690f18ffcf
5
5
  SHA512:
6
- metadata.gz: 92021e9d3db8a863e3808f24534e178e85f06d7b3beddc2429c60191292f5032e9c3da3b1e83d625c0fbce7932dcd9b1447a78dbf9c3633d405215a42f14473d
7
- data.tar.gz: 772ca3a170dfd55f7293cfbd7a776a91cddbb3573fe2c62afc4589497ef8ea7a9bab70e63c397c3d219d3916aa771375f577a2d57a1ce53d8fba9d489f9fd389
6
+ metadata.gz: 94f3aa3396d33b403436e40d6c9d25872edff6362a99db8c523550ca7a43d4887e3f46b84bfa61e41c61a80c5abe39af4c8aed3a0d499097351fb3042dac1993
7
+ data.tar.gz: 2bb6dd33b4ce087560922813dfa5743653e42cf5e5bd2432957d045728ea1739dd7a1af2d10e34eaee955c753c7d10d986e1cfb32fc81ebf06b8834c3b6a0705
@@ -34,6 +34,7 @@ module Oakdex
34
34
  def initialize(species_id, attributes = {})
35
35
  @species_id = species_id
36
36
  @attributes = attributes
37
+ @battle_mode = false
37
38
  @attributes[:growth_events] ||= []
38
39
  species
39
40
  end
@@ -204,16 +205,28 @@ module Oakdex
204
205
  gain_ev_from_battle(fainted) unless options[:using_exp_share]
205
206
  end
206
207
 
208
+ def enable_battle_mode
209
+ @battle_mode = true
210
+ end
211
+
212
+ def disable_battle_mode
213
+ @battle_mode = false
214
+ end
215
+
207
216
  def growth_event?
208
- !@attributes[:growth_events].empty?
217
+ !growth_events.empty?
209
218
  end
210
219
 
211
220
  def growth_event
212
- @attributes[:growth_events].first
221
+ growth_events.first
213
222
  end
214
223
 
215
224
  def remove_growth_event
216
- @attributes[:growth_events].shift
225
+ remove_event = growth_event
226
+ return unless remove_event
227
+ @attributes[:growth_events] = @attributes[:growth_events].select do |e|
228
+ e != remove_event
229
+ end
217
230
  end
218
231
 
219
232
  def add_growth_event(klass, options = {})
@@ -268,6 +281,16 @@ module Oakdex
268
281
  end
269
282
  end
270
283
 
284
+ def growth_events
285
+ if @battle_mode
286
+ @attributes[:growth_events].select do |e|
287
+ !e.instance_of?(Oakdex::Pokemon::GrowthEvents::Evolution)
288
+ end
289
+ else
290
+ @attributes[:growth_events]
291
+ end
292
+ end
293
+
271
294
  def gain_ev_from_battle(fainted)
272
295
  fainted.species.ev_yield.each do |stat, value|
273
296
  next if value.zero?
@@ -1,5 +1,5 @@
1
1
  module Oakdex
2
2
  class Pokemon
3
- VERSION = '0.0.11'
3
+ VERSION = '0.0.12'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oakdex-pokemon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jalyna Schroeder
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-07 00:00:00.000000000 Z
11
+ date: 2019-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oakdex-pokedex