mgmg 1.6.0 → 1.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/mgmg/equip.rb +3 -0
- data/lib/mgmg/ir.rb +3 -0
- data/lib/mgmg/recipe.rb +1 -1
- data/lib/mgmg/search.rb +13 -1
- data/lib/mgmg/version.rb +1 -1
- data/lib/mgmg.rb +9 -1
- data/reference.md +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9da45e92b9c5fb1cae6577e532cce280c997f46c1df019514b1eb976d89f03f
|
4
|
+
data.tar.gz: 6f905a8d05126dbc81c71e73ddd64988e96a2033f520f6ded8b595ac96eb06be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cfaf9d22a5aaa36fdef9c15348117a014a4a9385947417a614a3f1fc82622ee4f1ad4c0d5615cbde9dded71b4a2a13edb88938e0fc88c818fafe27625b8f9885
|
7
|
+
data.tar.gz: 46734977a74542248d65449eb9b49aa4c9ce6f5b875a194c1ec8db6bdab47856fa341c9c77ef29f28c76dd4d078899260da64a6c8d04510fd7b4c692af8581c1
|
data/CHANGELOG.md
CHANGED
@@ -169,3 +169,8 @@
|
|
169
169
|
## 1.6.0 2022/10/18
|
170
170
|
- `Mgmg.#find_upperbound`のアルゴリズムを改善し,探索下限目標値の引数を削除.
|
171
171
|
- `Enumerable#search`,`Enumerable#find_max`が正しい解を返さない場合があったバグを修正.
|
172
|
+
|
173
|
+
## 1.6.1 2022/10/21
|
174
|
+
- `Mgmg.#find_lowerbound`,`Mgmg.#find_upperbound`において,同値レシピを指定した場合などを例外とするように修正.
|
175
|
+
- `Enumerable#to_recipe`にも`allow_over20`キーワード引数を導入し,デフォルトで☆20を超えるレシピを含む場合に例外とするように修正.
|
176
|
+
- 実効HP(最大HP+腕力)を表す`Mgmg::Equip#hs`を追加.
|
data/lib/mgmg/equip.rb
CHANGED
data/lib/mgmg/ir.rb
CHANGED
data/lib/mgmg/recipe.rb
CHANGED
@@ -130,7 +130,7 @@ module Mgmg
|
|
130
130
|
def ir(**kw)
|
131
131
|
temp_opt(**kw).irep
|
132
132
|
end
|
133
|
-
%i|attack phydef magdef hp mp str dex speed magic atkstr atk_sd dex_as mag_das magic2 magmag pmdef|.each do |sym|
|
133
|
+
%i|attack phydef magdef hp mp str dex speed magic atkstr atk_sd dex_as mag_das magic2 magmag pmdef hs|.each do |sym|
|
134
134
|
define_method(sym) do |s, ac=s, x=false, **kw|
|
135
135
|
s, ac, x = correct_level(s, ac, x, temp_opt(**kw))
|
136
136
|
ir(**kw).method(sym).call(s, ac, x)
|
data/lib/mgmg/search.rb
CHANGED
@@ -369,6 +369,13 @@ module Mgmg
|
|
369
369
|
pa, pb = opt_a.irep.para_call(para, *sca), opt_b.irep.para_call(para, *scb)
|
370
370
|
if eb < ea || ( ea == eb && pa < pb )
|
371
371
|
a, b, opt_a, opt_b, sca, scb, ea, eb = b, a, opt_b, opt_a, scb, sca, eb, ea
|
372
|
+
elsif eb == ea && pa == pb
|
373
|
+
raise Mgmg::SearchCutException, "given recipes are equivalent at start target=#{start.comma3}"
|
374
|
+
end
|
375
|
+
scat, scbt = a.search(para, term, opt: opt_a), b.search(para, term, opt: opt_b)
|
376
|
+
eat, ebt = Mgmg.exp(*scat), Mgmg.exp(*scbt)
|
377
|
+
if eat < ebt || ( eat == ebt && opt_b.irep.para_call(para, *scbt) <= opt_a.irep.para_call(para, *scat) )
|
378
|
+
raise Mgmg::SearchCutException, "given recipes will never be reversed from start target=#{start.comma3} until term target=#{term.comma3}"
|
372
379
|
end
|
373
380
|
|
374
381
|
loop do
|
@@ -419,13 +426,18 @@ module Mgmg
|
|
419
426
|
pa, pb = opt_a.irep.para_call(para, *sca), opt_b.irep.para_call(para, *scb)
|
420
427
|
if ea < eb || ( ea == eb && pb < pa )
|
421
428
|
a, b, opt_a, opt_b, sca, scb, ea, eb = b, a, opt_b, opt_a, scb, sca, eb, ea
|
429
|
+
elsif eb == ea && pa == pb
|
430
|
+
raise Mgmg::SearchCutException, "given recipes are equivalent at start target=#{start.comma3}"
|
422
431
|
end
|
423
432
|
|
433
|
+
|
424
434
|
loop do
|
425
435
|
loop do
|
426
436
|
foo = a.find_max(para, eb, opt: opt_a)
|
427
437
|
break if sca == foo
|
428
|
-
|
438
|
+
bar = opt_a.irep.para_call(para, *foo)
|
439
|
+
break if pa < bar
|
440
|
+
sca, pa = foo, bar
|
429
441
|
scb = b.search(para, pa, opt: opt_b)
|
430
442
|
foo = Mgmg.exp(*scb)
|
431
443
|
break if eb == foo
|
data/lib/mgmg/version.rb
CHANGED
data/lib/mgmg.rb
CHANGED
@@ -89,6 +89,8 @@ class String
|
|
89
89
|
pd = self.poly(:phydef, opt:)
|
90
90
|
md = self.poly(:magmag, opt:)
|
91
91
|
pd <= md ? pd : md
|
92
|
+
when :hs
|
93
|
+
self.poly(:hp, opt:) + self.poly(:str, opt:)
|
92
94
|
when :cost
|
93
95
|
if opt.include_system_equips and Mgmg::SystemEquip.has_key?(self) then
|
94
96
|
return Mgmg::TPolynomial.new(Mgmg::Mat.new(1, 1, 0.quo(1)), 28, 0, 12, 12)
|
@@ -140,7 +142,13 @@ class String
|
|
140
142
|
end
|
141
143
|
module Enumerable
|
142
144
|
using Mgmg::Refiner
|
143
|
-
def to_recipe(para=:power, **kw)
|
145
|
+
def to_recipe(para=:power, allow_over20: false, **kw)
|
146
|
+
unless allow_over20
|
147
|
+
self.each do |e|
|
148
|
+
foo = e.build(-1).star
|
149
|
+
raise Mgmg::Over20Error, foo if 20 < foo
|
150
|
+
end
|
151
|
+
end
|
144
152
|
Mgmg::Recipe.new(self, para, **kw)
|
145
153
|
end
|
146
154
|
def build(smith=-1, armor=smith, comp=armor.tap{armor=smith}, opt: Mgmg::Option.new)
|
data/reference.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# リファレンス
|
2
2
|
本ライブラリで定義される主要なメソッドを以下に解説します.
|
3
3
|
|
4
|
-
## `String#to_recipe(para=:power, allow_over20: false, **kw)`,`Enumerable#to_recipe(para=:power, **kw)`
|
4
|
+
## `String#to_recipe(para=:power, allow_over20: false, **kw)`,`Enumerable#to_recipe(para=:power, allow_over20: false, **kw)`
|
5
5
|
レシピ文字列である`self`と,注目パラメータ`para`,オプション`Mgmg.option(**kw)`をセットにした[後述](#mgmgrecipe)の`Mgmg::Recipe`オブジェクトを生成して返します.デフォルト値としてセットされたパラメータを使用する以外は,レシピ文字列と同様に扱えます.
|
6
6
|
|
7
7
|
`allow_over20`が偽の場合,レシピの☆を確認し,20を超える場合は,例外`Mgmg::Over20Error`を発生します.このチェックを抑制したい場合は,真にしてください.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mgmg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- KAZOON
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-10-
|
11
|
+
date: 2022-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|