diff --git a/che_close/process_war.php b/che_close/process_war.php index cfa39c4..32cbbd4 100755 --- a/che_close/process_war.php +++ b/che_close/process_war.php @@ -101,10 +101,28 @@ function getBonusTrainBasedOnCity($connect, $city) { return bonusTrain; } +function updateTechBasedOnDeath($deathCount, $nation, $game, $genCount, $connect) { + // 죽은수 기술로 누적 + $num = round($deathCount * 0.01); + + // 국가보정 + if($nation[type] == 3 || $nation[type] == 13) { + $num *= 1.1; + } + if($nation[type] == 5 || $nation[type] == 6 || $nation[type] == 7 || $nation[type] == 8 || $nation[type] == 12) { + $num *= 0.9; + } + + // 부드러운 기술 제한 + if(TechLimit($game[startyear], $game[year], $nation[tech])) { $num = floor($num/4); } + $query = "update nation set totaltech=totaltech+'$num',tech=totaltech/'$genCount' where nation='$nation[nation]'"; + MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); +} + function processWar($connect, $general, $city) { global $_armperphase, $_maximumatmos, $_maximumtrain, $_dexLimit, $_basegold, $_baserice; - $date = substr($general[turntime],11,5); + $date = substr($general[turntime],11,5); $game = getGame($connect); $deadAmount[att] = 0; @@ -128,6 +146,7 @@ function processWar($connect, $general, $city) { $originCity = getOriginCity($connect, $general); $nation = getNation($connect, $general); $destnation = getDestination($connect, $city); + $gencount = getGeneralCount($connect, $nation[nation]); $destgencount = getGeneralCount($connect, $destnation[nation]); $opposecount = getOpposeCount($connect, $city); @@ -447,36 +466,19 @@ function processWar($connect, $general, $city) { // 숙련도 증가 addGenDex($connect, $general[no], $general[atmos], $general[train], $general[crewtype], $mykillnum); addGenDex($connect, $general[no], $general[atmos], $general[train], 40, $mydeathnum); - // 죽은수 기술로 누적 - $num = round($mydeathnum * 0.01); - // 국가보정 - if($nation[type] == 3 || $nation[type] == 13) { $num *= 1.1; } - if($nation[type] == 5 || $nation[type] == 6 || $nation[type] == 7 || $nation[type] == 8 || $nation[type] == 12) { $num *= 0.9; } - // 부드러운 기술 제한 - if(TechLimit($game[startyear], $game[year], $nation[tech])) { $num = floor($num/4); } - $query = "update nation set totaltech=totaltech+'$num',tech=totaltech/'$gencount' where nation='$nation[nation]'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - // 죽은수 기술로 누적 - $num = round($mykillnum * 0.01); - // 국가보정 - if($destnation[type] == 3 || $destnation[type] == 13) { $num *= 1.1; } - if($destnation[type] == 5 || $destnation[type] == 6 || $destnation[type] == 7 || $destnation[type] == 8 || $destnation[type] == 12) { $num *= 0.9; } - // 부드러운 기술 제한 - if(TechLimit($game[startyear], $game[year], $destnation[tech])) { $num = floor($num/4); } - $query = "update nation set totaltech=totaltech+'$num',tech=totaltech/'$destgencount' where nation='$destnation[nation]'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - //양국 평균 기술가격 - //$techRatio = (getTechCost($nation[tech]) + getTechCost($destnation[tech])) / 2; - $techRatio = 1.0; + + updateTechBasedOnDeath($mydeathnum, $nation, $game, $genCount, $connect); + updateTechBasedOnDeath($mykillnum, $destnation, $game, $destGenCount, $connect); + // 죽은수 도시 재정으로 누적 60% - $num = round(($mykillnum+$mydeathnum) * 0.6 * $techRatio); + $num = round(($mykillnum+$mydeathnum) * 0.6); // 국가보정 if($destnation[type] == 1) { $num *= 1.1; } if($destnation[type] == 9 || $destnation[type] == 10) { $num *= 0.9; } $query = "update city set dead=dead+'$num',def='$city[def]',wall='$city[wall]',agri='$city[agri]',comm='$city[comm]',secu='$city[secu]' where city='$city[city]'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); // 죽은수 도시 재정으로 누적 40% - $num = round(($mykillnum+$mydeathnum) * 0.4 * $techRatio); + $num = round(($mykillnum+$mydeathnum) * 0.4); // 국가보정 if($nation[type] == 1) { $num *= 1.1; } if($nation[type] == 9 || $nation[type] == 10) { $num *= 0.9; } @@ -578,9 +580,8 @@ function processWar($connect, $general, $city) { MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $log[count($log)] = "".getItemName($general[item])."(을)를 사용!"; $general[item] = 0; - } elseif($general[weap] == 10 || $general[weap] == 14 || $general[weap] == 18 || $general[weap] == 22) { -// $log[count($log)] = "".getWeapName($general[weap])."(을)를 사용!"; } + $log[count($log)] = "●상대를 저격했다!"; $batlog[count($batlog)] = "●상대를 저격했다!"; $opplog[count($opplog)] = "●상대에게 저격당했다!"; @@ -1287,15 +1288,8 @@ function processWar($connect, $general, $city) { // 숙련도 증가 addGenDex($connect, $oppose[no], $oppose[atmos], $oppose[train], $oppose[crewtype], $opkillnum * 0.9); addGenDex($connect, $oppose[no], $oppose[atmos], $oppose[train], $general[crewtype], $opdeathnum * 0.9); - // 죽은수 기술로 누적 - $num = round($mydeathnum * 0.01); - // 국가보정 - if($nation[type] == 3 || $nation[type] == 13) { $num *= 1.1; } - if($nation[type] == 5 || $nation[type] == 6 || $nation[type] == 7 || $nation[type] == 8 || $nation[type] == 12) { $num *= 0.9; } - // 부드러운 기술 제한 - if(TechLimit($game[startyear], $game[year], $nation[tech])) { $num = floor($num/4); } - $query = "update nation set totaltech=totaltech+'$num',tech=totaltech/'$gencount' where nation='$nation[nation]'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); + + updateTechBasedOnDeath($mydeathnum, $nation, $game, $genCount, $connect); // 장수 부상 $ratio = rand() % 100; @@ -1310,27 +1304,18 @@ function processWar($connect, $general, $city) { // 숙련도 증가 addGenDex($connect, $general[no], $general[atmos], $general[train], $general[crewtype], $mykillnum); addGenDex($connect, $general[no], $general[atmos], $general[train], $oppose[crewtype], $mydeathnum); - // 죽은수 기술로 누적 - $num = round($opdeathnum * 0.01); - // 국가보정 - if($destnation[type] == 3 || $destnation[type] == 13) { $num *= 1.1; } - if($destnation[type] == 5 || $destnation[type] == 6 || $destnation[type] == 7 || $destnation[type] == 8 || $destnation[type] == 12) { $num *= 0.9; } - // 부드러운 기술 제한 - if(TechLimit($game[startyear], $game[year], $destnation[tech])) { $num = floor($num/4); } - $query = "update nation set totaltech=totaltech+'$num',tech=totaltech/'$destgencount' where nation='$destnation[nation]'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - //양국 평균 기술가격 - //$techRatio = (getTechCost($nation[tech]) + getTechCost($destnation[tech])) / 2; - $techRatio = 1.0; + + updateTechBasedOnDeath($opdeathnum, $destnation, $game, $destGenCount, $connect); + // 죽은수 도시 재정으로 누적 60% - $num = round(($mykillnum+$mydeathnum) * 0.6 * $techRatio); + $num = round(($mykillnum+$mydeathnum) * 0.6); // 국가보정 if($destnation[type] == 1) { $num *= 1.1; } if($destnation[type] == 9 || $destnation[type] == 10) { $num *= 0.9; } $query = "update city set dead=dead+'$num' where city='$city[city]'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); // 죽은수 도시 재정으로 누적 40% - $num = round(($mykillnum+$mydeathnum) * 0.4 * $techRatio); + $num = round(($mykillnum+$mydeathnum) * 0.4); // 국가보정 if($nation[type] == 1) { $num *= 1.1; } if($nation[type] == 9 || $nation[type] == 10) { $num *= 0.9; } @@ -1420,8 +1405,6 @@ function processWar($connect, $general, $city) { unset($opplog); unset($oppbatlog); unset($oppbatres); -// $alllog[count($alllog)] = "●{$game[month]}월:$general[name](이)가 }$city[name] 공략에 실패했습니다. <1>$date"; -// $log[count($log)] = "$city[name] 공략에 실패했습니다. <1>$date"; break; } else { // 무승부일때 로그 남김