diff --git a/hwe/_simul.php b/hwe/_simul.php index a32ac7aa..66e07838 100644 --- a/hwe/_simul.php +++ b/hwe/_simul.php @@ -194,8 +194,8 @@ if($isgen == "장수공격" || $isgen == "성벽공격" || $isgen == "장수평 $mykillnum = 0; $mydeathnum = 0; while($phase < $warphase) { $phase++; - $myAtt = getAtt($game, $general, $tech1, 0); - $myDef = getDef($game, $general, $tech1); + $myAtt = getAtt($general, $tech1, 0); + $myDef = getDef($general, $tech1); $cityAtt = getCityAtt($city); $cityDef = getCityDef($city); @@ -355,7 +355,7 @@ if($isgen == "장수공격" || $isgen == "성벽공격" || $isgen == "장수평 // 도시쌀 소모 계산 $opexp = Util::round($opexp / 50); - $rice = Util::round($opexp * 4 * getCrewtypeRice($game, 0, 0) * ($train3/100 - 0.2)); + $rice = Util::round($opexp * 4 * getCrewtypeRice(0, 0) * ($train3/100 - 0.2)); //원래대로 스케일링 $city['def'] = Util::round($city['def'] / 10); @@ -385,10 +385,10 @@ if($isgen == "장수공격" || $isgen == "성벽공격" || $isgen == "장수평 while($phase < $warphase) { $phase++; - $myAtt = getAtt($game, $general, $tech1, 0); - $myDef = getDef($game, $general, $tech1); - $opAtt = getAtt($game, $oppose, $tech2, 0); - $opDef = getDef($game, $oppose, $tech2); + $myAtt = getAtt($general, $tech1, 0); + $myDef = getDef($general, $tech1); + $opAtt = getAtt($oppose, $tech2, 0); + $opDef = getDef($oppose, $tech2); // 감소할 병사 수 $myCrew = GameConst::$armperphase + $opAtt - $myDef; $opCrew = GameConst::$armperphase + $myAtt - $opDef; @@ -747,9 +747,9 @@ if($isgen == "장수공격" || $isgen == "성벽공격" || $isgen == "장수평 // 공헌, 명성 상승 $exp = Util::round($exp / 50); - $ricing = ($exp * 5 * getCrewtypeRice($game, $general['crewtype'], $tech1)); - $msg .= "★ 【공격장수】공헌 상승 : $exp 쌀 소비 : {$exp}x5x".getCrewtypeRice($game, $general['crewtype'], $tech1)." = $ricing
"; -// $msg2 .= "★ 【공격장수】공헌 상승 : $exp 쌀 소비 : {$exp}x5x".getCrewtypeRice($game, $general['crewtype'], $tech1)." = $ricing
"; + $ricing = ($exp * 5 * getCrewtypeRice($general['crewtype'], $tech1)); + $msg .= "★ 【공격장수】공헌 상승 : $exp 쌀 소비 : {$exp}x5x".getCrewtypeRice($general['crewtype'], $tech1)." = $ricing
"; +// $msg2 .= "★ 【공격장수】공헌 상승 : $exp 쌀 소비 : {$exp}x5x".getCrewtypeRice($general['crewtype'], $tech1)." = $ricing
"; $msg = ConvertLog($msg, 1); @@ -771,11 +771,11 @@ if($isgen == "장수공격" || $isgen == "성벽공격" || $isgen == "장수평 $msg2 .= "{$simulCount}회 평균
"; $msg2 .= "★병사수 변화 : -$mydeathnumSum vs -$mykillnumSum   "; $msg2 .= "★【성벽】내정 감소량 : $expSum2 【성벽】쌀 소모 : $ricingSum2
"; - $msg2 .= "★ 【공격장수】공헌 상승 : $expSum 쌀 소비 : {$expSum}x5x".getCrewtypeRice($game, $general['crewtype'], $tech1)." = $ricingSum
"; + $msg2 .= "★ 【공격장수】공헌 상승 : $expSum 쌀 소비 : {$expSum}x5x".getCrewtypeRice($general['crewtype'], $tech1)." = $ricingSum
"; } elseif($isgen == "장수평균") { $msg2 .= "{$simulCount}회 평균
"; $msg2 .= "★병사수 변화 : -$mydeathnumSum vs -$mykillnumSum   "; - $msg2 .= "★ 【공격장수】공헌 상승 : $expSum 쌀 소비 : {$expSum}x5x".getCrewtypeRice($game, $general['crewtype'], $tech1)." = $ricingSum
"; + $msg2 .= "★ 【공격장수】공헌 상승 : $expSum 쌀 소비 : {$expSum}x5x".getCrewtypeRice($general['crewtype'], $tech1)." = $ricingSum
"; } $msg2 = ConvertLog($msg2, 1); diff --git a/hwe/func.php b/hwe/func.php index dbb708c2..a3ebeb2a 100644 --- a/hwe/func.php +++ b/hwe/func.php @@ -1348,7 +1348,7 @@ function updateTraffic() { $date = date('Y-m-d H:i:s'); //일시|년|월|총갱신|접속자|최다갱신자 - file_put_contents(__dir__."logs/_traffic.txt", + file_put_contents(__dir__."/logs/_traffic.txt", StringUtil::padStringAlignRight($date,20," ") ."|".StringUtil::padStringAlignRight($game['year'],3," ") ."|".StringUtil::padStringAlignRight($game['month'],2," ") diff --git a/hwe/process_war.php b/hwe/process_war.php index 6f0a1bcf..4bf80ca8 100644 --- a/hwe/process_war.php +++ b/hwe/process_war.php @@ -172,8 +172,8 @@ function processWar($general, $city) { } else { $lbonus = 0; } - $myAtt = getAtt($game, $general, $nation['tech'], $lbonus); - $myDef = getDef($game, $general, $nation['tech']); + $myAtt = getAtt($general, $nation['tech'], $lbonus); + $myDef = getDef($general, $nation['tech']); $cityAtt = getCityAtt($city); $cityDef = getCityDef($city); @@ -386,7 +386,7 @@ function processWar($general, $city) { // 성격 보정 $myRice = CharExperience($myRice, $general['personal']); // 쌀 소모 - $myRice = ($myRice * 5 * getCrewtypeRice($game, $general['crewtype'], $nation['tech'])); + $myRice = ($myRice * 5 * getCrewtypeRice($general['crewtype'], $nation['tech'])); // 결과 쌀 $myRice = $general['rice'] - $myRice; @@ -426,7 +426,7 @@ function processWar($general, $city) { // 도시쌀 소모 계산 $opexp = Util::round($opexp / 50 * 0.8); - $rice = Util::round($opexp * 5 * getCrewtypeRice($game, 0, 0) * ($game['city_rate']/100 - 0.2)); + $rice = Util::round($opexp * 5 * getCrewtypeRice(0, 0) * ($game['city_rate']/100 - 0.2)); $destnation['rice'] -= $rice; if($destnation['rice'] < 0) { $destnation['rice'] = 0; } $query = "update nation set rice='{$destnation['rice']}' where nation='{$destnation['nation']}'"; @@ -635,8 +635,8 @@ function processWar($general, $city) { } else { $lbonus = 0; } - $myAtt = getAtt($game, $general, $nation['tech'], $lbonus); - $myDef = getDef($game, $general, $nation['tech']); + $myAtt = getAtt($general, $nation['tech'], $lbonus); + $myDef = getDef($general, $nation['tech']); if($oppose['level'] == 12) { $opplbonus = $destnation['level'] * 2; @@ -645,8 +645,8 @@ function processWar($general, $city) { } else { $opplbonus = 0; } - $opAtt = getAtt($game, $oppose, $destnation['tech'], $opplbonus); - $opDef = getDef($game, $oppose, $destnation['tech']); + $opAtt = getAtt($oppose, $destnation['tech'], $opplbonus); + $opDef = getDef($oppose, $destnation['tech']); // 감소할 병사 수 $myCrew = GameConst::$armperphase + $opAtt - $myDef; $opCrew = GameConst::$armperphase + $myAtt - $opDef; @@ -1246,7 +1246,7 @@ function processWar($general, $city) { // 성격 보정 $myRice = CharExperience($myRice, $general['personal']); // 쌀 소모 - $myRice = ($myRice * 5 * getCrewtypeRice($game, $general['crewtype'], $nation['tech'])); + $myRice = ($myRice * 5 * getCrewtypeRice($general['crewtype'], $nation['tech'])); // 결과 쌀 $myRice = $general['rice'] - $myRice; @@ -1255,7 +1255,7 @@ function processWar($general, $city) { // 성격 보정 $opRice = CharExperience($opRice, $oppose['personal']); // 쌀 소모 - $opRice = ($opRice * 5 * getCrewtypeRice($game, $oppose['crewtype'], $destnation['tech'])); + $opRice = ($opRice * 5 * getCrewtypeRice($oppose['crewtype'], $destnation['tech'])); // 결과 쌀 $opRice = $oppose['rice'] - $opRice; @@ -1395,7 +1395,7 @@ function processWar($general, $city) { // 성격 보정 $opexp = CharExperience($opexp, $oppose['personal']); // 쌀 소모 - $oppose['rice'] -= ($opexp * 5 * getCrewtypeRice($game, $oppose['crewtype'], $destnation['tech'])); + $oppose['rice'] -= ($opexp * 5 * getCrewtypeRice($oppose['crewtype'], $destnation['tech'])); if($oppose['rice'] < 0) { $oppose['rice'] = 0; } $query = "update general set deathnum=deathnum+1,rice='{$oppose['rice']}',experience=experience+'$opexp',dedication=dedication+'$opexp' where no='{$oppose['no']}'"; @@ -1437,7 +1437,7 @@ function processWar($general, $city) { // 성격 보정 $opexp = CharExperience($opexp, $oppose['personal']); // 쌀 소모 - $oppose['rice'] -= ($opexp * 5 * getCrewtypeRice($game, $oppose['crewtype'], $destnation['tech'])); + $oppose['rice'] -= ($opexp * 5 * getCrewtypeRice($oppose['crewtype'], $destnation['tech'])); if($oppose['rice'] < 0) { $oppose['rice'] = 0; } $query = "update general set rice='{$oppose['rice']}',leader2='{$oppose['leader2']}',power2='{$oppose['power2']}',intel2='{$oppose['intel2']}',atmos='{$oppose['atmos']}',experience=experience+'$opexp',dedication=dedication+'$opexp',killnum=killnum+1 where no='{$oppose['no']}'"; @@ -1473,7 +1473,7 @@ function processWar($general, $city) { // 성격 보정 $opexp = CharExperience($opexp, $oppose['personal']); // 쌀 소모 - $oppose['rice'] -= ($opexp * 5 * getCrewtypeRice($game, $oppose['crewtype'], $destnation['tech'])); + $oppose['rice'] -= ($opexp * 5 * getCrewtypeRice($oppose['crewtype'], $destnation['tech'])); if($oppose['rice'] < 0) { $oppose['rice'] = 0; } $query = "update general set rice='{$oppose['rice']}',experience=experience+'$opexp',dedication=dedication+'$opexp' where no='{$oppose['no']}'"; @@ -1495,7 +1495,7 @@ function processWar($general, $city) { // 성격 보정 $exp = CharExperience($exp, $general['personal']); // 쌀 소모 - $general['rice'] -= ($exp * 5 * getCrewtypeRice($game, $general['crewtype'], $nation['tech'])); + $general['rice'] -= ($exp * 5 * getCrewtypeRice($general['crewtype'], $nation['tech'])); if($general['rice'] < 0) { $general['rice'] = 0; } $query = "update general set rice='{$general['rice']}',dedication=dedication+'$exp',experience=experience+'$exp' where no='{$general['no']}'"; @@ -1575,9 +1575,9 @@ function getCrew($crew, $youatmos, $mytrain) { return $crew; } -function getCrewtypeRice($game, $crewtype, $tech) { +function getCrewtypeRice($crewtype, $tech) { if(!$crewtype) { $crewtype = 0; } - $cost = $game["ric{$crewtype}"] / 10; + $cost = GameUnitConst::byID($crewtype)->rice / 10; return $cost * getTechCost($tech); } @@ -1585,7 +1585,7 @@ function getCrewtypeRice($game, $crewtype, $tech) { // 표준 공 / 수 반환 수치는 약 0이 되게 (100~550) ////////////////////////////////////////////////////////////// -function getAtt($game, $general, $tech, $lbonus) { +function getAtt($general, $tech, $lbonus) { $att = GameUnitConst::byID($general['crewtype'])->attack + getTechAbil($tech); $general['lbonus'] = $lbonus; @@ -1604,7 +1604,7 @@ function getAtt($game, $general, $tech, $lbonus) { return $att; } -function getDef($game, $general, $tech) { +function getDef($general, $tech) { $def = GameUnitConst::byID($general['crewtype'])->defence + getTechAbil($tech); $crew = ($general['crew'] / (7000 / 30)) + 70; // 5000명일때 91점 7000명일때 100점 10000명일때 113점 @@ -1633,16 +1633,18 @@ function addConflict($city, $nationnum, $mykillnum) { $connect=$db->get(); $nationlist = []; - $killnum = []; + $killnum = [0]; - $query = "select year,month from game limit 1"; - $result = MYDB_query($query, $connect) or Error("addConflict ".MYDB_error($connect),""); - $game = MYDB_fetch_array($result); + list($year, $month) = $db->queryFirstList('SELECT year, month FROM game LIMIT 1'); if($city['conflict']){ $nationlist = array_map('intval', explode("|", $city['conflict'])); $killnum = array_map('intval', explode("|", $city['conflict2'])); } + else{ + $nationlist = [$nationnum]; + $killnum = [0]; + } for($i=0; $i < count($nationlist); $i++) { if($nationlist[$i] == $nationnum) break; @@ -1650,10 +1652,11 @@ function addConflict($city, $nationnum, $mykillnum) { if($i != 0 && $i == count($nationlist)) { // 두번째 나라부터 분쟁 가담 메시지 출력 $nation = getNationStaticInfo($nationnum); - pushWorldHistory(["●{$game['year']}년 {$game['month']}월:【분쟁】{$nation['name']}(이)가 {$city['name']} 공략에 가담하여 분쟁이 발생하고 있습니다."]); + pushWorldHistory(["●{$year}년 {$month}월:【분쟁】{$nation['name']}(이)가 {$city['name']} 공략에 가담하여 분쟁이 발생하고 있습니다."]); } $nationlist[$i] = $nationnum; + if($i == 0 || $city['def'] == 0) { // 선타, 막타 보너스 $killnum[$i] += Util::round($mykillnum * 1.05); } else {