From 921ba6811d0b4587fc30d35cce615c946e57f409 Mon Sep 17 00:00:00 2001 From: hide_d Date: Thu, 23 Sep 2021 03:59:08 +0900 Subject: [PATCH] =?UTF-8?q?balance:=20=EB=AC=B4=EC=8C=8D=20=EB=84=88?= =?UTF-8?q?=ED=94=84,=20NPC=20=EC=B6=9C=EB=B3=91=20=EA=B8=88=EC=A7=80=20?= =?UTF-8?q?=EB=B6=88=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/j_set_npc_control.php | 126 ++++++++++--------- hwe/sammo/ActionItem/event_전투특기_무쌍.php | 6 +- hwe/sammo/ActionSpecialWar/che_무쌍.php | 6 +- 3 files changed, 75 insertions(+), 63 deletions(-) diff --git a/hwe/j_set_npc_control.php b/hwe/j_set_npc_control.php index f29c8f42..b991ed67 100644 --- a/hwe/j_set_npc_control.php +++ b/hwe/j_set_npc_control.php @@ -1,4 +1,5 @@ false, - 'reason'=>'올바른 타입이 아닙니다.', + 'result' => false, + 'reason' => '올바른 타입이 아닙니다.', ]); } $data = Json::decode($data); -if(!$data || !is_array($data)){ +if (!$data || !is_array($data)) { Json::die([ - 'result'=>false, - 'reason'=>'올바른 입력이 아닙니다.', + 'result' => false, + 'reason' => '올바른 입력이 아닙니다.', ]); } @@ -44,94 +45,95 @@ $me = $db->queryFirstRow('SELECT no, name, npc, nation, city, officer_level, con $nationID = $me['nation']; if (!$nationID) { Json::die([ - 'result'=>false, - 'reason'=>'국가에 소속되어있지 않습니다.', + 'result' => false, + 'reason' => '국가에 소속되어있지 않습니다.', ]); } $permission = checkSecretPermission($me); if ($permission < 3) { Json::die([ - 'result'=>false, - 'reason'=>'권한이 부족합니다. 군주, 외교권자, 조언자가 아닙니다.' + 'result' => false, + 'reason' => '권한이 부족합니다. 군주, 외교권자, 조언자가 아닙니다.' ]); } -function applyNationPolicy($policy, $nationID, $generalName):?string{ +function applyNationPolicy($policy, $nationID, $generalName): ?string +{ $db = DB::db(); $nationStor = KVStorage::getStorage($db, $nationID, 'nation_env'); $defaultPolicy = AutorunNationPolicy::$defaultPolicy; $troopCache = null; - foreach($db->queryFirstColumn('SELECT troop_leader FROM troop WHERE nation=%i',$nationID) as $troopID){ + foreach ($db->queryFirstColumn('SELECT troop_leader FROM troop WHERE nation=%i', $nationID) as $troopID) { $troopCache[$troopID] = 'Neutral'; } $cityList = CityConst::all(); $nationPolicyRoot = $nationStor->npc_nation_policy; - $nationPolicy = $nationPolicyRoot['values']??[]; - foreach($policy as $key=>$val){ + $nationPolicy = $nationPolicyRoot['values'] ?? []; + foreach ($policy as $key => $val) { - if($key === 'CombatForce'){ - if(!is_array($val)){ - return "{$key}는 올바른 정책값이 아닙니다."; + if ($key === 'CombatForce') { + if (!is_array($val)) { + return "{$key}는 올바른 정책값이 아닙니다."; } - foreach($val as $troopID=>$troopTarget){ - if(!key_exists($troopID, $troopCache)){ + foreach ($val as $troopID => $troopTarget) { + if (!key_exists($troopID, $troopCache)) { return "{$troopID}는 국가의 부대가 아닙니다."; } - if($troopCache[$troopID] != 'Neutral'){ + if ($troopCache[$troopID] != 'Neutral') { return "부대({$troopID}는 하나의 역할만 지정할 수 있습니다."; } - if(!is_array($troopTarget) || count($troopTarget)!=2){ + if (!is_array($troopTarget) || count($troopTarget) != 2) { return "{$troopID}의 입력양식이 올바르지 않습니다."; } [$fromCity, $toCity] = $troopCache; - if(!key_exists($fromCity, $cityList) || !key_exists($toCity, $cityList)){ + if (!key_exists($fromCity, $cityList) || !key_exists($toCity, $cityList)) { return "{$troopID}의 도시 {$fromCity}, {$toCity}가 올바른 도시 번호가 아닙니다."; } - $troopCache[$troopID]=$key; + $troopCache[$troopID] = $key; } - $nationPolicy[$key]=$val; + $nationPolicy[$key] = $val; continue; } - if(in_array($key, ['SupportForce', 'DevelopForce'])){ - if(!is_array($val)){ - return "{$key}는 올바른 정책값이 아닙니다."; + if (in_array($key, ['SupportForce', 'DevelopForce'])) { + if (!is_array($val)) { + return "{$key}는 올바른 정책값이 아닙니다."; } - foreach($val as $troopID){ - if(!key_exists($troopID, $troopCache)){ + foreach ($val as $troopID) { + if (!key_exists($troopID, $troopCache)) { return "{$troopID}는 국가의 부대가 아닙니다."; } - if($troopCache[$troopID] != 'Neutral'){ + if ($troopCache[$troopID] != 'Neutral') { return "부대({$troopID}는 하나의 역할만 지정할 수 있습니다."; } - $troopCache[$troopID]=$key; + $troopCache[$troopID] = $key; } - $nationPolicy[$key]=array_values($val); + $nationPolicy[$key] = array_values($val); continue; } - if(!key_exists($key, $defaultPolicy)){ + if (!key_exists($key, $defaultPolicy)) { return "{$key}는 올바른 정책값이 아닙니다."; } $defaultValue = $defaultPolicy[$key]; - if(is_numeric($defaultValue) != is_numeric($val)){ + if (is_numeric($defaultValue) != is_numeric($val)) { return "{$key}는 올바른 값이 아닙니다."; } - if(is_integer($defaultValue) != is_integer($val)){ + if (is_integer($defaultValue) != is_integer($val)) { return "{$key}는 올바른 값이 아닙니다."; } - if(is_array($defaultValue) != is_array($val)){ + if (is_array($defaultValue) != is_array($val)) { return "{$key}는 올바른 값이 아닙니다."; } - if(is_integer($val) && $val < 0){ + if (is_integer($val) && $val < 0) { $val = 0; } $nationPolicy[$key] = $val; } - + $nationPolicyRoot['values'] = $nationPolicy; $nationPolicyRoot['valueSetter'] = $generalName; $nationPolicyRoot['valueSetTime'] = TimeUtil::now(); @@ -139,14 +141,15 @@ function applyNationPolicy($policy, $nationID, $generalName):?string{ return null; } -function applyNationPriority($priority, $nationID, $generalName):?string{ +function applyNationPriority($priority, $nationID, $generalName): ?string +{ $db = DB::db(); $nationStor = KVStorage::getStorage($db, $nationID, 'nation_env'); $nationPolicyRoot = $nationStor->npc_nation_policy; $defaultPriority = AutorunNationPolicy::$defaultPriority; - foreach($priority as $item){ - if(!in_array($item, $defaultPriority)){ + foreach ($priority as $item) { + if (!in_array($item, $defaultPriority)) { return "{$item}은 올바른 명령이 아닙니다."; } } @@ -157,17 +160,29 @@ function applyNationPriority($priority, $nationID, $generalName):?string{ return null; } -function applyGeneralPriority($priority, $nationID, $generalName):?string{ +function applyGeneralPriority($priority, $nationID, $generalName): ?string +{ $db = DB::db(); $nationStor = KVStorage::getStorage($db, $nationID, 'nation_env'); $generalPolicyRoot = $nationStor->npc_general_policy; $defaultPriority = AutorunGeneralPolicy::$default_priority; - foreach($priority as $item){ - if(!in_array($item, $defaultPriority)){ + $mustHaveActions = ['출병' => 1]; + foreach ($priority as $item) { + if (key_exists($item, $mustHaveActions)) { + $mustHaveActions[$item] = 0; + } + if (!in_array($item, $defaultPriority)) { return "{$item}은 올바른 명령이 아닙니다."; } } + + foreach ($mustHaveActions as $actionKey => $unset) { + if ($unset) { + return "{$actionKey}은 항상 사용해야 합니다."; + } + } + $generalPolicyRoot['priority'] = $priority; $generalPolicyRoot['prioritySetter'] = $generalName; $generalPolicyRoot['prioritySetTime'] = TimeUtil::now(); @@ -175,26 +190,23 @@ function applyGeneralPriority($priority, $nationID, $generalName):?string{ return null; } -if($type == 'nationPolicy'){ +if ($type == 'nationPolicy') { $result = applyNationPolicy($data, $nationID, $me['name']); -} -else if($type == 'generalPriority'){ +} else if ($type == 'generalPriority') { $result = applyGeneralPriority($data, $nationID, $me['name']); -} -else if($type == 'nationPriority'){ +} else if ($type == 'nationPriority') { $result = applyNationPriority($data, $nationID, $me['name']); -} -else{ +} else { throw new MustNotBeReachedException(); } -if($result!==null){ +if ($result !== null) { Json::die([ - 'result'=>false, - 'reason'=>$result, + 'result' => false, + 'reason' => $result, ]); } Json::die([ - 'result'=>true, - 'reason'=>'success', -]); \ No newline at end of file + 'result' => true, + 'reason' => 'success', +]); diff --git a/hwe/sammo/ActionItem/event_전투특기_무쌍.php b/hwe/sammo/ActionItem/event_전투특기_무쌍.php index bec8518a..9800db26 100644 --- a/hwe/sammo/ActionItem/event_전투특기_무쌍.php +++ b/hwe/sammo/ActionItem/event_전투특기_무쌍.php @@ -11,7 +11,7 @@ class event_전투특기_무쌍 extends \sammo\BaseItem{ protected $id = 61; protected $rawName = '비급'; protected $name = '비급(무쌍)'; - protected $info = '[전투] 대미지 +10%, 피해 -5%, 공격 시 필살 확률 +10%p,
승리 수만큼 대미지 0.20%씩 추가 상승(최대40%)
승리 수만큼 피해 0.05%씩 감소(최대30%)'; + protected $info = '[전투] 대미지 +10%, 피해 -5%, 공격 시 필살 확률 +10%p,
승리 수만큼 대미지 0.20%씩 추가 상승(최대50%)
승리 수만큼 피해 0.05%씩 감소(최대20%)'; protected $cost = 100; protected $buyable = true; protected $consumable = false; @@ -28,8 +28,8 @@ class event_전투특기_무쌍 extends \sammo\BaseItem{ $attackMultiplier = 1.1; $defenceMultiplier = 0.95; $killnum = $unit->getGeneral()->getRankVar('killnum'); - $attackMultiplier += Util::valueFit($killnum * 0.01 * 0.2, null, 0.4); - $defenceMultiplier -= Util::valueFit($killnum * 0.01 * 0.05, null, 0.3); + $attackMultiplier += Util::valueFit($killnum * 0.01 * 0.2, null, 0.5); + $defenceMultiplier -= Util::valueFit($killnum * 0.01 * 0.05, null, 0.2); return [$attackMultiplier, $defenceMultiplier]; } } \ No newline at end of file diff --git a/hwe/sammo/ActionSpecialWar/che_무쌍.php b/hwe/sammo/ActionSpecialWar/che_무쌍.php index fe48e104..4cb14c59 100644 --- a/hwe/sammo/ActionSpecialWar/che_무쌍.php +++ b/hwe/sammo/ActionSpecialWar/che_무쌍.php @@ -10,7 +10,7 @@ class che_무쌍 extends \sammo\BaseSpecial{ protected $id = 61; protected $name = '무쌍'; - protected $info = '[전투] 대미지 +10%, 피해 -5%, 공격 시 필살 확률 +10%p,
승리 수만큼 대미지 0.20%씩 추가 상승(최대40%)
승리 수만큼 피해 0.05%씩 감소(최대30%)'; + protected $info = '[전투] 대미지 +10%, 피해 -5%, 공격 시 필살 확률 +10%p,
승리 수만큼 대미지 0.20%씩 추가 상승(최대50%)
승리 수만큼 피해 0.05%씩 감소(최대20%)'; static $selectWeightType = SpecialityHelper::WEIGHT_NORM; static $selectWeight = 1; @@ -29,8 +29,8 @@ class che_무쌍 extends \sammo\BaseSpecial{ $attackMultiplier = 1.1; $defenceMultiplier = 0.95; $killnum = $unit->getGeneral()->getRankVar('killnum'); - $attackMultiplier += Util::valueFit($killnum * 0.01 * 0.2, null, 0.4); - $defenceMultiplier -= Util::valueFit($killnum * 0.01 * 0.05, null, 0.3); + $attackMultiplier += Util::valueFit($killnum * 0.01 * 0.2, null, 0.5); + $defenceMultiplier -= Util::valueFit($killnum * 0.01 * 0.05, null, 0.2); return [$attackMultiplier, $defenceMultiplier]; } } \ No newline at end of file