P07-01-WX: 仕上がった天候の機能の受入:自然天候・雨・嵐・世界樹と成人客のマナ霧・上部の表示と予報・保存と移行(マナ炉の産出 120 を除く。P07-01 の補助の作業。原単位への加算 0)
This commit is contained in:
@@ -43,6 +43,30 @@ static func draw(rng: DeterministicRng, day: int) -> Dictionary:
|
||||
return {&"day": day, &"kind": kind, &"roll": roll, &"slot": slot,
|
||||
&"start": start, &"end": start + int(DURATION_MINUTES[kind])}
|
||||
|
||||
## A saved day's draw must be this rule's own result (SPEC section 5.3): the roll
|
||||
## picks the kind, a clear day has no slot, and any other day starts on its slot
|
||||
## and lasts its kind's duration. An empty draw (no day drawn yet) is consistent.
|
||||
static func is_consistent_draw(draw: Dictionary) -> bool:
|
||||
if draw.is_empty():
|
||||
return true
|
||||
var roll := int(draw[&"roll"])
|
||||
var kind := StringName(draw[&"kind"])
|
||||
var expected: StringName = &"clear"
|
||||
if roll >= FOG_BELOW:
|
||||
expected = &"storm"
|
||||
elif roll >= RAIN_BELOW:
|
||||
expected = &"mana_fog"
|
||||
elif roll >= CLEAR_BELOW:
|
||||
expected = &"rain"
|
||||
if kind != expected:
|
||||
return false
|
||||
if kind == &"clear":
|
||||
return int(draw[&"slot"]) == -1 and int(draw[&"start"]) == -1 and int(draw[&"end"]) == -1
|
||||
var slot := int(draw[&"slot"])
|
||||
var start := int(draw[&"day"]) * DAY_MINUTES + FIRST_START_MINUTE_OF_DAY + slot * START_SLOT_MINUTES
|
||||
return slot >= 0 and slot < START_SLOTS and int(draw[&"start"]) == start \
|
||||
and int(draw[&"end"]) == start + int(DURATION_MINUTES[kind])
|
||||
|
||||
static func arrival_percent(kind: StringName) -> int:
|
||||
return RAIN_ARRIVAL_PERCENT if kind == &"rain" else 100
|
||||
|
||||
|
||||
Reference in New Issue
Block a user