pazzdra 0.0.3 → 0.0.4
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/pad_calc +9 -0
- data/lib/pazzdra/stamina.rb +41 -0
- data/lib/pazzdra/version.rb +1 -1
- data/lib/pazzdra.rb +1 -0
- data/spec/calc_spec.rb +74 -0
- data/spec/spec_helper.rb +4 -0
- data/spec/stamina_spec.rb +21 -0
- metadata +7 -4
- data/spec/pazzdra_spec.rb +0 -76
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78dcbbe385855316542f47e90b7f5d6a3fef4210
|
4
|
+
data.tar.gz: 9d77a1cc9bfdbe88176a6ba696a01909ac09e614
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d43622f0b752a2e15f48c47b383d63d948547a41019ce5db37b9dabc94b553f29ee1bc42a4d649cf17bc72ed8508b77a12ef232a3d88949b8b3b6c85d960bd42
|
7
|
+
data.tar.gz: add24662f01d7a8182a2401ade876f189aa8d4071a2e401b65ad13f4e657a79335e176e64016886b8152c3ce66690142ee358661d2ec93bcb38474df73e66cab
|
data/bin/pad_calc
CHANGED
@@ -25,6 +25,7 @@ EOS
|
|
25
25
|
private
|
26
26
|
def init
|
27
27
|
@base = Pazzdra::Calc.new
|
28
|
+
@stamina_base = Pazzdra::Stamina.new
|
28
29
|
end
|
29
30
|
|
30
31
|
Pazzdra::Calc.DEFAULT_BASE.keys.each do |key|
|
@@ -61,6 +62,14 @@ EOS
|
|
61
62
|
end
|
62
63
|
end
|
63
64
|
|
65
|
+
def stamina_base(val)
|
66
|
+
@stamina_base.base_stamina = val
|
67
|
+
end
|
68
|
+
|
69
|
+
def stamina(val=nil)
|
70
|
+
@stamina_base.stamina val
|
71
|
+
end
|
72
|
+
|
64
73
|
def show
|
65
74
|
@base.show
|
66
75
|
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
|
2
|
+
require 'time'
|
3
|
+
|
4
|
+
module Pazzdra
|
5
|
+
class Stamina
|
6
|
+
class << Stamina
|
7
|
+
def cal(target_time=nil, base_stamina=0)
|
8
|
+
target_time ||= Time.now + (60 * 60 * 8)
|
9
|
+
(base_stamina + (target_time - Time.now) / 60 / 10).to_i
|
10
|
+
end
|
11
|
+
def cal_time(target_stamina, base_stamina=0)
|
12
|
+
Time.now + (60 * 10 * (target_stamina - base_stamina))
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
attr_accessor :target_time
|
17
|
+
attr_accessor :base_stamina
|
18
|
+
|
19
|
+
def initialize
|
20
|
+
@target_time = Time.now + (60 * 60 * 8)
|
21
|
+
@base_stamina = 0
|
22
|
+
end
|
23
|
+
|
24
|
+
def stamina(val=nil)
|
25
|
+
case val
|
26
|
+
when Numeric, NilClass
|
27
|
+
stamina_time val
|
28
|
+
when String
|
29
|
+
stamina_val val
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def stamina_time(val=0)
|
34
|
+
Stamina.cal_time val, @base_stamina
|
35
|
+
end
|
36
|
+
|
37
|
+
def stamina_val(val)
|
38
|
+
Stamina.cal Time.parse(val), @base_stamina
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
data/lib/pazzdra/version.rb
CHANGED
data/lib/pazzdra.rb
CHANGED
data/spec/calc_spec.rb
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
|
2
|
+
require 'spec_helper'
|
3
|
+
require 'pazzdra'
|
4
|
+
|
5
|
+
describe Pazzdra::Calc, "攻撃力計算機能" do
|
6
|
+
context 'クラスから使用する場合' do
|
7
|
+
it "基本の攻撃力のみ" do
|
8
|
+
expect(Pazzdra::Calc.cal(1010)).to eq(1010)
|
9
|
+
end
|
10
|
+
|
11
|
+
it "リーダー x フレンド x エンハンス" do
|
12
|
+
expect(Pazzdra::Calc.cal(1010,3.5)).to eq(3535)
|
13
|
+
expect(Pazzdra::Calc.cal(810,2.5,3.5)).to eq(7088)
|
14
|
+
expect(Pazzdra::Calc.cal(1234,2.5,2,1.5)).to eq(9255)
|
15
|
+
end
|
16
|
+
|
17
|
+
it "ドロップ追加" do
|
18
|
+
expect(Pazzdra::Calc.cal(1010,3.5,3.5)).to eq(12373)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
context 'インスタンスで使用する場合' do
|
23
|
+
before do
|
24
|
+
@calc = Pazzdra::Calc.new
|
25
|
+
end
|
26
|
+
|
27
|
+
subject{ @calc.cal }
|
28
|
+
context '基本!' do
|
29
|
+
it "リーダーのみ" do
|
30
|
+
@calc.merge({ base: 1000, leader: 1.5 })
|
31
|
+
should eq 1500
|
32
|
+
end
|
33
|
+
it "リーダー x フレンド x エンハンス" do
|
34
|
+
@calc.merge({ base: 1000, leader: 1.5, friend: 2, skill: 3.5 })
|
35
|
+
should eq 10500
|
36
|
+
end
|
37
|
+
end
|
38
|
+
context 'コンボデータ有' do
|
39
|
+
it "ベースの色無し、コンボ数指定" do
|
40
|
+
@calc.merge({ base: 1000, leader: 2.5, combo: 3 })
|
41
|
+
should eq 3750
|
42
|
+
end
|
43
|
+
it "ベースの色無し、コンボ色指定" do
|
44
|
+
@calc.merge({ base: 1000, leader: 2.5, combo: {r: [3], g: [3,4,4], b: [3] } })
|
45
|
+
should eq 5000
|
46
|
+
end
|
47
|
+
it "ベースの色指定、コンボ色指定" do
|
48
|
+
@calc.merge({ base: [{r: 1000}], leader: 2.5, combo: {r: [3], g: [3,4,4], b: [3] } })
|
49
|
+
should eq [{r: 5000}]
|
50
|
+
end
|
51
|
+
it "ベースの色指定、コンボ色指定 複数" do
|
52
|
+
@calc.merge({ base: [{r: 1000, sub: :r},{b: 1200, sub: :r}], leader: 2.5, combo: {r: [3], g: [3,4,4], b: [3] } })
|
53
|
+
should eq [{r: 5000, sub: {r: 2500}},{b: 6000, sub: {r: 3000}}]
|
54
|
+
end
|
55
|
+
it "ベースの色指定、コンボ色指定 攻撃色が複数" do
|
56
|
+
@calc.merge({ base: [{r: 1000}], leader: 2.5, combo: {r: [3, 3], g: [3,4], b: [3] } })
|
57
|
+
should eq [{r: 10000}]
|
58
|
+
end
|
59
|
+
it "ベースの色指定、コンボ色指定 攻撃色が複数、長さ4越え" do
|
60
|
+
@calc.merge({ base: [{g: 1200, sub: :g}], leader: 2.5, combo: {r: [3, 3], g: [3,4], b: [3] } })
|
61
|
+
should eq [{g: 13500, sub: {g: 6750}}]
|
62
|
+
end
|
63
|
+
it "ベースの色指定、コンボ色指定 攻撃色が複数、長さ4越え 複数" do
|
64
|
+
@calc.merge({ base: [{g: 1200, sub: :g},{y: 1234, sub: :r}], leader: 2.5, friend: 2, skill: 1.5, combo: {r: [3, 3], g: [3,4], b: [3], y: [4, 6] } })
|
65
|
+
should eq [{g: 50625, sub: {g: 25313}},{y: 69413, sub: {r: 23138}}]
|
66
|
+
end
|
67
|
+
it "ベースの色指定、コンボ色指定 攻撃色が複数、長さ4越え 複数、強化ドロップあり" do
|
68
|
+
@calc.merge({ base: [{g: 1200, sub: :g},{y: 1234, sub: :r}], leader: 2.5, friend: 2, skill: 1.5, combo: {r: [3, 3], g: [3,4], b: [3], y: [4, 6] }, plus_drop: {g: 4} })
|
69
|
+
should eq [{g: 62775, sub: {g: 31388}},{y: 69413, sub: {r: 23138}}]
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
data/spec/spec_helper.rb
CHANGED
@@ -0,0 +1,21 @@
|
|
1
|
+
|
2
|
+
require 'spec_helper'
|
3
|
+
require 'pazzdra'
|
4
|
+
|
5
|
+
describe Pazzdra::Stamina, "スタミナ回復時間計算機能" do
|
6
|
+
context 'インスタンスで使用する場合' do
|
7
|
+
before do
|
8
|
+
@stamina = Pazzdra::Stamina.new
|
9
|
+
end
|
10
|
+
|
11
|
+
context '基本機能' do
|
12
|
+
it "回復時刻を知る" do
|
13
|
+
time_format(@stamina.stamina(6)).should eq time_format(Time.now + (60 * 60))
|
14
|
+
end
|
15
|
+
it "指定時刻でのスタミナ数" do
|
16
|
+
@stamina.stamina(time_format(Time.now + (60 * 60 * 1))).should eq 5
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pazzdra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- takashi.akagi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -82,10 +82,12 @@ files:
|
|
82
82
|
- bin/pad_calc
|
83
83
|
- lib/pazzdra.rb
|
84
84
|
- lib/pazzdra/calc.rb
|
85
|
+
- lib/pazzdra/stamina.rb
|
85
86
|
- lib/pazzdra/version.rb
|
86
87
|
- pazzdra.gemspec
|
87
|
-
- spec/
|
88
|
+
- spec/calc_spec.rb
|
88
89
|
- spec/spec_helper.rb
|
90
|
+
- spec/stamina_spec.rb
|
89
91
|
homepage: https://github.com/majosystems/pazzdra
|
90
92
|
licenses:
|
91
93
|
- MIT
|
@@ -111,6 +113,7 @@ signing_key:
|
|
111
113
|
specification_version: 4
|
112
114
|
summary: PAZZRU & DRAGONS calc.
|
113
115
|
test_files:
|
114
|
-
- spec/
|
116
|
+
- spec/calc_spec.rb
|
115
117
|
- spec/spec_helper.rb
|
118
|
+
- spec/stamina_spec.rb
|
116
119
|
has_rdoc:
|
data/spec/pazzdra_spec.rb
DELETED
@@ -1,76 +0,0 @@
|
|
1
|
-
|
2
|
-
require 'spec_helper'
|
3
|
-
require 'pazzdra'
|
4
|
-
|
5
|
-
describe Pazzdra, "パズドラ各種計算アプリ" do
|
6
|
-
describe Pazzdra::Calc, "攻撃力計算機能" do
|
7
|
-
context 'クラスから使用する場合' do
|
8
|
-
it "基本の攻撃力のみ" do
|
9
|
-
expect(Pazzdra::Calc.cal(1010)).to eq(1010)
|
10
|
-
end
|
11
|
-
|
12
|
-
it "リーダー x フレンド x エンハンス" do
|
13
|
-
expect(Pazzdra::Calc.cal(1010,3.5)).to eq(3535)
|
14
|
-
expect(Pazzdra::Calc.cal(810,2.5,3.5)).to eq(7088)
|
15
|
-
expect(Pazzdra::Calc.cal(1234,2.5,2,1.5)).to eq(9255)
|
16
|
-
end
|
17
|
-
|
18
|
-
it "ドロップ追加" do
|
19
|
-
expect(Pazzdra::Calc.cal(1010,3.5,3.5)).to eq(12373)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
context 'インスタンスで使用する場合' do
|
24
|
-
before do
|
25
|
-
@calc = Pazzdra::Calc.new
|
26
|
-
end
|
27
|
-
|
28
|
-
subject{ @calc.cal }
|
29
|
-
context '基本!' do
|
30
|
-
it "リーダーのみ" do
|
31
|
-
@calc.merge({ base: 1000, leader: 1.5 })
|
32
|
-
should eq 1500
|
33
|
-
end
|
34
|
-
it "リーダー x フレンド x エンハンス" do
|
35
|
-
@calc.merge({ base: 1000, leader: 1.5, friend: 2, skill: 3.5 })
|
36
|
-
should eq 10500
|
37
|
-
end
|
38
|
-
end
|
39
|
-
context 'コンボデータ有' do
|
40
|
-
it "ベースの色無し、コンボ数指定" do
|
41
|
-
@calc.merge({ base: 1000, leader: 2.5, combo: 3 })
|
42
|
-
should eq 3750
|
43
|
-
end
|
44
|
-
it "ベースの色無し、コンボ色指定" do
|
45
|
-
@calc.merge({ base: 1000, leader: 2.5, combo: {r: [3], g: [3,4,4], b: [3] } })
|
46
|
-
should eq 5000
|
47
|
-
end
|
48
|
-
it "ベースの色指定、コンボ色指定" do
|
49
|
-
@calc.merge({ base: [{r: 1000}], leader: 2.5, combo: {r: [3], g: [3,4,4], b: [3] } })
|
50
|
-
should eq [{r: 5000}]
|
51
|
-
end
|
52
|
-
it "ベースの色指定、コンボ色指定 複数" do
|
53
|
-
@calc.merge({ base: [{r: 1000, sub: :r},{b: 1200, sub: :r}], leader: 2.5, combo: {r: [3], g: [3,4,4], b: [3] } })
|
54
|
-
should eq [{r: 5000, sub: {r: 2500}},{b: 6000, sub: {r: 3000}}]
|
55
|
-
end
|
56
|
-
it "ベースの色指定、コンボ色指定 攻撃色が複数" do
|
57
|
-
@calc.merge({ base: [{r: 1000}], leader: 2.5, combo: {r: [3, 3], g: [3,4], b: [3] } })
|
58
|
-
should eq [{r: 10000}]
|
59
|
-
end
|
60
|
-
it "ベースの色指定、コンボ色指定 攻撃色が複数、長さ4越え" do
|
61
|
-
@calc.merge({ base: [{g: 1200, sub: :g}], leader: 2.5, combo: {r: [3, 3], g: [3,4], b: [3] } })
|
62
|
-
should eq [{g: 13500, sub: {g: 6750}}]
|
63
|
-
end
|
64
|
-
it "ベースの色指定、コンボ色指定 攻撃色が複数、長さ4越え 複数" do
|
65
|
-
@calc.merge({ base: [{g: 1200, sub: :g},{y: 1234, sub: :r}], leader: 2.5, friend: 2, skill: 1.5, combo: {r: [3, 3], g: [3,4], b: [3], y: [4, 6] } })
|
66
|
-
should eq [{g: 50625, sub: {g: 25313}},{y: 69413, sub: {r: 23138}}]
|
67
|
-
end
|
68
|
-
it "ベースの色指定、コンボ色指定 攻撃色が複数、長さ4越え 複数、強化ドロップあり" do
|
69
|
-
@calc.merge({ base: [{g: 1200, sub: :g},{y: 1234, sub: :r}], leader: 2.5, friend: 2, skill: 1.5, combo: {r: [3, 3], g: [3,4], b: [3], y: [4, 6] }, plus_drop: {g: 4} })
|
70
|
-
should eq [{g: 62775, sub: {g: 31388}},{y: 69413, sub: {r: 23138}}]
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|