fix: exclude synchronized dex from inheritance
This commit is contained in:
@@ -152,19 +152,7 @@ class InheritancePointManager
|
|||||||
};
|
};
|
||||||
switch ($key) {
|
switch ($key) {
|
||||||
case InheritanceKey::dex:
|
case InheritanceKey::dex:
|
||||||
$extractFn = function () use ($general, $multiplier) {
|
$extractFn = fn () => [$this->getDexInheritancePoint($general), null];
|
||||||
$dexLimit = Util::array_last(getDexLevelList())[0];
|
|
||||||
$totalDex = 0;
|
|
||||||
foreach (array_keys(GameUnitConst::allType()) as $armType) {
|
|
||||||
$subDex = $general->getVar("dex{$armType}");
|
|
||||||
if ($subDex > $dexLimit) {
|
|
||||||
$totalDex += ($subDex - $dexLimit) / 3;
|
|
||||||
$subDex = $dexLimit;
|
|
||||||
}
|
|
||||||
$totalDex += $subDex;
|
|
||||||
}
|
|
||||||
return [$totalDex * $multiplier, null];
|
|
||||||
};
|
|
||||||
break;
|
break;
|
||||||
case InheritanceKey::betting:
|
case InheritanceKey::betting:
|
||||||
$extractFn = function () use ($general, $multiplier) {
|
$extractFn = function () use ($general, $multiplier) {
|
||||||
@@ -189,6 +177,28 @@ class InheritancePointManager
|
|||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @param null|int[] $armTypes */
|
||||||
|
public function getDexInheritancePoint(
|
||||||
|
General $general,
|
||||||
|
?int $dexLimit = null,
|
||||||
|
?array $armTypes = null
|
||||||
|
): float
|
||||||
|
{
|
||||||
|
$dexLimit ??= Util::array_last(getDexLevelList())[0];
|
||||||
|
$armTypes ??= array_keys(GameUnitConst::allType());
|
||||||
|
$multiplier = $this->getInheritancePointType(InheritanceKey::dex)->pointCoeff;
|
||||||
|
$totalDex = 0;
|
||||||
|
foreach ($armTypes as $armType) {
|
||||||
|
$subDex = CentennialAllStarGrowthService::recordableValue($general, "dex{$armType}");
|
||||||
|
if ($subDex > $dexLimit) {
|
||||||
|
$totalDex += ($subDex - $dexLimit) / 3;
|
||||||
|
$subDex = $dexLimit;
|
||||||
|
}
|
||||||
|
$totalDex += $subDex;
|
||||||
|
}
|
||||||
|
return $totalDex * $multiplier;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function setInheritancePoint(General $general, InheritanceKey $key, $value, $aux = null)
|
public function setInheritancePoint(General $general, InheritanceKey $key, $value, $aux = null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ use sammo\CentennialAllStarGrowth;
|
|||||||
use sammo\CentennialAllStarGrowthService;
|
use sammo\CentennialAllStarGrowthService;
|
||||||
use sammo\General;
|
use sammo\General;
|
||||||
use sammo\GameConst;
|
use sammo\GameConst;
|
||||||
|
use sammo\InheritancePointManager;
|
||||||
|
|
||||||
$loader = require __DIR__ . '/../vendor/autoload.php';
|
$loader = require __DIR__ . '/../vendor/autoload.php';
|
||||||
$loader->addPsr4('sammo\\', __DIR__ . '/../hwe/sammo', true);
|
$loader->addPsr4('sammo\\', __DIR__ . '/../hwe/sammo', true);
|
||||||
@@ -550,6 +551,28 @@ final class CentennialAllStarGrowthTest extends TestCase
|
|||||||
self::assertSame(1, $result['previousDexExtensionMilestone']);
|
self::assertSame(1, $result['previousDexExtensionMilestone']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testSynchronizedDexDoesNotIncreaseInheritancePoint(): void
|
||||||
|
{
|
||||||
|
$vars = $this->emptyGeneralVars();
|
||||||
|
$vars['dex1'] = 1_300_000;
|
||||||
|
$vars['dex2'] = 1_300_000;
|
||||||
|
$aux = CentennialAllStarGrowthService::initialAux(
|
||||||
|
$this->singleDexTarget('inheritance', 0),
|
||||||
|
[]
|
||||||
|
);
|
||||||
|
$aux['granted']['dex1'] = 1_000_000;
|
||||||
|
$general = $this->createStateGeneralMock($vars, $aux);
|
||||||
|
|
||||||
|
self::assertSame(
|
||||||
|
1_400.0,
|
||||||
|
InheritancePointManager::getInstance()->getDexInheritancePoint(
|
||||||
|
$general,
|
||||||
|
1_000_000,
|
||||||
|
[1, 2, 3, 4, 5]
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public function testDexExtensionDoesNotRefillConsumedConversionBudget(): void
|
public function testDexExtensionDoesNotRefillConsumedConversionBudget(): void
|
||||||
{
|
{
|
||||||
$target = $this->singleDexTarget('extended-consumed', 0, 2000000);
|
$target = $this->singleDexTarget('extended-consumed', 0, 2000000);
|
||||||
|
|||||||
Reference in New Issue
Block a user