diff --git a/hwe/battle_simulator.php b/hwe/battle_simulator.php
index 1ae1c74b..4b4f130a 100644
--- a/hwe/battle_simulator.php
+++ b/hwe/battle_simulator.php
@@ -90,8 +90,9 @@ $startYear = $gameStor->getValue('startyear');
국가 성향
diff --git a/hwe/func_gamerule.php b/hwe/func_gamerule.php
index 2da58850..3d4fe8ef 100644
--- a/hwe/func_gamerule.php
+++ b/hwe/func_gamerule.php
@@ -20,6 +20,8 @@ function getNationLevelList():array{
}
function getNationTypeList():array{
+ return GameConst::$availableNationType;
+
$table = [
13=>['명가', '기술↑ 인구↑', '쌀수입↓ 수성↓'],
12=>['음양가', '내정↑ 인구↑', '기술↓ 전략↓'],
diff --git a/hwe/func_process.php b/hwe/func_process.php
index f1205dd6..68f0ed02 100644
--- a/hwe/func_process.php
+++ b/hwe/func_process.php
@@ -14,7 +14,7 @@ use Constraint\Constraint;
*
* @return int|float 계산된 능력치
*/
-function getGeneralLeadership(&$general, $withInjury, $withItem, $withStatAdjust, $useFloor = true){
+function getGeneralLeadership($general, $withInjury, $withItem, $withStatAdjust, $useFloor = true){
if($general === null){
return 0;
}
@@ -57,7 +57,7 @@ function getGeneralLeadership(&$general, $withInjury, $withItem, $withStatAdjust
*
* @return int|float 계산된 능력치
*/
-function getGeneralPower(&$general, $withInjury, $withItem, $withStatAdjust, $useFloor = true){
+function getGeneralPower($general, $withInjury, $withItem, $withStatAdjust, $useFloor = true){
if($general === null){
return 0;
}
@@ -91,7 +91,7 @@ function getGeneralPower(&$general, $withInjury, $withItem, $withStatAdjust, $us
*
* @return int|float 계산된 능력치
*/
-function getGeneralIntel(&$general, $withInjury, $withItem, $withStatAdjust, $useFloor = true){
+function getGeneralIntel($general, $withInjury, $withItem, $withStatAdjust, $useFloor = true){
if($general === null){
return 0;
}
@@ -193,7 +193,7 @@ function CriticalScore($score, $type) {
return Util::round($score * $ratio);
}
-function process_1(array $general, int $type){
+function process_1(array $rawGeneral, int $type){
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
@@ -212,11 +212,12 @@ function process_1(array $general, int $type){
[$startYear, $year, $month, $develCost] = $gameStor->getValuesAsArray(['startyear', 'year', 'month', 'develcost']);
- $city = $db->queryFirstRow('SELECT * FROM city WHERE city = %i', $general['city']);
- $nation = getNationStaticInfo($general['nation']);
- $lbonus = setLeadershipBonus($general, $nation['level']);
+ $general = new General($rawGeneral, $yera, $month);
+ $logger = $general->getLogger();
- $logger = new ActionLogger($general['id'], $general['nation'], $year, $month);
+
+
+ $city = $db->queryFirstRow('SELECT * FROM city WHERE city = %i', $general->getCityID());
$constraints = [
['NoNeutral'],
@@ -226,10 +227,10 @@ function process_1(array $general, int $type){
['ReqGeneralGold', $reqGold],
['RemainCityCapacity', [$cityKey, $actionName]]
];
- $failReason =Constraint::testAll($constraints, [
- 'nation'=>$nation,
+ $failReason = Constraint::testAll($constraints, [
+ 'nation'=>$general->getStaticNation(),
'city'=>$city,
- 'general'=>$general,
+ 'general'=>$general->getRaw(),
]);
if($failReason !== null){
@@ -237,6 +238,13 @@ function process_1(array $general, int $type){
return;
}
+ $trust = Util::valutFit($city['trust'], 50);
+
+ $score = getGeneralIntel($general, true, true, true, false);
+ $score *= $trust / 100;
+ $score *= getDomesticExpLevelBonus($general['explevel']);
+ $score *= Util::randRange(0.8, 1.2);
+
}
function process_1_old(&$general, $type) {
diff --git a/hwe/sammo/Constraint/Constraint.php b/hwe/sammo/Constraint/Constraint.php
index 09b1aac2..1383bef4 100644
--- a/hwe/sammo/Constraint/Constraint.php
+++ b/hwe/sammo/Constraint/Constraint.php
@@ -172,8 +172,8 @@ abstract class Constraint{
return $this->reason;
}
- public static function testAll(array $contraintPacks, array $input):?string{
- foreach($contraintPacks as $constraintArgs){
+ public static function testAll(array $constraintPacks, array $input):?string{
+ foreach($constraintPacks as $constraintArgs){
if (!$constraintArgs){
continue;
}
diff --git a/hwe/sammo/DefaultActionTrigger.php b/hwe/sammo/DefaultActionTrigger.php
index f05513ad..a64dcea8 100644
--- a/hwe/sammo/DefaultActionTrigger.php
+++ b/hwe/sammo/DefaultActionTrigger.php
@@ -5,7 +5,7 @@ trait DefaultActionTrigger{
public function onPreTurnExecute(General $general, ?array $nation):array{
return [];
}
- public function onCalcDomesticTurnScore(General $general, string $turnType, float $score, float $cost, float $successRate, float $failRate){
+ public function onCalcDomesticTurnScore(General $general, string $turnType, float $score, float $cost, float $successRate, float $failRate):array{
return [$score, $cost, $successRate, $failRate];
}
diff --git a/hwe/sammo/GameConstBase.php b/hwe/sammo/GameConstBase.php
index ade62feb..270cbe46 100644
--- a/hwe/sammo/GameConstBase.php
+++ b/hwe/sammo/GameConstBase.php
@@ -93,4 +93,10 @@ class GameConstBase
/** @var int 초반 제한 기간 */
public static $openingPartYear = 3;
+
+ /** @var array 선택 가능한 국가 성향 */
+ public static $availableNationType = [
+ 'che_명가', 'che_음양가', 'che_종횡가', 'che_불가', 'che_도적', 'che_오두미도', 'che_태평도', 'che_도가',
+ 'che_묵가', 'che_덕가', 'che_병가', 'che_유가', 'che_법가'
+ ];
}
diff --git a/hwe/sammo/General.php b/hwe/sammo/General.php
index ac73b46d..abbbdd55 100644
--- a/hwe/sammo/General.php
+++ b/hwe/sammo/General.php
@@ -50,6 +50,22 @@ class General{
return $this->logActivatedSkill;
}
+ function hasActivatedSkill(string $skillName):bool{
+ return $this->activatedSkill[$skillName] ?? false;
+ }
+
+ function activateSkill(... $skillNames){
+ foreach($skillNames as $skillName){
+ $this->activatedSkill[$skillName] = true;
+ }
+ }
+
+ function deactivateSkill(... $skillNames){
+ foreach($skillNames as $skillName){
+ $this->activatedSkill[$skillName] = false;
+ }
+ }
+
function getName():string{
return $this->raw['name'];
}
@@ -70,6 +86,19 @@ class General{
return $this->logger;
}
+ //TODO: 장기적으로 General 클래스로 모두 옮겨와야함.
+ function getLeadership($withInjury = true, $withItem = true, $withStatAdjust = true, $useFloor = true):float{
+ return getGeneralLeadership($this->raw, $withInjury, $withItem, $withStatAdjust, $useFloor);
+ }
+
+ function getPower($withInjury = true, $withItem = true, $withStatAdjust = true, $useFloor = true):float{
+ return getGeneralPower($this->raw, $withInjury, $withItem, $withStatAdjust, $useFloor);
+ }
+
+ function getIntel($withInjury = true, $withItem = true, $withStatAdjust = true, $useFloor = true):float{
+ return getGeneralIntel($this->raw, $withInjury, $withItem, $withStatAdjust, $useFloor);
+ }
+
/**
* @param \MeekroDB $db
diff --git a/hwe/sammo/NationType/che_유가.php b/hwe/sammo/NationType/che_유가.php
new file mode 100644
index 00000000..fffaa06f
--- /dev/null
+++ b/hwe/sammo/NationType/che_유가.php
@@ -0,0 +1,22 @@
+