Weather changes on time; repeat rolls lengthen the spell
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
5bcf26f379
commit
0b7e4a722f
3 changed files with 41 additions and 8 deletions
|
|
@ -302,6 +302,7 @@ class CityTest(unittest.TestCase):
|
|||
world = world_with()
|
||||
city = world["city"]
|
||||
city["stockpile"] = {"bread": 5}
|
||||
world["next_fortune_at"] = None # no lucky wagon of bread
|
||||
game.tick(world, T0 + 4 * game.DAY, random.Random(1))
|
||||
self.assertTrue(city["starving"])
|
||||
self.assertNotIn("bread", city["stockpile"])
|
||||
|
|
@ -953,6 +954,18 @@ class HappeningsTest(unittest.TestCase):
|
|||
self.assertEqual(game.season(self.world, T0 + 8 * game.DAY)["name"], "Summer")
|
||||
self.assertEqual(game.season(self.world, T0 + 22 * game.DAY)["name"], "Winter")
|
||||
|
||||
def test_weather_changes_on_time_and_always_to_something_new(self):
|
||||
weather = self.city["weather"]
|
||||
weather.update(kind="rain", next="clear", until=T0 + 10 * 60)
|
||||
self.city["last_tick"] = T0
|
||||
game.tick(self.world, T0 + 11 * 60, self.rng) # well inside the hour
|
||||
self.assertEqual(weather["kind"], "clear")
|
||||
for _ in range(50):
|
||||
spell = weather["until"]
|
||||
game.tick(self.world, spell, self.rng)
|
||||
self.assertNotEqual(weather["next"], weather["kind"])
|
||||
self.assertGreater(weather["until"], spell)
|
||||
|
||||
def test_days_count_midnights_not_24_hour_stretches(self):
|
||||
from datetime import datetime
|
||||
late = datetime(2026, 10, 18, 23, 0).timestamp()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue