test: execute legacy turn command fixtures
This commit is contained in:
@@ -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];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user