Add hatch retention, automatic breakthroughs and exploration
This commit is contained in:
@@ -44,7 +44,7 @@ class ManualRuleTests(unittest.TestCase):
|
||||
secondary = dict(primary, id=901, level=9, potentialLevel=1)
|
||||
self.snapshot.raw["monsters"].append(secondary)
|
||||
policy = Policy(manual_eggs=True, strategy="gold", fill=False, protect_star=6, protect_quality=5,
|
||||
egg_rules={str(food["typeId"]): self.rule(action="feed")}, feed_targets={"900": 1, "901": 2})
|
||||
egg_rules={str(food["typeId"]): self.rule(action="feed", keep_count=0)}, feed_targets={"900": 1, "901": 2})
|
||||
action = self.planner.plan(self.snapshot, policy)[0]
|
||||
self.assertEqual(action.kind, "feed")
|
||||
self.assertEqual(action.payload["targetId"], 901)
|
||||
@@ -83,6 +83,19 @@ class ManualRuleTests(unittest.TestCase):
|
||||
with self.assertRaises(ValueError):
|
||||
Policy(egg_rules={"1001010": {"refill_below": 5, "refill_target": 2}})
|
||||
|
||||
def test_quota_and_breakthrough_targets_validate_instead_of_silently_dropping_bad_values(self):
|
||||
self.assertEqual(EggRule().keep_count, 1)
|
||||
self.assertEqual(EggRule(keep_count="2").keep_count, 2)
|
||||
for value in (True, 1.0, 1.5, "1.0", " 1", "+1", -1, 1001, None):
|
||||
with self.subTest(keep_count=value), self.assertRaises(ValueError):
|
||||
EggRule(keep_count=value)
|
||||
self.assertEqual(Policy(breakthrough_targets={"900": 2}).breakthrough_targets, {"900": 2})
|
||||
self.assertTrue(self.planner.protected(self.snapshot.monsters[900], self.snapshot,
|
||||
Policy(protect_star=6, protect_quality=6, breakthrough_targets={"900": 2})))
|
||||
for targets in ([], {"0": 1}, {"900": 0}, {"900": 1000}, {"900": True}, {"900": 1.5}, {"x": 1}):
|
||||
with self.subTest(targets=targets), self.assertRaises(ValueError):
|
||||
Policy(breakthrough_targets=targets)
|
||||
|
||||
|
||||
class ManagementTests(unittest.TestCase):
|
||||
def setUp(self):
|
||||
|
||||
Reference in New Issue
Block a user