feat,refac: 게임 로직 내 '랜덤'을 RandUtil을 활용하여 재설정
- 기존의 랜덤 코드는 deprecated 처리 - 서버 시작 시 랜덤하게 정해진 hiddenSeed를 활용 - 랜덤 생성 단위 - 월 실행 - 사령턴 실행 결과 - 커맨드 실행 결과 - 작위 보상 - 부대장 생성 - 유니크 획득 시도 - 설문 조사 - 장수 생성 - NPC국 생성, NPC 생성, NPC의 토너먼트 베팅 - 전투 - 도시 점령 - 자율 행동 선택 - 랜덤 턴 변경 - 거래장, 토너먼트 등 구 랜덤 코드를 이용하는 잔여 코드 있음
This commit is contained in:
@@ -60,7 +60,7 @@ class che_물자조달 extends Command\GeneralCommand{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public function run():bool{
|
||||
public function run(\Sammo\RandUtil $rng):bool{
|
||||
if(!$this->hasFullConditionMet()){
|
||||
throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도');
|
||||
}
|
||||
@@ -70,14 +70,14 @@ class che_물자조달 extends Command\GeneralCommand{
|
||||
$general = $this->generalObj;
|
||||
$date = $general->getTurnTime($general::TURNTIME_HM);
|
||||
|
||||
[$resName, $resKey] = Util::choiceRandom([
|
||||
[$resName, $resKey] = $rng->choice([
|
||||
['금', 'gold'],
|
||||
['쌀', 'rice']
|
||||
]);
|
||||
|
||||
$score = $general->getLeadership() + $general->getStrength() + $general->getIntel();
|
||||
$score *= getDomesticExpLevelBonus($general->getVar('explevel'));
|
||||
$score *= Util::randRange(0.8, 1.2);
|
||||
$score *= $rng->nextRange(0.8, 1.2);
|
||||
|
||||
$successRatio = 0.1;
|
||||
$failRatio = 0.3;
|
||||
@@ -86,12 +86,12 @@ class che_물자조달 extends Command\GeneralCommand{
|
||||
$failRatio = $general->onCalcDomestic('조달', 'fail', $failRatio);
|
||||
$normalRatio = 1 - $failRatio - $successRatio;
|
||||
|
||||
$pick = Util::choiceRandomUsingWeight([
|
||||
$pick = $rng->choiceUsingWeight([
|
||||
'fail'=>$failRatio,
|
||||
'success'=>$successRatio,
|
||||
'normal'=>$normalRatio
|
||||
]);
|
||||
$score *= CriticalScoreEx($pick);
|
||||
$score *= CriticalScoreEx($rng, $pick);
|
||||
$score = $general->onCalcDomestic('조달', 'score', $score);
|
||||
|
||||
$score = Util::round($score);
|
||||
@@ -112,7 +112,7 @@ class che_물자조달 extends Command\GeneralCommand{
|
||||
$exp = $score * 0.7 / 3;
|
||||
$ded = $score * 1.0 / 3;
|
||||
|
||||
$incStat = Util::choiceRandomUsingWeight([
|
||||
$incStat = $rng->choiceUsingWeight([
|
||||
'leadership_exp'=>$general->getLeadership(false, false, false, false),
|
||||
'strength_exp'=>$general->getStrength(false, false, false, false),
|
||||
'intel_exp'=>$general->getIntel(false, false, false, false)
|
||||
@@ -128,7 +128,7 @@ class che_물자조달 extends Command\GeneralCommand{
|
||||
|
||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
$general->checkStatChange();
|
||||
tryUniqueItemLottery($general);
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
||||
|
||||
$general->applyDB($db);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user