botemon 0.7 → 0.8
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/bin/botemon +15 -15
- data/lib/botemon/abilitydex.rb +2 -2
- data/lib/botemon/smogon/moveset.rb +35 -35
- data/lib/botemon/smogon/pokemon.rb +77 -77
- data/lib/botemon/storage.rb +12 -10
- data/lib/botemon/version.rb +2 -2
- metadata +20 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4158ad88bf1ebd27007e04363e0a1faf01fb20a
|
4
|
+
data.tar.gz: 29cf92dd9c4039c5324e57ffd5f9be12355026f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8acbaa22fb276e507976653f9b40f678722213b31b24126273dd0bd3359a658119871c3124f2aadf97dfc0cbad7115c05c16a465a2942c326047f35ef43fa994
|
7
|
+
data.tar.gz: 1d9af056be096b2d1357b982edb7aa91561c85eb44ef086793b711dba32e4ffbe1ec9fcc6c5f68fffce8791bbf981b022e8b11b70785f6b8045fca930b9915ce
|
data/bin/botemon
CHANGED
@@ -46,7 +46,7 @@ Cinch::Bot.new {
|
|
46
46
|
on :message, /^pkmn (.+)/ do |m, name|
|
47
47
|
@storage = Storage.new('./cache.db') unless @storage
|
48
48
|
|
49
|
-
name = Smogon::Pokemon.id2name(name) if name.numeric?
|
49
|
+
name = Smogon::Type::Pokemon.id2name(name) if name.numeric?
|
50
50
|
|
51
51
|
pokemon = Pokedex.get name, @storage
|
52
52
|
m.reply pokemon ? "#{pokemon.to_s}\n#{pokemon.url}".split("\n").map(&:colorize).join("\n") : 'Pokémon not found.'.colorize
|
@@ -71,7 +71,7 @@ Cinch::Bot.new {
|
|
71
71
|
end
|
72
72
|
|
73
73
|
on :message, /^moveset (.+) (.+) (.+)/ do |m, name, tier, metagame|
|
74
|
-
name = Smogon::Pokemon.id2name(name) if name.numeric?
|
74
|
+
name = Smogon::Type::Pokemon.id2name(name) if name.numeric?
|
75
75
|
|
76
76
|
tier = nil if tier.empty?
|
77
77
|
metagame = nil if metagame.empty?
|
@@ -91,7 +91,7 @@ Cinch::Bot.new {
|
|
91
91
|
on :message, /^pstats (\S*) (\S*) (\S*) (.*)/ do |m, name, level, nature, evs|
|
92
92
|
@storage = Storage.new('./cache.db') unless @storage
|
93
93
|
|
94
|
-
name = Smogon::Pokemon.id2name(name) if name.numeric?
|
94
|
+
name = Smogon::Type::Pokemon.id2name(name) if name.numeric?
|
95
95
|
pokemon = Pokedex.get name, @storage
|
96
96
|
|
97
97
|
hidden_values = evs.strip.split
|
@@ -109,7 +109,7 @@ Cinch::Bot.new {
|
|
109
109
|
on :message, /^pkrandom$/ do |m|
|
110
110
|
@storage = Storage.new('./cache.db') unless @storage
|
111
111
|
|
112
|
-
pokemon = Pokedex.get Smogon::Pokemon.id2name(Random.new.rand(1..649)), @storage
|
112
|
+
pokemon = Pokedex.get Smogon::Type::Pokemon.id2name(Random.new.rand(1..649)), @storage
|
113
113
|
m.reply pokemon ? "#{pokemon.to_s}\n#{pokemon.url}".split("\n").map(&:colorize).join("\n") : 'Pokémon not found.'.colorize
|
114
114
|
end
|
115
115
|
|
@@ -120,7 +120,7 @@ Cinch::Bot.new {
|
|
120
120
|
m.reply 'Other players are playing, please wait until they finish.'.colorize
|
121
121
|
m.reply @pokemon_trivia.clues.colorize
|
122
122
|
else
|
123
|
-
@pokemon_trivia = Pokedex.get Smogon::Pokemon.id2name(Random.new.rand(1..649)), @storage
|
123
|
+
@pokemon_trivia = Pokedex.get Smogon::Type::Pokemon.id2name(Random.new.rand(1..649)), @storage
|
124
124
|
@trivia_owner = m.user.nick
|
125
125
|
@trivia_wrong = 0
|
126
126
|
|
@@ -198,15 +198,15 @@ Cinch::Bot.new {
|
|
198
198
|
end
|
199
199
|
|
200
200
|
on :message, /^pkhelp$/ do |m|
|
201
|
-
m.reply "- pkmn
|
202
|
-
m.reply "- pkmn
|
203
|
-
m.reply "- ability
|
204
|
-
m.reply "- item
|
205
|
-
m.reply "- move
|
206
|
-
m.reply "- moveset
|
207
|
-
m.reply "- moveset
|
208
|
-
m.reply "- pstats
|
209
|
-
m.reply "- pstats
|
210
|
-
m.reply "- pkrandom, pktrivia, pkdebug, pkstop, pkcache, pkversion
|
201
|
+
m.reply "- pkmn Bulbasaur ".colorize
|
202
|
+
m.reply "- pkmn 1 ".colorize
|
203
|
+
m.reply "- ability Synchronize ".colorize
|
204
|
+
m.reply "- item Leftovers ".colorize
|
205
|
+
m.reply "- move Reflect ".colorize
|
206
|
+
m.reply "- moveset Bulbasaur LC ".colorize
|
207
|
+
m.reply "- moveset Bulbasaur LC DP ".colorize
|
208
|
+
m.reply "- pstats Scizor 70 Adamant 0/252/0/0/6/252 15/31/30/2/31/31 ".colorize
|
209
|
+
m.reply "- pstats Scizor 70 Adamant 0/252/0/0/6/252 ".colorize
|
210
|
+
m.reply "- pkrandom, pktrivia, pkdebug, pkstop, pkcache, pkversion ".colorize
|
211
211
|
end
|
212
212
|
}.start
|
data/lib/botemon/abilitydex.rb
CHANGED
@@ -1,35 +1,35 @@
|
|
1
|
-
#--
|
2
|
-
# Copyright(C)
|
3
|
-
#
|
4
|
-
# This file is part of Botémon.
|
5
|
-
#
|
6
|
-
# Botémon is free software: you can redistribute it and/or modify
|
7
|
-
# it under the terms of the GNU General Public License as published by
|
8
|
-
# the Free Software Foundation, either version 3 of the License, or
|
9
|
-
# (at your option) any later version.
|
10
|
-
#
|
11
|
-
# Botémon is distributed in the hope that it will be useful,
|
12
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
-
# GNU General Public License for more details.
|
15
|
-
#
|
16
|
-
# You should have received a copy of the GNU General Public License
|
17
|
-
# along with Botémon. If not, see <http://www.gnu.org/licenses/>.
|
18
|
-
#++
|
19
|
-
|
20
|
-
module Smogon
|
21
|
-
class Moveset
|
22
|
-
attr_accessor :pokemon, :name, :tier, :
|
23
|
-
|
24
|
-
def initialize
|
25
|
-
@
|
26
|
-
@
|
27
|
-
@
|
28
|
-
@moves
|
29
|
-
end
|
30
|
-
|
31
|
-
# def to_s
|
32
|
-
# "Set: #{@name}\nItem: #{@item.join(' / ')}\nAbility: #{@ability.join(' / ')}\nNature: #{@nature.join(' / ')}\nMoves: #{''.tap { |s| @moves.each { |move| s << move.join(' / ') + ', '}}[0..-3]}\nEVs: #{@evs}"
|
33
|
-
# end
|
34
|
-
end
|
35
|
-
end
|
1
|
+
#--
|
2
|
+
# Copyright(C) 2017 Giovanni Capuano <webmaster@giovannicapuano.net>
|
3
|
+
#
|
4
|
+
# This file is part of Botémon.
|
5
|
+
#
|
6
|
+
# Botémon is free software: you can redistribute it and/or modify
|
7
|
+
# it under the terms of the GNU General Public License as published by
|
8
|
+
# the Free Software Foundation, either version 3 of the License, or
|
9
|
+
# (at your option) any later version.
|
10
|
+
#
|
11
|
+
# Botémon is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
# GNU General Public License for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU General Public License
|
17
|
+
# along with Botémon. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
#++
|
19
|
+
|
20
|
+
module Smogon
|
21
|
+
class Moveset
|
22
|
+
attr_accessor :pokemon, :name, :tier, :items, :abilities, :natures, :moves, :ivs, :evs
|
23
|
+
|
24
|
+
def initialize
|
25
|
+
@items = []
|
26
|
+
@abilities = []
|
27
|
+
@natures = []
|
28
|
+
@moves = []
|
29
|
+
end
|
30
|
+
|
31
|
+
# def to_s
|
32
|
+
# "Set: #{@name}\nItem: #{@item.join(' / ')}\nAbility: #{@ability.join(' / ')}\nNature: #{@nature.join(' / ')}\nMoves: #{''.tap { |s| @moves.each { |move| s << move.join(' / ') + ', '}}[0..-3]}\nEVs: #{@evs}"
|
33
|
+
# end
|
34
|
+
end
|
35
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright(C)
|
2
|
+
# Copyright(C) 2017 Giovanni Capuano <webmaster@giovannicapuano.net>
|
3
3
|
#
|
4
4
|
# This file is part of Botémon.
|
5
5
|
#
|
@@ -18,90 +18,90 @@
|
|
18
18
|
#++
|
19
19
|
|
20
20
|
module Smogon
|
21
|
-
|
22
|
-
|
21
|
+
module Type
|
22
|
+
class Pokemon
|
23
|
+
attr_accessor :name, :types, :tier, :abilities, :base_stats, :moves
|
23
24
|
|
24
|
-
|
25
|
-
|
26
|
-
|
25
|
+
def clues
|
26
|
+
"Ability: #{abilities.join(', ')}\nType: #{types.join(?/)}\nBase stats: #{base_stats.join(?/)}"
|
27
|
+
end
|
27
28
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
end
|
29
|
+
def self.to_pokemon(ary)
|
30
|
+
Pokemon.new.tap do |pokemon|
|
31
|
+
pokemon.name = ary['name' ]
|
32
|
+
pokemon.types = ary['types' ]
|
33
|
+
pokemon.tier = ary['tier' ]
|
34
|
+
pokemon.abilities = ary['abilities' ]
|
35
|
+
pokemon.base_stats = ary['base_stats']
|
36
|
+
pokemon.moves = ary['moves' ]
|
37
|
+
end
|
38
|
+
end
|
39
39
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
end
|
40
|
+
def to_ary
|
41
|
+
{
|
42
|
+
'name' => @name,
|
43
|
+
'types' => @types,
|
44
|
+
'tier' => @tier,
|
45
|
+
'abilities' => @abilities,
|
46
|
+
'base_stats' => @base_stats,
|
47
|
+
'moves' => @moves
|
48
|
+
}
|
49
|
+
end
|
51
50
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
51
|
+
def stats(level, nature, evs, ivs)
|
52
|
+
natures = {
|
53
|
+
:jolly => { :plus => :spe, :minus => :atksp },
|
54
|
+
:rash => { :plus => :atksp, :minus => :defsp },
|
55
|
+
:hardy => { :plus => :none, :minus => :none },
|
56
|
+
:brave => { :plus => :atk, :minus => :spe },
|
57
|
+
:naughty => { :plus => :atk, :minus => :defsp },
|
58
|
+
:calm => { :plus => :defsp, :minus => :atk },
|
59
|
+
:careful => { :plus => :defsp, :minus => :atksp },
|
60
|
+
:adamant => { :plus => :atk, :minus => :atksp },
|
61
|
+
:docile => { :plus => :none, :minus => :none },
|
62
|
+
:lax => { :plus => :def, :minus => :defsp },
|
63
|
+
:quirky => { :plus => :none, :minus => :none },
|
64
|
+
:gentle => { :plus => :defsp, :minus => :def },
|
65
|
+
:naive => { :plus => :spe, :minus => :defsp },
|
66
|
+
:hasty => { :plus => :spe, :minus => :def },
|
67
|
+
:mild => { :plus => :atksp, :minus => :def },
|
68
|
+
:modest => { :plus => :atksp, :minus => :atk },
|
69
|
+
:relaxed => { :plus => :def, :minus => :spe },
|
70
|
+
:quiet => { :plus => :atksp, :minus => :spe },
|
71
|
+
:bashful => { :plus => :none, :minus => :none },
|
72
|
+
:impish => { :plus => :def, :minus => :atksp },
|
73
|
+
:lonely => { :plus => :atk, :minus => :def },
|
74
|
+
:serious => { :plus => :none, :minus => :none },
|
75
|
+
:bold => { :plus => :def, :minus => :atk },
|
76
|
+
:timid => { :plus => :spe, :minus => :atk },
|
77
|
+
:sassy => { :plus => :defsp, :minus => :spe },
|
78
|
+
}
|
80
79
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
80
|
+
fields = [ :hp, :atk, :def, :atksp, :defsp, :spe ]
|
81
|
+
evs = Hash[fields.zip evs]
|
82
|
+
ivs = Hash[fields.zip ivs]
|
83
|
+
base_stats = Hash[fields.zip @base_stats]
|
84
|
+
nature = natures[nature.downcase.to_sym]
|
86
85
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
86
|
+
[].tap { |stats|
|
87
|
+
fields.each_with_index { |field|
|
88
|
+
iv = ivs[field].to_i
|
89
|
+
ev = evs[field].to_i
|
90
|
+
base_stat = base_stats[field].to_i
|
91
|
+
multipler = case field
|
92
|
+
when nature[:plus] then 1.1
|
93
|
+
when nature[:minus] then 0.9
|
94
|
+
else 1
|
95
|
+
end
|
97
96
|
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
97
|
+
if field == :hp
|
98
|
+
stats << (((iv + 2 * base_stat + ev / 4) * level / 100) + 10 + level).floor
|
99
|
+
else
|
100
|
+
stats << ((((iv + 2 * base_stat + ev / 4) * level / 100) + 5) * multipler).floor
|
101
|
+
end
|
102
|
+
}
|
103
103
|
}
|
104
|
-
|
104
|
+
end
|
105
105
|
end
|
106
106
|
end
|
107
107
|
end
|
data/lib/botemon/storage.rb
CHANGED
@@ -19,34 +19,36 @@
|
|
19
19
|
|
20
20
|
class Storage
|
21
21
|
attr_accessor :file, :db
|
22
|
-
|
22
|
+
|
23
23
|
def initialize(file)
|
24
24
|
@file = file
|
25
25
|
@db = [].tap { |db|
|
26
|
-
(File.exists?(file) ? JSON.load(File.read(file)) : []).each { |p| db << Smogon::Pokemon.to_pokemon(p) }
|
26
|
+
(File.exists?(file) ? JSON.load(File.read(file)) : []).each { |p| db << Smogon::Type::Pokemon.to_pokemon(p) }
|
27
27
|
}
|
28
28
|
end
|
29
|
-
|
29
|
+
|
30
30
|
def is_cached?(name)
|
31
|
-
|
31
|
+
name = name.downcase
|
32
|
+
@db.select { |p| p.name == name }.any?
|
32
33
|
end
|
33
34
|
alias :include? :is_cached?
|
34
|
-
|
35
|
+
|
35
36
|
def get(name)
|
36
|
-
|
37
|
+
name = name.downcase
|
38
|
+
@db.select { |p| p.name == name }.first
|
37
39
|
end
|
38
|
-
|
40
|
+
|
39
41
|
def get_all
|
40
42
|
@db
|
41
43
|
end
|
42
44
|
alias :dump :get_all
|
43
|
-
|
45
|
+
|
44
46
|
def add(pokemon)
|
45
47
|
return unless pokemon
|
46
48
|
@db << pokemon unless is_cached?(pokemon.name)
|
47
49
|
end
|
48
50
|
alias :put :add
|
49
|
-
|
51
|
+
|
50
52
|
def save
|
51
53
|
[].tap { |ary|
|
52
54
|
@db.each { |p| ary << p.to_ary }
|
@@ -55,4 +57,4 @@ class Storage
|
|
55
57
|
}
|
56
58
|
}
|
57
59
|
end
|
58
|
-
end
|
60
|
+
end
|
data/lib/botemon/version.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright(C)
|
2
|
+
# Copyright(C) 2017 Giovanni Capuano <webmaster@giovannicapuano.net>
|
3
3
|
#
|
4
4
|
# This file is part of Botémon.
|
5
5
|
#
|
@@ -18,5 +18,5 @@
|
|
18
18
|
#++
|
19
19
|
|
20
20
|
module Botemon
|
21
|
-
VERSION = '0.
|
21
|
+
VERSION = '0.8'
|
22
22
|
end
|
metadata
CHANGED
@@ -1,71 +1,71 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: botemon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.8'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Giovanni Capuano
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cinch
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.3'
|
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
|
-
version: '
|
26
|
+
version: '2.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: cinch-login
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
33
|
+
version: '0.1'
|
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
|
-
version: '0'
|
40
|
+
version: '0.1'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: cinch-colorize
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
47
|
+
version: '0.3'
|
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
|
-
version: '0'
|
54
|
+
version: '0.3'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: smogon
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
61
|
+
version: '0.7'
|
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
|
-
version: '0'
|
68
|
+
version: '0.7'
|
69
69
|
description: IRC bot for Pokéfags with (Poké|Ability|Item|Move|Moveset)dex and a trivia
|
70
70
|
game.
|
71
71
|
email: webmaster@giovannicapuano.net
|
@@ -88,7 +88,7 @@ files:
|
|
88
88
|
- lib/botemon/version.rb
|
89
89
|
homepage: http://www.giovannicapuano.net
|
90
90
|
licenses:
|
91
|
-
- GPL-3
|
91
|
+
- GPL-3.0
|
92
92
|
metadata: {}
|
93
93
|
post_install_message:
|
94
94
|
rdoc_options: []
|
@@ -106,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
106
|
version: '0'
|
107
107
|
requirements: []
|
108
108
|
rubyforge_project:
|
109
|
-
rubygems_version: 2.
|
109
|
+
rubygems_version: 2.6.12
|
110
110
|
signing_key:
|
111
111
|
specification_version: 4
|
112
112
|
summary: IRC bot for Pokéfags.
|