From 9903f5b6248d34500d1ecf0b3821365125f26aec Mon Sep 17 00:00:00 2001 From: hide_d Date: Sat, 3 Mar 2018 18:22:48 +0900 Subject: [PATCH] =?UTF-8?q?$=5Fbasegold,=20$=5Fbaserice=EB=A5=BC=20GameCon?= =?UTF-8?q?st=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- twe/_simul.php | 8 ++++---- twe/func_gamerule.php | 4 ++++ twe/func_npc.php | 4 +--- twe/func_process.php | 39 +++++++++------------------------------ twe/func_time_event.php | 20 ++++++++------------ twe/lib.php | 3 --- twe/process_war.php | 16 ++++++++-------- 7 files changed, 34 insertions(+), 60 deletions(-) diff --git a/twe/_simul.php b/twe/_simul.php index 35da641e..6a8800a1 100644 --- a/twe/_simul.php +++ b/twe/_simul.php @@ -159,8 +159,8 @@ if($isgen == "장수공격" || $isgen == "성벽공격" || $isgen == "장수평 $cityDef = getCityDef($city); // 감소할 병사 수 - $cityCrew = $_armperphase + $myAtt - $cityDef; - $myCrew = $_armperphase + $cityAtt - $myDef; + $cityCrew = GameConst::armperphase + $myAtt - $cityDef; + $myCrew = GameConst::armperphase + $cityAtt - $myDef; $cityweight = $myAtt - $cityDef; $myweight = $cityAtt - $myDef; @@ -349,8 +349,8 @@ if($isgen == "장수공격" || $isgen == "성벽공격" || $isgen == "장수평 $opAtt = getAtt($game, $oppose, $tech2, 0); $opDef = getDef($game, $oppose, $tech2); // 감소할 병사 수 - $myCrew = $_armperphase + $opAtt - $myDef; - $opCrew = $_armperphase + $myAtt - $opDef; + $myCrew = GameConst::armperphase + $opAtt - $myDef; + $opCrew = GameConst::armperphase + $myAtt - $opDef; //훈련 사기따라 $myCrew = getCrew($myCrew, $oppose['atmos'], $general['train']); $opCrew = getCrew($opCrew, $general['atmos'], $oppose['train']); diff --git a/twe/func_gamerule.php b/twe/func_gamerule.php index bbf0fedd..024edfed 100644 --- a/twe/func_gamerule.php +++ b/twe/func_gamerule.php @@ -61,6 +61,10 @@ class GameConst{ const basegold = 0; /** @var int 기본 병량*/ const baserice = 2000; + /** @var int 최저 국고(긴급시) */ + const minNationalgold = 0; + /** @var int 최저 병량(긴급시) */ + const minNationalRice = 0; /** @var float 군량 매매시 세율*/ const taxrate = 0.01; } diff --git a/twe/func_npc.php b/twe/func_npc.php index 9907e80a..d769975b 100644 --- a/twe/func_npc.php +++ b/twe/func_npc.php @@ -257,8 +257,6 @@ function SetCrew($connect, $no, $personal, $gold, $leader, $genType, $tech, $reg } function processAI($connect, $no) { - global $_baserice; - $query = "select startyear,year,month,turnterm,scenario,gold_rate,rice_rate from game where no='1'"; $result = MYDB_query($query, $connect) or Error("processAI00 ".MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -680,7 +678,7 @@ function processAI($connect, $no) { $result = MYDB_query($query, $connect) or Error("processAI10 ".MYDB_error($connect),""); $SelGen = MYDB_fetch_array($result); if($SelGen['no'] != 0) { - $amount = floor(($nation[$type]-$_baserice) / 5000)*10 + 10; + $amount = floor(($nation[$type]-GameConst::baserice) / 5000)*10 + 10; if($amount > 100) $amount = 100; // 포상 $command = EncodeCommand($type2, $SelGen['no'], $amount, 23); // 금 1000단위 포상 diff --git a/twe/func_process.php b/twe/func_process.php index f667c53e..c9696e2b 100644 --- a/twe/func_process.php +++ b/twe/func_process.php @@ -1427,7 +1427,6 @@ function process_22($connect, &$general) { function process_23($connect, &$general) { $log = array(); $alllog = array(); - global $_basegold, $_baserice; $date = substr($general['turntime'],11,5); @@ -1453,14 +1452,14 @@ function process_23($connect, &$general) { if($amount < 100) { $amount = 100; } if($what == 1) { $dtype = "금"; - if($nation['gold']-$_basegold < $amount) { $amount = $nation['gold'] - $_basegold; } + if($nation['gold']-GameConst::basegold < $amount) { $amount = $nation['gold'] - GameConst::basegold; } } elseif($what == 2) { $dtype = "쌀"; - if($nation['rice']-$_baserice < $amount) { $amount = $nation['rice'] - $_baserice; } + if($nation['rice']-GameConst::baserice < $amount) { $amount = $nation['rice'] - GameConst::baserice; } } else { $what = 2; $dtype = "쌀"; - if($nation['rice']-$_baserice < $amount) { $amount = $nation['rice'] - $_baserice; } + if($nation['rice']-GameConst::baserice < $amount) { $amount = $nation['rice'] - GameConst::baserice; } } $query = "select no,nation,level,name,gold,rice from general where no='$who'"; @@ -2495,9 +2494,7 @@ function process_33($connect, &$general) { $log = array(); $alllog = array(); global $_firing, $_basefiring, $_firingpower; - //global $_basegold, $_baserice; //TODO : 버그로 보여서 지웠는데, 진짜로 지워도 되는지 확인 //탈취는 0까지 무제한 - $_basegold = 0; $_baserice = 0; $date = substr($general['turntime'],11,5); $query = "select year,month,develcost from game where no='1'"; @@ -2591,8 +2588,8 @@ function process_33($connect, &$general) { $nation['gold'] -= $gold; $nation['rice'] -= $rice; - if($nation['gold'] < $_basegold) { $gold += ($nation['gold'] - $_basegold); $nation['gold'] = $_basegold; } - if($nation['rice'] < $_baserice) { $rice += ($nation['rice'] - $_baserice); $nation['rice'] = $_baserice; } + if($nation['gold'] < GameConst::minNationalgold) { $gold += ($nation['gold'] - GameConst::minNationalgold); $nation['gold'] = GameConst::minNationalgold; } + if($nation['rice'] < GameConst::minNationalrice) { $rice += ($nation['rice'] - GameConst::minNationalrice); $nation['rice'] = GameConst::minNationalrice; } $query = "update nation set gold='{$nation['gold']}',rice='{$nation['rice']}' where nation='{$destcity['nation']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $query = "update city set state=34 where city='$destination'"; @@ -4063,7 +4060,6 @@ function process_51($connect, &$general) { } function process_52($connect, &$general) { - global $_basegold, $_baserice; $log = array(); $alllog = array(); $date = substr($general['turntime'],11,5); @@ -4095,8 +4091,8 @@ function process_52($connect, &$general) { $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $younation = MYDB_fetch_array($result); - if($gold > $mynation['gold']-$_basegold) { $gold = $mynation['gold'] - $_basegold; } - if($rice > $mynation['rice']-$_baserice) { $rice = $mynation['rice'] - $_baserice; } + if($gold > $mynation['gold']-GameConst::basegold) { $gold = $mynation['gold'] - GameConst::basegold; } + if($rice > $mynation['rice']-GameConst::baserice) { $rice = $mynation['rice'] - GameConst::basegold; } if($younation['nation'] == 0) { $log[count($log)] = "●{$admin['month']}월:멸망한 국가입니다. 원조 실패. <1>$date"; @@ -4300,7 +4296,6 @@ function process_55($connect, &$general) { $alllog = array(); $history = array(); - global $_baserice; $date = substr($general['turntime'],11,5); $query = "select startyear,year,month from game where no='1'"; @@ -4498,7 +4493,6 @@ function process_57($connect, &$general) { function process_61($connect, &$general) { $log = array(); $alllog = array(); - global $_basegold, $_baserice; $date = substr($general['turntime'],11,5); $query = "select year,month,develcost,turnterm from game where no='1'"; @@ -4532,8 +4526,6 @@ function process_61($connect, &$general) { $log[count($log)] = "●{$admin['month']}월:아국이 아닙니다. 제의 실패. <1>$date"; } elseif($city['supply'] == 0) { $log[count($log)] = "●{$admin['month']}월:고립된 도시입니다. 제의 실패. <1>$date"; -// } elseif($nation['gold']-$_basegold < $admin['develcost'] || $nation['rice']-$_baserice < $admin['develcost']) { -// $log[count($log)] = "●{$admin['month']}월:증정할 물자가 부족합니다. 제의 실패. <1>$date"; } else { $log[count($log)] = "●{$admin['month']}월:{$younation['name']}으로 불가침 제의 서신을 보냈습니다.<1>$date"; $exp = 5; @@ -4893,7 +4885,6 @@ function process_65($connect, &$general) { } function process_66($connect, &$general) { - global $_basegold, $_baserice; $log = array(); $alllog = array(); @@ -4942,7 +4933,7 @@ function process_66($connect, &$general) { $log[count($log)] = "●{$admin['month']}월:인접도시가 아닙니다. 천도 실패. <1>$date"; } elseif($nation['capset'] == 1) { $log[count($log)] = "●{$admin['month']}월:다음 분기에 가능합니다. 천도 실패. <1>$date"; - } elseif($nation['gold']-$_basegold < $amount || $nation['rice']-$_baserice < $amount) { + } elseif($nation['gold']-GameConst::basegold < $amount || $nation['rice']-GameConst::basegold < $amount) { $log[count($log)] = "●{$admin['month']}월:물자가 부족합니다. 천도 실패. <1>$date"; } elseif($term < 3) { $log[count($log)] = "●{$admin['month']}월:천도중... ({$term}/3) <1>$date"; @@ -4980,7 +4971,6 @@ function process_66($connect, &$general) { } function process_67($connect, &$general) { - global $_basegold, $_baserice; $log = array(); $alllog = array(); @@ -5028,7 +5018,7 @@ function process_67($connect, &$general) { $log[count($log)] = "●{$admin['month']}월:수뇌부가 아닙니다. 증축 실패. <1>$date"; } elseif($nation['capset'] == 1) { $log[count($log)] = "●{$admin['month']}월:다음 분기에 가능합니다. 증축 실패. <1>$date"; - } elseif($nation['gold']-$_basegold < $amount || $nation['rice']-$_baserice < $amount) { + } elseif($nation['gold']-GameConst::basegold < $amount || $nation['rice']-GameConst::basegold < $amount) { $log[count($log)] = "●{$admin['month']}월:물자가 부족합니다. 증축 실패. <1>$date"; } elseif($term < 6) { $log[count($log)] = "●{$admin['month']}월:증축중... ({$term}/6) <1>$date"; @@ -5068,7 +5058,6 @@ function process_67($connect, &$general) { } function process_68($connect, &$general) { - global $_basegold, $_baserice; $log = array(); $alllog = array(); @@ -5118,8 +5107,6 @@ function process_68($connect, &$general) { $log[count($log)] = "●{$admin['month']}월:수뇌부가 아닙니다. 감축 실패. <1>$date"; } elseif($nation['capset'] == 1) { $log[count($log)] = "●{$admin['month']}월:다음 분기에 가능합니다. 감축 실패. <1>$date"; -// } elseif($nation['gold']-$_basegold < $amount || $nation['rice']-$_baserice < $amount) { -// $log[count($log)] = "●{$admin['month']}월:물자가 부족합니다. 감축 실패. <1>$date"; } elseif($term < 6) { $log[count($log)] = "●{$admin['month']}월:감축중... ({$term}/6) <1>$date"; @@ -5170,7 +5157,6 @@ function process_68($connect, &$general) { } function process_71($connect, &$general) { - global $_basegold, $_baserice; $log = array(); $alllog = array(); @@ -5272,7 +5258,6 @@ function process_71($connect, &$general) { } function process_72($connect, &$general) { - global $_basegold, $_baserice; $log = array(); $alllog = array(); @@ -5383,7 +5368,6 @@ function process_72($connect, &$general) { } function process_73($connect, &$general) { - global $_basegold, $_baserice; $log = array(); $alllog = array(); @@ -5510,7 +5494,6 @@ function process_73($connect, &$general) { } function process_74($connect, &$general) { - global $_basegold, $_baserice; $log = array(); $alllog = array(); @@ -5649,7 +5632,6 @@ function process_74($connect, &$general) { } function process_75($connect, &$general) { - global $_basegold, $_baserice; $log = array(); $alllog = array(); @@ -5771,7 +5753,6 @@ function process_75($connect, &$general) { } function process_76($connect, &$general) { - global $_basegold, $_baserice; $log = array(); $alllog = array(); @@ -5986,7 +5967,6 @@ function process_76($connect, &$general) { } function process_77($connect, &$general) { - global $_basegold, $_baserice; $log = array(); $alllog = array(); @@ -6110,7 +6090,6 @@ function process_77($connect, &$general) { } function process_78($connect, &$general) { - global $_basegold, $_baserice; $log = array(); $alllog = array(); diff --git a/twe/func_time_event.php b/twe/func_time_event.php index 1d6473f3..85c67357 100644 --- a/twe/func_time_event.php +++ b/twe/func_time_event.php @@ -41,8 +41,6 @@ function processSpring($connect) { } function processGoldIncome($connect) { - global $_basegold; - $query = "select year,month,gold_rate from game where no='1'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -62,14 +60,14 @@ function processGoldIncome($connect) { // 실제 지급량 계산 $nation['gold'] += $income; // 기본량도 안될경우 - if($nation['gold'] < $_basegold) { + if($nation['gold'] < GameConst::basegold) { $realoutcome = 0; // 실지급율 $ratio = 0; //기본량은 넘지만 요구량이 안될경우 - } elseif($nation['gold'] - $_basegold < $outcome) { - $realoutcome = $nation['gold'] - $_basegold; - $nation['gold'] = $_basegold; + } elseif($nation['gold'] - GameConst::basegold < $outcome) { + $realoutcome = $nation['gold'] - GameConst::basegold; + $nation['gold'] = GameConst::basegold; // 실지급율 $ratio = $realoutcome / $originoutcome; } else { @@ -334,8 +332,6 @@ function processFall($connect) { } function processRiceIncome($connect) { - global $_baserice; - $query = "select year,month,rice_rate from game where no='1'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -356,14 +352,14 @@ function processRiceIncome($connect) { // 실제 지급량 계산 $nation['rice'] += $income; // 기본량도 안될경우 - if($nation['rice'] < $_baserice) { + if($nation['rice'] < GameConst::baserice) { $realoutcome = 0; // 실지급율 $ratio = 0; //기본량은 넘지만 요구량이 안될경우 - } elseif($nation['rice'] - $_baserice < $outcome) { - $realoutcome = $nation['rice'] - $_baserice; - $nation['rice'] = $_baserice; + } elseif($nation['rice'] - GameConst::baserice < $outcome) { + $realoutcome = $nation['rice'] - GameConst::baserice; + $nation['rice'] = GameConst::baserice; // 실지급율 $ratio = $realoutcome / $originoutcome; } else { diff --git a/twe/lib.php b/twe/lib.php index ce698fb0..f1c125a1 100644 --- a/twe/lib.php +++ b/twe/lib.php @@ -52,9 +52,6 @@ $_basecolor = "000044"; // 기본 배경색깔 푸른색 $_basecolor2 = "225500"; // 기본 배경색깔 초록색 $_basecolor3 = "660000"; // 기본 배경색깔 붉은색 $_basecolor4 = "330000"; // 기본 배경색깔 검붉은색 -$_armperphase = 500; // 페이즈당 표준 감소 병사 수 -$_basegold = 0; // 기본 국고 -$_baserice = 2000; // 기본 병량 $_taxrate = 0.01; // 군량 매매시 세율 //$images = "http://115.68.28.99/images"; //$image = "http://115.68.28.99/image"; diff --git a/twe/process_war.php b/twe/process_war.php index e4a30efb..89d2b78c 100644 --- a/twe/process_war.php +++ b/twe/process_war.php @@ -4,7 +4,7 @@ function processWar($connect, $general, $city) { $templates = new League\Plates\Engine('templates'); - global $_armperphase, $_maximumatmos, $_maximumtrain, $_dexLimit, $_basegold, $_baserice; + global $_maximumatmos, $_maximumtrain, $_dexLimit; $date = substr($general['turntime'],11,5); $query = "select * from game where no='1'"; @@ -156,8 +156,8 @@ function processWar($connect, $general, $city) { $cityDef = getCityDef($city); // 감소할 병사 수 - $cityCrew = $_armperphase + $myAtt - $cityDef; - $myCrew = $_armperphase + $cityAtt - $myDef; + $cityCrew = GameConst::armperphase + $myAtt - $cityDef; + $myCrew = GameConst::armperphase + $cityAtt - $myDef; if($cityCrew <= 0) { $cityCrew = rand() % 90 + 10; } if($myCrew <= 0) { $myCrew = rand() % 90 + 10; } @@ -630,8 +630,8 @@ function processWar($connect, $general, $city) { $opAtt = getAtt($game, $oppose, $destnation['tech'], $opplbonus); $opDef = getDef($game, $oppose, $destnation['tech']); // 감소할 병사 수 - $myCrew = $_armperphase + $opAtt - $myDef; - $opCrew = $_armperphase + $myAtt - $opDef; + $myCrew = GameConst::armperphase + $opAtt - $myDef; + $opCrew = GameConst::armperphase + $myAtt - $opDef; if($myCrew <= 0) { $myCrew = rand() % 90 + 10; } if($opCrew <= 0) { $opCrew = rand() % 90 + 10; } //훈련 사기따라 @@ -1668,7 +1668,7 @@ function getConquerNation($connect, $city) { } function ConquerCity($connect, $game, $general, $city, $nation, $destnation) { - global $_armperphase, $_maximumatmos, $_basegold, $_baserice; + global $_maximumatmos; if($destnation['nation'] > 0) { $destnationName = "{$destnation['name']}의"; @@ -1755,8 +1755,8 @@ function ConquerCity($connect, $game, $general, $city, $nation, $destnation) { unset($genlog[1]); // 승전국 보상 - $losenation['gold'] -= $_basegold; - $losenation['rice'] -= $_baserice; + $losenation['gold'] -= GameConst::basegold; + $losenation['rice'] -= GameConst::baserice; if($losenation['gold'] < 0) { $losenation['gold'] = 0; } if($losenation['rice'] < 0) { $losenation['rice'] = 0; }