From d3225dfb41c9ddc93842a7c1ea8bb824f6b82df3 Mon Sep 17 00:00:00 2001 From: hide_d Date: Tue, 17 Apr 2018 01:53:32 +0900 Subject: [PATCH] =?UTF-8?q?=EB=B2=84=EA=B7=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/func_process.php | 20 ++++++++++---------- hwe/func_process_chief.php | 18 +++++++++--------- hwe/func_process_personnel.php | 5 ++++- hwe/func_process_sabotage.php | 24 ++++++++++++------------ 4 files changed, 35 insertions(+), 32 deletions(-) diff --git a/hwe/func_process.php b/hwe/func_process.php index 354e3e7d..2db914c5 100644 --- a/hwe/func_process.php +++ b/hwe/func_process.php @@ -521,7 +521,7 @@ function process_5(&$general, $type) { // 태수 보정 if($general['level'] == 4 && $general['no'] == $city['gen1']) { $score *= 1.05; } - $rd = randF(); + $rd = Util::randF(); $r = CriticalRatioDomestic($general, 1); // 특기보정 : 수비, 축성 if($type == 1 && $general['special'] == 11) { $r['succ'] += 0.1; $score *= 1.1; $admin['develcost'] *= 0.8; } @@ -1006,7 +1006,7 @@ function process_11(&$general, $type) { $exp = $crew; $ded = $crew; // 숙련도 증가 - addGenDex($general['no'], GameConst::$maxatmos, GameConst::$maxtrain, $armtype, $crew); + addGenDex($general['no'], GameConst::$maxAtmosByCommand, GameConst::$maxTrainByCommand, $armtype, $crew); // 성격 보정 $exp = CharExperience($exp, $general['personal']); $ded = CharDedication($ded, $general['personal']); @@ -1075,7 +1075,7 @@ function process_13(&$general) { $exp = 100; $ded = 70; // 숙련도 증가 - addGenDex($general['no'], GameConst::$maxatmos, GameConst::$maxtrain, $general['crewtype'], Util::round($general['crew']/100)); + addGenDex($general['no'], GameConst::$maxAtmosByCommand, GameConst::$maxTrainByCommand, $general['crewtype'], Util::round($general['crew']/100)); // 성격 보정 $exp = CharExperience($exp, $general['personal']); $ded = CharDedication($ded, $general['personal']); @@ -1139,14 +1139,14 @@ function process_14(&$general) { // } elseif(intdiv($general['crewtype'], 10) == 4) { // $log[] = "●{$admin['month']}월:병기는 사기 진작이 불가능합니다. <1>$date"; } else { - $score = Util::round(getGeneralLeadership($general, true, true, true)*100 / $general['crew'] * GameConst::$trainAtmos); + $score = Util::round(getGeneralLeadership($general, true, true, true)*100 / $general['crew'] * GameConst::$atmosDelta); $gold = $general['gold'] - Util::round($general['crew']/100); $log[] = "●{$admin['month']}월:사기치가 $score 상승했습니다. <1>$date"; $exp = 100; $ded = 70; // 숙련도 증가 - addGenDex($general['no'], GameConst::$maxatmos, GameConst::$maxtrain, $general['crewtype'], Util::round($general['crew']/100)); + addGenDex($general['no'], GameConst::$maxAtmosByCommand, GameConst::$maxTrainByCommand, $general['crewtype'], Util::round($general['crew']/100)); // 성격 보정 $exp = CharExperience($exp, $general['personal']); $ded = CharDedication($ded, $general['personal']); @@ -1221,7 +1221,7 @@ function process_15(&$general) { $exp = 100 * 3; $ded = 70 * 3; // 숙련도 증가 - addGenDex($general['no'], GameConst::$maxatmos, GameConst::$maxtrain, $general['crewtype'], Util::round($general['crew']/100 * 3)); + addGenDex($general['no'], GameConst::$maxAtmosByCommand, GameConst::$maxTrainByCommand, $general['crewtype'], Util::round($general['crew']/100 * 3)); // 성격 보정 $exp = CharExperience($exp, $general['personal']); $ded = CharDedication($ded, $general['personal']); @@ -1309,7 +1309,7 @@ function process_16(&$general) { $query = "update city set state=43,term=3 where city='{$destcity['city']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); // 숙련도 증가 - addGenDex($general['no'], GameConst::$maxatmos, GameConst::$maxtrain, $general['crewtype'], Util::round($general['crew']/100)); + addGenDex($general['no'], GameConst::$maxAtmosByCommand, GameConst::$maxTrainByCommand, $general['crewtype'], Util::round($general['crew']/100)); // 전투 처리 $dead = processWar($general, $destcity); @@ -1814,17 +1814,17 @@ function process_41(&$general) { if($ratio < 33) { // 숙련도 증가 - addGenDex($general['no'], GameConst::$maxatmos, GameConst::$maxtrain, $general['crewtype'], $crewexp); + addGenDex($general['no'], GameConst::$maxAtmosByCommand, GameConst::$maxTrainByCommand, $general['crewtype'], $crewexp); $log[] = "●{$admin['month']}월:$crewstr 숙련도 향상이 지지부진했습니다. <1>$date"; } elseif($ratio < 66) { $exp = $exp * 2; // 숙련도 증가 - addGenDex($general['no'], GameConst::$maxatmos, GameConst::$maxtrain, $general['crewtype'], $crewexp * 2); + addGenDex($general['no'], GameConst::$maxAtmosByCommand, GameConst::$maxTrainByCommand, $general['crewtype'], $crewexp * 2); $log[] = "●{$admin['month']}월:$crewstr 숙련도가 향상되었습니다. <1>$date"; } else { $exp = $exp * 3; // 숙련도 증가 - addGenDex($general['no'], GameConst::$maxatmos, GameConst::$maxtrain, $general['crewtype'], $crewexp * 3); + addGenDex($general['no'], GameConst::$maxAtmosByCommand, GameConst::$maxTrainByCommand, $general['crewtype'], $crewexp * 3); $log[] = "●{$admin['month']}월:$crewstr 숙련도가 일취월장했습니다. <1>$date"; } diff --git a/hwe/func_process_chief.php b/hwe/func_process_chief.php index 9651f820..a1349db4 100644 --- a/hwe/func_process_chief.php +++ b/hwe/func_process_chief.php @@ -353,7 +353,7 @@ function process_51(&$general) { $now = new \DateTime($date); $validUntil = new \DateTime($date); $validMinutes = max(30, $turnterm*3); - $validUntil->add(new \DateTimeInterval("PT{$validMinutes}M")); + $validUntil->add(new \DateInterval("PT{$validMinutes}M")); $msg = new DiplomaticMessage( Message::MSGTYPE_DIPLOMACY, @@ -548,7 +548,7 @@ function process_53(&$general) { $now = new \DateTime($date); $validUntil = new \DateTime($date); $validMinutes = max(30, $turnterm*3); - $validUntil->add(new \DateTimeInterval("PT{$validMinutes}M")); + $validUntil->add(new \DateInterval("PT{$validMinutes}M")); $msg = new DiplomaticMessage( Message::MSGTYPE_DIPLOMACY, @@ -557,7 +557,7 @@ function process_53(&$general) { "{$srcNation['name']}의 통합 제의 서신", $now, $validUntil, - ['action'=>DiplomaticMessage::TYPE_SURRENDER] + ['action'=>DiplomaticMessage::TYPE_MERGE] ); $msg->send(); @@ -633,7 +633,7 @@ function process_61(&$general) { $now = new \DateTime($date); $validUntil = new \DateTime($date); $validMinutes = max(30, $turnterm*3); - $validUntil->add(new \DateTimeInterval("PT{$validMinutes}M")); + $validUntil->add(new \DateInterval("PT{$validMinutes}M")); //FIXME: 현재 command가 숫자로만 이루어져 있어서 문자열을 처리할 수 없다. //XXX: 으악. @@ -648,7 +648,7 @@ function process_61(&$general) { $now, $validUntil, [ - 'action'=>DiplomaticMessage::TYPE_SURRENDER, + 'action'=>DiplomaticMessage::TYPE_NO_AGGRESSION, 'year'=>$when, 'option'=>$option ] @@ -830,7 +830,7 @@ function process_63(&$general) { $now = new \DateTime($date); $validUntil = new \DateTime($date); $validMinutes = max(30, $turnterm*3); - $validUntil->add(new \DateTimeInterval("PT{$validMinutes}M")); + $validUntil->add(new \DateInterval("PT{$validMinutes}M")); $msg = new DiplomaticMessage( Message::MSGTYPE_DIPLOMACY, @@ -839,7 +839,7 @@ function process_63(&$general) { "{$srcNation['name']}의 종전 제의 서신", $now, $validUntil, - ['action'=>DiplomaticMessage::TYPE_SURRENDER] + ['action'=>DiplomaticMessage::TYPE_STOP_WAR] ); $msg->send(); @@ -913,7 +913,7 @@ function process_64(&$general) { $now = new \DateTime($date); $validUntil = new \DateTime($date); $validMinutes = max(30, $turnterm*3); - $validUntil->add(new \DateTimeInterval("PT{$validMinutes}M")); + $validUntil->add(new \DateInterval("PT{$validMinutes}M")); $msg = new DiplomaticMessage( Message::MSGTYPE_DIPLOMACY, @@ -922,7 +922,7 @@ function process_64(&$general) { "{$srcNation['name']}의 불가침 파기 제의 서신", $now, $validUntil, - ['action'=>DiplomaticMessage::TYPE_SURRENDER] + ['action'=>DiplomaticMessage::TYPE_CANCEL_NA] ); $msg->send(); diff --git a/hwe/func_process_personnel.php b/hwe/func_process_personnel.php index 0c80c62c..1dcfdddb 100644 --- a/hwe/func_process_personnel.php +++ b/hwe/func_process_personnel.php @@ -46,6 +46,9 @@ function process_22(&$general) { $exp = CharExperience($exp, $general['personal']); $ded = CharDedication($ded, $general['personal']); + $msg = ScoutMessage::buildScoutMessage($general['no'], $who, $reason); + +/* sendScoutMsg([ 'id' => $general['no'], 'nation_id' => Util::array_get($general['nation'], 0) @@ -53,7 +56,7 @@ function process_22(&$general) { 'id' => $you['no'], 'nation_id' => Util::array_get($you['nation'], 0) ],$date); - + */ $general['intel2']++; $query = "update general set resturn='SUCCESS',gold=gold-'$cost',intel2='{$general['intel2']}',dedication=dedication+'$ded',experience=experience+'$exp' where no='{$general['no']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); diff --git a/hwe/func_process_sabotage.php b/hwe/func_process_sabotage.php index d57b5f55..62c17808 100644 --- a/hwe/func_process_sabotage.php +++ b/hwe/func_process_sabotage.php @@ -57,7 +57,7 @@ function process_32(&$general) { $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $intelgen = MYDB_fetch_array($result); - $ratio = Util::round(((getGeneralIntel($general, true, true, true, false) - getGeneralIntel($intelgen, true, true, true, false)) / GameConst::$sabotageProbCoefByStat - ($destcity['secu']/$destcity['secu2'])/5 + GameConst::$defaultSabotageProb)*100); + $ratio = Util::round(((getGeneralIntel($general, true, true, true, false) - getGeneralIntel($intelgen, true, true, true, false)) / GameConst::$sabotageProbCoefByStat - ($destcity['secu']/$destcity['secu2'])/5 + GameConst::$sabotageDefaultProb)*100); $ratio2 = rand() % 100; if($general['item'] == 5) { @@ -93,8 +93,8 @@ function process_32(&$general) { $alllog[] = "●{$admin['month']}월:{$destcity['name']}(이)가 불타고 있습니다."; $log[] = "●{$admin['month']}월:{$destcity['name']}에 화계가 성공했습니다. <1>$date"; - $destcity['agri'] -= rand() % GameConst::$sabotageAmountCoef + GameConst::$defaultSabotageAmount; - $destcity['comm'] -= rand() % GameConst::$sabotageAmountCoef + GameConst::$defaultSabotageAmount; + $destcity['agri'] -= rand() % GameConst::$sabotageAmountCoef + GameConst::$sabotageDefaultAmount; + $destcity['comm'] -= rand() % GameConst::$sabotageAmountCoef + GameConst::$sabotageDefaultAmount; if($destcity['agri'] < 0) { $destcity['agri'] = 0; } if($destcity['comm'] < 0) { $destcity['comm'] = 0; } $query = "update city set state=32,agri='{$destcity['agri']}',comm='{$destcity['comm']}' where city='$destination'"; @@ -187,7 +187,7 @@ function process_33(&$general) { $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $powergen = MYDB_fetch_array($result); - $ratio = Util::round(((getGeneralPower($general, true, true, true, false) - getGeneralPower($powergen, true, true, true, false)) / GameConst::$sabotageProbCoefByStat - ($destcity['secu']/$destcity['secu2'])/5 + GameConst::$defaultSabotageProb)*100); + $ratio = Util::round(((getGeneralPower($general, true, true, true, false) - getGeneralPower($powergen, true, true, true, false)) / GameConst::$sabotageProbCoefByStat - ($destcity['secu']/$destcity['secu2'])/5 + GameConst::$sabotageDefaultProb)*100); $ratio2 = rand() % 100; if($general['item'] == 5) { @@ -224,8 +224,8 @@ function process_33(&$general) { $log[] = "●{$admin['month']}월:{$destcity['name']}에 탈취가 성공했습니다. <1>$date"; // 탈취 최대 400 * 8 - $gold = (rand() % GameConst::$sabotageAmountCoef + GameConst::$defaultSabotageAmount) * $destcity['level']; - $rice = (rand() % GameConst::$sabotageAmountCoef + GameConst::$defaultSabotageAmount) * $destcity['level']; + $gold = (rand() % GameConst::$sabotageAmountCoef + GameConst::$sabotageDefaultAmount) * $destcity['level']; + $rice = (rand() % GameConst::$sabotageAmountCoef + GameConst::$sabotageDefaultAmount) * $destcity['level']; $nation['gold'] -= $gold; $nation['rice'] -= $rice; @@ -334,7 +334,7 @@ function process_34(&$general) { $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $powergen = MYDB_fetch_array($result); - $ratio = Util::round(((getGeneralPower($general, true, true, true, false) - getGeneralPower($powergen, true, true, true, false)) / GameConst::$sabotageProbCoefByStat - ($destcity['secu']/$destcity['secu2'])/5 + GameConst::$defaultSabotageProb)*100); + $ratio = Util::round(((getGeneralPower($general, true, true, true, false) - getGeneralPower($powergen, true, true, true, false)) / GameConst::$sabotageProbCoefByStat - ($destcity['secu']/$destcity['secu2'])/5 + GameConst::$sabotageDefaultProb)*100); $ratio2 = rand() % 100; if($general['item'] == 5) { @@ -371,8 +371,8 @@ function process_34(&$general) { $log[] = "●{$admin['month']}월:{$destcity['name']}에 파괴가 성공했습니다. <1>$date"; // 파괴 - $destcity['def'] -= rand() % GameConst::$sabotageAmountCoef + GameConst::$defaultSabotageAmount; - $destcity['wall'] -= rand() % GameConst::$sabotageAmountCoef + GameConst::$defaultSabotageAmount; + $destcity['def'] -= rand() % GameConst::$sabotageAmountCoef + GameConst::$sabotageDefaultAmount; + $destcity['wall'] -= rand() % GameConst::$sabotageAmountCoef + GameConst::$sabotageDefaultAmount; if($destcity['def'] < 100) { $destcity['def'] = 100; } if($destcity['wall'] < 100) { $destcity['wall'] = 100; } $query = "update city set state=34,def='{$destcity['def']}',wall='{$destcity['wall']}' where city='$destination'"; @@ -462,7 +462,7 @@ function process_35(&$general) { $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $gen = MYDB_fetch_array($result); - $ratio = Util::round(((getGeneralLeadership($general, true, true, true) - getGeneralLeadership($gen, true, true, true)) / GameConst::$sabotageProbCoefByStat - ($destcity['secu']/$destcity['secu2'])/5 + GameConst::$defaultSabotageProb)*100); + $ratio = Util::round(((getGeneralLeadership($general, true, true, true) - getGeneralLeadership($gen, true, true, true)) / GameConst::$sabotageProbCoefByStat - ($destcity['secu']/$destcity['secu2'])/5 + GameConst::$sabotageDefaultProb)*100); $ratio2 = rand() % 100; if($general['item'] == 5) { @@ -499,8 +499,8 @@ function process_35(&$general) { $log[] = "●{$admin['month']}월:{$destcity['name']}에 선동이 성공했습니다. <1>$date"; // 선동 최대 10 - $destcity['secu'] -= rand() % Util::round(GameConst::$sabotageAmountCoef/2) + GameConst::$defaultSabotageAmount; - $destcity['rate'] -= rand() % Util::round(GameConst::$sabotageAmountCoef/50) + GameConst::$defaultSabotageAmount/50; + $destcity['secu'] -= rand() % Util::round(GameConst::$sabotageAmountCoef/2) + GameConst::$sabotageDefaultAmount; + $destcity['rate'] -= rand() % Util::round(GameConst::$sabotageAmountCoef/50) + GameConst::$sabotageDefaultAmount/50; if($destcity['secu'] < 0) { $destcity['secu'] = 0; } if($destcity['rate'] < 0) { $destcity['rate'] = 0; } $query = "update city set state=32,rate='{$destcity['rate']}',secu='{$destcity['secu']}' where city='$destination'";