oakdex-pokemon 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/oakdex/pokemon.rb +26 -3
- data/lib/oakdex/pokemon/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33739e140231dab3dc2db14bd05db0e3ad088d23
|
4
|
+
data.tar.gz: 6bdd39674613deffa1851185223b6e690f18ffcf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94f3aa3396d33b403436e40d6c9d25872edff6362a99db8c523550ca7a43d4887e3f46b84bfa61e41c61a80c5abe39af4c8aed3a0d499097351fb3042dac1993
|
7
|
+
data.tar.gz: 2bb6dd33b4ce087560922813dfa5743653e42cf5e5bd2432957d045728ea1739dd7a1af2d10e34eaee955c753c7d10d986e1cfb32fc81ebf06b8834c3b6a0705
|
data/lib/oakdex/pokemon.rb
CHANGED
@@ -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
|
-
|
217
|
+
!growth_events.empty?
|
209
218
|
end
|
210
219
|
|
211
220
|
def growth_event
|
212
|
-
|
221
|
+
growth_events.first
|
213
222
|
end
|
214
223
|
|
215
224
|
def remove_growth_event
|
216
|
-
|
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?
|
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.
|
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-
|
11
|
+
date: 2019-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oakdex-pokedex
|