botemon 0.5.3 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e258f4a57b27793cee29599201c78497a826d87e
4
- data.tar.gz: 9177a0525f092dcc776da99652165d78ff94e7ac
3
+ metadata.gz: 2a0751a36ce4395fb1eec76259bec1027d67fa6c
4
+ data.tar.gz: a3f1537da42697580ec964729b634fb2d2503e36
5
5
  SHA512:
6
- metadata.gz: 688abd378a63f777be2350dee024b9e826e6207130247b43044a83e8d3eb8518afb0ebbe6e911077a68450edf30a3d8a58010185bfd7ccacb97c693e1a31a6f1
7
- data.tar.gz: 305287b5caff1f880a7eb22a13e2aea6cd3579fbf7e189199782370499aa2f1ebd7bc3a7bcd0c1327f621ec983e2b98bcc0278e55badfed6073ccfef06324298
6
+ metadata.gz: 4f8f3b8cf3f10c082e058fbc51830138a4c8381a0999abe041374c81c1230a3f1f3550dc4994b2d7df71eb924f93717af5af2e1d9a87e732bb18e28e1f6127e8
7
+ data.tar.gz: 549117a470ccf7620e90f3acdb993893259e5e2b49313cc80157310ebdb3c635c35013cc0170e9202c8548e9f9511c6581d4d58587b401e4de43f1af5e19990a
data/bin/botemon CHANGED
@@ -81,6 +81,25 @@ Cinch::Bot.new {
81
81
  end
82
82
  end
83
83
 
84
+ on :message, /^pstats (.+) (.+) (.+) (.+)/ do |m, name, level, nature, evs|
85
+ m.reply ">#{ivs}< #{ivs.class}"
86
+ @storage = Storage.new('./cache.db') unless @storage
87
+
88
+ name = Smogon::Pokemon.id2name(name) if name.numeric?
89
+ pokemon = Pokedex.get name.delete(?'), @storage
90
+
91
+ hidden_values = evs.strip.split
92
+ if hidden_values.length == 2
93
+ evs = hidden_values[0].strip.split ?/
94
+ ivs = hidden_values[1].strip.split ?/
95
+ else
96
+ evs = evs.strip.split ?/
97
+ ivs = '31/31/31/31/31/31'
98
+ end
99
+
100
+ m.reply "#{pokemon.name}: (#{pokemon.types.join(?-)}) #{pokemon.stats(level.to_i, nature, evs, ivs).join(?/)}"
101
+ end
102
+
84
103
  on :message, /^pkrandom$/ do |m|
85
104
  @storage = Storage.new('./cache.db') unless @storage
86
105
 
data/lib/botemon.rb CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -49,5 +49,60 @@ module Smogon
49
49
  'base_stats' => base_stats
50
50
  }
51
51
  end
52
+
53
+ def stats(level, nature, ivs, evs)
54
+ natures = {
55
+ :jolly => { :plus => :spe, :minus => :atksp },
56
+ :rash => { :plus => :atksp, :minus => :defsp },
57
+ :hardy => { :plus => :none, :minus => :none },
58
+ :brave => { :plus => :atk, :minus => :spe },
59
+ :naughty => { :plus => :atk, :minus => :defsp },
60
+ :calm => { :plus => :defsp, :minus => :atk },
61
+ :careful => { :plus => :defsp, :minus => :atksp },
62
+ :adamant => { :plus => :atk, :minus => :atksp },
63
+ :docile => { :plus => :none, :minus => :none },
64
+ :lax => { :plus => :def, :minus => :defsp },
65
+ :quirky => { :plus => :none, :minus => :none },
66
+ :gentle => { :plus => :defsp, :minus => :def },
67
+ :naive => { :plus => :spe, :minus => :defsp },
68
+ :hasty => { :plus => :spe, :minus => :def },
69
+ :mild => { :plus => :atksp, :minus => :def },
70
+ :modest => { :plus => :atksp, :minus => :atk },
71
+ :relaxed => { :plus => :def, :minus => :spe },
72
+ :quiet => { :plus => :atksp, :minus => :spe },
73
+ :bashful => { :plus => :none, :minus => :none },
74
+ :impish => { :plus => :def, :minus => :atksp },
75
+ :lonely => { :plus => :atk, :minus => :def },
76
+ :serious => { :plus => :none, :minus => :none },
77
+ :bold => { :plus => :def, :minus => :atk },
78
+ :timid => { :plus => :spe, :minus => :atk },
79
+ :sassy => { :plus => :defsp, :minus => :spe },
80
+ }
81
+
82
+ fields = [ :hp, :atk, :def, :atksp, :defsp, :spe ]
83
+ evs = Hash[fields.zip evs.split(?/)]
84
+ ivs = Hash[fields.zip ivs.split(?/)]
85
+ base_stats = Hash[fields.zip @base_stats]
86
+ nature = natures[nature.downcase.to_sym]
87
+
88
+ [].tap { |stats|
89
+ fields.each_with_index { |field|
90
+ iv = ivs[field].to_i
91
+ ev = evs[field].to_i
92
+ base_stat = base_stats[field].to_i
93
+ multipler = case field
94
+ when nature[:plus] then 1.1
95
+ when nature[:minus] then 0.9
96
+ else 1
97
+ end
98
+
99
+ if field == :hp
100
+ stats << (((iv + 2 * base_stat + ev / 4) * level / 100) + 10 + level).floor
101
+ else
102
+ stats << ((((iv + 2 * base_stat + ev / 4) * level / 100) + 5) * multipler).floor
103
+ end
104
+ }
105
+ }
106
+ end
52
107
  end
53
108
  end
File without changes
File without changes
@@ -19,6 +19,6 @@
19
19
 
20
20
  module Botemon
21
21
  def self.version
22
- '0.5.3'
22
+ '0.5.4'
23
23
  end
24
24
  end
metadata CHANGED
@@ -1,83 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: botemon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Giovanni Capuano
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-06 00:00:00.000000000 Z
11
+ date: 2013-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: sanitize
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: cinch
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: cinch-login
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: smogon
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  description: IRC bot for Pokéfags with (Poké|Ability|Item|Move|Moveset)dex and a trivia
@@ -88,16 +88,16 @@ executables:
88
88
  extensions: []
89
89
  extra_rdoc_files: []
90
90
  files:
91
+ - lib/botemon/abilitydex.rb
92
+ - lib/botemon/itemdex.rb
93
+ - lib/botemon/movedex.rb
91
94
  - lib/botemon/movesetdex.rb
92
95
  - lib/botemon/pokedex.rb
96
+ - lib/botemon/smogon/moveset.rb
97
+ - lib/botemon/smogon/pokemon.rb
93
98
  - lib/botemon/storage.rb
94
99
  - lib/botemon/string.rb
95
- - lib/botemon/abilitydex.rb
96
- - lib/botemon/movedex.rb
97
100
  - lib/botemon/version.rb
98
- - lib/botemon/smogon/pokemon.rb
99
- - lib/botemon/smogon/moveset.rb
100
- - lib/botemon/itemdex.rb
101
101
  - lib/botemon.rb
102
102
  - bin/botemon
103
103
  homepage: http://www.giovannicapuano.net
@@ -110,17 +110,17 @@ require_paths:
110
110
  - lib
111
111
  required_ruby_version: !ruby/object:Gem::Requirement
112
112
  requirements:
113
- - - '>='
113
+ - - ">="
114
114
  - !ruby/object:Gem::Version
115
115
  version: '0'
116
116
  required_rubygems_version: !ruby/object:Gem::Requirement
117
117
  requirements:
118
- - - '>='
118
+ - - ">="
119
119
  - !ruby/object:Gem::Version
120
120
  version: '0'
121
121
  requirements: []
122
122
  rubyforge_project:
123
- rubygems_version: 2.0.6
123
+ rubygems_version: 2.0.3
124
124
  signing_key:
125
125
  specification_version: 4
126
126
  summary: IRC bot for Pokéfags.