test: execute legacy turn command fixtures

This commit is contained in:
2026-07-25 14:17:25 +00:00
parent 1b035e4a42
commit bf96849027
3 changed files with 162 additions and 9 deletions
@@ -17,6 +17,15 @@ class SightseeingMessage{
const HeavyWounded = 0x2000;
static protected $messages = null;
static protected ?\sammo\RandUtil $comparisonRng = null;
public static function setComparisonRng(?\sammo\RandUtil $rng): void
{
if ($rng !== null && getenv('TURN_DIFFERENTIAL_ENABLED') !== '1') {
throw new \RuntimeException('comparison RNG is test-only');
}
static::$comparisonRng = $rng;
}
protected static function getMessageList():array{
/* [[속성, [
@@ -104,9 +113,14 @@ class SightseeingMessage{
}
public function pickAction():array{
[$type, $texts] = Util::choiceRandomUsingWeightPair(static::$messages??[]);
$text = Util::choiceRandom($texts);
if (static::$comparisonRng !== null) {
[$type, $texts] = static::$comparisonRng->choiceUsingWeightPair(static::$messages ?? []);
$text = static::$comparisonRng->choice($texts);
} else {
[$type, $texts] = Util::choiceRandomUsingWeightPair(static::$messages??[]);
$text = Util::choiceRandom($texts);
}
return [$type, $text];
}
}
}