ogem 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ogem/ogamecalc.rb +1 -1
- data/lib/ogem/player.class.rb +2 -2
- data/lib/ogem/ship.class.rb +7 -7
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 688314260efcab0747741a86f7c1a2b8a66aede0
|
4
|
+
data.tar.gz: 26f1b265bca5b98dca65b2fddb10a8eef12b978d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 04d58a67cb49ca15614e6a429d3bca5ac8c8f6d42785da6169c5a031bc8cfd2647efd637bbd223fb43eba867ae10fcb3263bb67712b66dc02340eb9f03c2a998
|
7
|
+
data.tar.gz: b1eb81a0f591010ef0a8b7805506ef6a3bb663895c7603c239dd0f50065baaab4e36f61f4107f67104afcdb8a0030de56c8f7e4b7e1f344e5a9f7d239231007c
|
data/lib/ogem/ogamecalc.rb
CHANGED
data/lib/ogem/player.class.rb
CHANGED
@@ -2,13 +2,13 @@
|
|
2
2
|
|
3
3
|
gem 'myerror'
|
4
4
|
|
5
|
-
module
|
5
|
+
module Ogem
|
6
6
|
class Player
|
7
7
|
attr_accessor :name, :r
|
8
8
|
|
9
9
|
def initialize name="Player", m=1000, c=1000, d=0
|
10
10
|
if !name.is_a?String
|
11
|
-
Error.call "
|
11
|
+
Error.call "Ogem::Player::new : invalid name", Error::ERR_MEDIUM
|
12
12
|
name = "Player"
|
13
13
|
end
|
14
14
|
|
data/lib/ogem/ship.class.rb
CHANGED
@@ -2,20 +2,20 @@
|
|
2
2
|
|
3
3
|
gem 'myerror'
|
4
4
|
|
5
|
-
module
|
5
|
+
module Ogem
|
6
6
|
class Ship
|
7
7
|
attr_reader :name, :r, :abv
|
8
8
|
|
9
9
|
def initialize name="Ship", abv="", m=3000, c=1000, d=0
|
10
10
|
if !name.is_a?String
|
11
|
-
Error.call "
|
11
|
+
Error.call "Ogem::Ship::new : invalid name", Error::ERR_MEDIUM
|
12
12
|
name = "UnknowShip"
|
13
|
-
elsif !abv.is_a?String
|
14
|
-
Error.call "
|
13
|
+
elsif !abv.is_a?String and !abv.is_a?Symbol
|
14
|
+
Error.call "Ogem::Ship::new : invalid abv", Error::ERR_MEDIUM
|
15
15
|
name = "unknow"
|
16
16
|
end
|
17
17
|
@name = name
|
18
|
-
@abv = abv
|
18
|
+
@abv = abv.to_sym
|
19
19
|
@r = {m: m.to_i, c: c.to_i, d: d.to_i}
|
20
20
|
end
|
21
21
|
|
@@ -29,14 +29,14 @@ module OgameCalc
|
|
29
29
|
|
30
30
|
def cost
|
31
31
|
line = ""
|
32
|
-
|
32
|
+
Ogem::RESOURCES.each do |k, v|
|
33
33
|
line += "\t<#{v}:#{@r[k]}>"
|
34
34
|
end
|
35
35
|
return line
|
36
36
|
end
|
37
37
|
|
38
38
|
def self.get_abv abv
|
39
|
-
|
39
|
+
Ogem::SHIP_LIST.each do |k, ship|
|
40
40
|
Error.call "Ship::self.get_abv : Invalid element #{ship}" if !ship.is_a?Ship
|
41
41
|
return ship if ship.abv == abv
|
42
42
|
end
|