GameConst 클래스의 항목들을 public static으로 변경.

This commit is contained in:
2018-03-25 01:19:37 +09:00
parent bcea562636
commit 13ee593548
13 changed files with 93 additions and 93 deletions
+4 -4
View File
@@ -161,8 +161,8 @@ if($isgen == "장수공격" || $isgen == "성벽공격" || $isgen == "장수평
$cityDef = getCityDef($city);
// 감소할 병사 수
$cityCrew = GameConst::armperphase + $myAtt - $cityDef;
$myCrew = GameConst::armperphase + $cityAtt - $myDef;
$cityCrew = GameConst::$armperphase + $myAtt - $cityDef;
$myCrew = GameConst::$armperphase + $cityAtt - $myDef;
$cityweight = $myAtt - $cityDef;
$myweight = $cityAtt - $myDef;
@@ -351,8 +351,8 @@ if($isgen == "장수공격" || $isgen == "성벽공격" || $isgen == "장수평
$opAtt = getAtt($game, $oppose, $tech2, 0);
$opDef = getDef($game, $oppose, $tech2);
// 감소할 병사 수
$myCrew = GameConst::armperphase + $opAtt - $myDef;
$opCrew = GameConst::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']);
+8 -8
View File
@@ -212,12 +212,12 @@ echo "
</tr>
";
$querys[10] = "select no,name,level,city from general where nation='{$me['nation']}' and level!='12' and power>='".GameConst::goodgenpower."' order by npc,binary(name)";
$querys[9] = "select no,name,level,city from general where nation='{$me['nation']}' and level!='12' and intel>='".GameConst::goodgenintel."' order by npc,binary(name)";
$querys[8] = "select no,name,level,city from general where nation='{$me['nation']}' and level!='12' and power>='".GameConst::goodgenpower."' order by npc,binary(name)";
$querys[7] = "select no,name,level,city from general where nation='{$me['nation']}' and level!='12' and intel>='".GameConst::goodgenintel."' order by npc,binary(name)";
$querys[6] = "select no,name,level,city from general where nation='{$me['nation']}' and level!='12' and power>='".GameConst::goodgenpower."' order by npc,binary(name)";
$querys[5] = "select no,name,level,city from general where nation='{$me['nation']}' and level!='12' and intel>='".GameConst::goodgenintel."' order by npc,binary(name)";
$querys[10] = "select no,name,level,city from general where nation='{$me['nation']}' and level!='12' and power>='".GameConst::$goodgenpower."' order by npc,binary(name)";
$querys[9] = "select no,name,level,city from general where nation='{$me['nation']}' and level!='12' and intel>='".GameConst::$goodgenintel."' order by npc,binary(name)";
$querys[8] = "select no,name,level,city from general where nation='{$me['nation']}' and level!='12' and power>='".GameConst::$goodgenpower."' order by npc,binary(name)";
$querys[7] = "select no,name,level,city from general where nation='{$me['nation']}' and level!='12' and intel>='".GameConst::$goodgenintel."' order by npc,binary(name)";
$querys[6] = "select no,name,level,city from general where nation='{$me['nation']}' and level!='12' and power>='".GameConst::$goodgenpower."' order by npc,binary(name)";
$querys[5] = "select no,name,level,city from general where nation='{$me['nation']}' and level!='12' and intel>='".GameConst::$goodgenintel."' order by npc,binary(name)";
for($i=10; $i >= $lv; $i--) {
if($i % 2 == 0) { echo "<tr>"; }
@@ -302,7 +302,7 @@ if($meLevel >= 5) {
<option value=0>____공석____</option>
";
$query = "select no,name,level,city from general where nation='{$me['nation']}' and level!='12' and power>='".GameConst::goodgenpower."' order by npc,binary(name)";
$query = "select no,name,level,city from general where nation='{$me['nation']}' and level!='12' and power>='".GameConst::$goodgenpower."' order by npc,binary(name)";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$count = MYDB_num_rows($result);
for($i=0; $i < $count; $i++) {
@@ -356,7 +356,7 @@ if($meLevel >= 5) {
<option value=0>____공석____</option>
";
$query = "select no,name,level,city from general where nation='{$me['nation']}' and level!='12' and intel>='".GameConst::goodgenintel."' order by npc,binary(name)";
$query = "select no,name,level,city from general where nation='{$me['nation']}' and level!='12' and intel>='".GameConst::$goodgenintel."' order by npc,binary(name)";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$count = MYDB_num_rows($result);
for($i=0; $i < $count; $i++) {
+8 -8
View File
@@ -186,12 +186,12 @@ if($btn == "추방") {
if($genlist != 0) {
$valid = 0;
switch($level) {
case 10: if($general['power'] >= GameConst::goodgenpower) { $valid = 1; } break;
case 9: if($general['intel'] >= GameConst::goodgenintel) { $valid = 1; } break;
case 8: if($general['power'] >= GameConst::goodgenpower) { $valid = 1; } break;
case 7: if($general['intel'] >= GameConst::goodgenintel) { $valid = 1; } break;
case 6: if($general['power'] >= GameConst::goodgenpower) { $valid = 1; } break;
case 5: if($general['intel'] >= GameConst::goodgenintel) { $valid = 1; } break;
case 10: if($general['power'] >= GameConst::$goodgenpower) { $valid = 1; } break;
case 9: if($general['intel'] >= GameConst::$goodgenintel) { $valid = 1; } break;
case 8: if($general['power'] >= GameConst::$goodgenpower) { $valid = 1; } break;
case 7: if($general['intel'] >= GameConst::$goodgenintel) { $valid = 1; } break;
case 6: if($general['power'] >= GameConst::$goodgenpower) { $valid = 1; } break;
case 5: if($general['intel'] >= GameConst::$goodgenintel) { $valid = 1; } break;
default: $valid = 1; break;
}
if($valid == 1) {
@@ -233,8 +233,8 @@ if($btn == "추방") {
if($genlist != 0) {
$valid = 0;
switch($level) {
case 4: if($general['power'] >= GameConst::goodgenpower) { $valid = 1; } break;
case 3: if($general['intel'] >= GameConst::goodgenintel) { $valid = 1; } break;
case 4: if($general['power'] >= GameConst::$goodgenpower) { $valid = 1; } break;
case 3: if($general['intel'] >= GameConst::$goodgenintel) { $valid = 1; } break;
default: $valid = 1; break;
}
if($valid == 1) {
+2 -2
View File
@@ -1545,7 +1545,7 @@ function msgprint($connect, $msg, $name, $picture, $imgsvr, $when, $num, $type)
function banner() {
return sprintf('<font size=2>%s / %s <br> %s</font>', GameConst::version, GameConst::banner, GameConst::helper);
return sprintf('<font size=2>%s / %s <br> %s</font>', GameConst::$version, GameConst::$banner, GameConst::$helper);
}
function addTurn($date, $turnterm=1) {
@@ -2773,7 +2773,7 @@ function uniqueItem($connect, $general, $log, $vote=0) {
function checkAbility($connect, $general, $log) {
$limit = GameConst::upgradeLimit;
$limit = GameConst::$upgradeLimit;
$query = "select no,leader,leader2,power,power2,intel,intel2 from general where no='{$general['no']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
+8 -8
View File
@@ -468,19 +468,19 @@ function getLevel($level, $nlevel=8) {
function getCall($leader, $power, $intel) {
$call = '평범';
if($leader >= GameConst::goodgenleader && $power >= GameConst::goodgenpower && $intel >= GameConst::goodgenintel) {
if($leader >= GameConst::$goodgenleader && $power >= GameConst::$goodgenpower && $intel >= GameConst::$goodgenintel) {
$call = '만능';
} elseif($leader >= GameConst::goodgenleader && $power >= GameConst::goodgenpower) {
} elseif($leader >= GameConst::$goodgenleader && $power >= GameConst::$goodgenpower) {
$call = '용장';
} elseif($leader >= GameConst::goodgenleader && $intel >= GameConst::goodgenintel) {
} elseif($leader >= GameConst::$goodgenleader && $intel >= GameConst::$goodgenintel) {
$call = '지장';
} elseif($power >= GameConst::goodgenpower && $intel >= GameConst::goodgenintel) {
} elseif($power >= GameConst::$goodgenpower && $intel >= GameConst::$goodgenintel) {
$call = '명장';
} elseif($leader >= GameConst::goodgenleader) {
} elseif($leader >= GameConst::$goodgenleader) {
$call = '명사';
} elseif($power >= GameConst::goodgenpower) {
} elseif($power >= GameConst::$goodgenpower) {
$call = '용맹';
} elseif($intel >= GameConst::goodgenintel) {
} elseif($intel >= GameConst::$goodgenintel) {
$call = '현명';
}
return $call;
@@ -606,7 +606,7 @@ function getDedLevel($dedication) {
}
function expStatus($exp) {
return $exp / GameConst::upgradeLimit * 100;
return $exp / GameConst::$upgradeLimit * 100;
}
function getLevelPer($exp, $level) {
+1 -1
View File
@@ -728,7 +728,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]-GameConst::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단위 포상
+3 -3
View File
@@ -196,7 +196,7 @@ function process_1($connect, &$general, $type) {
$log[] = "<C>●</>{$admin['month']}월:{$dtype}{$btype} 충분합니다. $dtype 실패. <1>$date</>";
} else {
// 민심 50 이하이면 50과 같게
if($city['rate'] < GameConst::develrate) { $city['rate'] = GameConst::develrate; }
if($city['rate'] < GameConst::$develrate) { $city['rate'] = GameConst::$develrate; }
$rate = $city['rate'] / 100;
$score = getGeneralIntel($general, true, true, true, false) * $rate;
@@ -473,7 +473,7 @@ function process_5($connect, &$general, $type) {
$log[] = "<C>●</>{$admin['month']}월:{$dtype}는 충분합니다. $dtype 실패. <1>$date</>";
} else {
// 민심 50 이하이면 50과 같게
if($city['rate'] < GameConst::develrate) { $city['rate'] = GameConst::develrate; }
if($city['rate'] < GameConst::$develrate) { $city['rate'] = GameConst::$develrate; }
$rate = $city['rate'] / 100;
$score = getGeneralPower($general, true, true, true, false) * $rate;
@@ -654,7 +654,7 @@ function process_8($connect, &$general) {
$log[] = "<C>●</>{$admin['month']}월:치안은 충분합니다. $dtype 강화 실패. <1>$date</>";
} else {
// 민심 50 이하이면 50과 같게
if($city['rate'] < GameConst::develrate) { $city['rate'] = GameConst::develrate; }
if($city['rate'] < GameConst::$develrate) { $city['rate'] = GameConst::$develrate; }
$rate = $city['rate'] / 100;
$score = getGeneralPower($general, true, true, true, false) * $rate;
+7 -7
View File
@@ -28,14 +28,14 @@ function process_23($connect, &$general) {
if($amount < 100) { $amount = 100; }
if($what == 1) {
$dtype = "";
if($nation['gold']-GameConst::basegold < $amount) { $amount = $nation['gold'] - GameConst::basegold; }
if($nation['gold']-GameConst::$basegold < $amount) { $amount = $nation['gold'] - GameConst::$basegold; }
} elseif($what == 2) {
$dtype = "";
if($nation['rice']-GameConst::baserice < $amount) { $amount = $nation['rice'] - GameConst::baserice; }
if($nation['rice']-GameConst::$baserice < $amount) { $amount = $nation['rice'] - GameConst::$baserice; }
} else {
$what = 2;
$dtype = "";
if($nation['rice']-GameConst::baserice < $amount) { $amount = $nation['rice'] - GameConst::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'";
@@ -372,8 +372,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']-GameConst::basegold) { $gold = $mynation['gold'] - GameConst::basegold; }
if($rice > $mynation['rice']-GameConst::baserice) { $rice = $mynation['rice'] - GameConst::basegold; }
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[] = "<C>●</>{$admin['month']}월:멸망한 국가입니다. 원조 실패. <1>$date</>";
@@ -955,7 +955,7 @@ function process_66($connect, &$general) {
$log[] = "<C>●</>{$admin['month']}월:인접도시가 아닙니다. 천도 실패. <1>$date</>";
} elseif($nation['capset'] == 1) {
$log[] = "<C>●</>{$admin['month']}월:다음 분기에 가능합니다. 천도 실패. <1>$date</>";
} elseif($nation['gold']-GameConst::basegold < $amount || $nation['rice']-GameConst::basegold < $amount) {
} elseif($nation['gold']-GameConst::$basegold < $amount || $nation['rice']-GameConst::$basegold < $amount) {
$log[] = "<C>●</>{$admin['month']}월:물자가 부족합니다. 천도 실패. <1>$date</>";
} elseif($term < 3) {
$log[] = "<C>●</>{$admin['month']}월:천도중... ({$term}/3) <1>$date</>";
@@ -1040,7 +1040,7 @@ function process_67($connect, &$general) {
$log[] = "<C>●</>{$admin['month']}월:수뇌부가 아닙니다. 증축 실패. <1>$date</>";
} elseif($nation['capset'] == 1) {
$log[] = "<C>●</>{$admin['month']}월:다음 분기에 가능합니다. 증축 실패. <1>$date</>";
} elseif($nation['gold']-GameConst::basegold < $amount || $nation['rice']-GameConst::basegold < $amount) {
} elseif($nation['gold']-GameConst::$basegold < $amount || $nation['rice']-GameConst::$basegold < $amount) {
$log[] = "<C>●</>{$admin['month']}월:물자가 부족합니다. 증축 실패. <1>$date</>";
} elseif($term < 6) {
$log[] = "<C>●</>{$admin['month']}월:증축중... ({$term}/6) <1>$date</>";
+1 -1
View File
@@ -779,7 +779,7 @@ function process_55($connect, &$general) {
'name'=>$makename,
'color'=>'#330000',
'gold'=>0,
'rice'=>GameConst::baserice,
'rice'=>GameConst::$baserice,
'rate'=>20,
'bill'=>100,
'tricklimit'=>36,
+2 -2
View File
@@ -220,8 +220,8 @@ function process_33($connect, &$general) {
$nation['gold'] -= $gold;
$nation['rice'] -= $rice;
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; }
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'";
+8 -8
View File
@@ -60,14 +60,14 @@ function processGoldIncome($connect) {
// 실제 지급량 계산
$nation['gold'] += $income;
// 기본량도 안될경우
if($nation['gold'] < GameConst::basegold) {
if($nation['gold'] < GameConst::$basegold) {
$realoutcome = 0;
// 실지급율
$ratio = 0;
//기본량은 넘지만 요구량이 안될경우
} elseif($nation['gold'] - GameConst::basegold < $outcome) {
$realoutcome = $nation['gold'] - GameConst::basegold;
$nation['gold'] = GameConst::basegold;
} elseif($nation['gold'] - GameConst::$basegold < $outcome) {
$realoutcome = $nation['gold'] - GameConst::$basegold;
$nation['gold'] = GameConst::$basegold;
// 실지급율
$ratio = $realoutcome / $originoutcome;
} else {
@@ -352,14 +352,14 @@ function processRiceIncome($connect) {
// 실제 지급량 계산
$nation['rice'] += $income;
// 기본량도 안될경우
if($nation['rice'] < GameConst::baserice) {
if($nation['rice'] < GameConst::$baserice) {
$realoutcome = 0;
// 실지급율
$ratio = 0;
//기본량은 넘지만 요구량이 안될경우
} elseif($nation['rice'] - GameConst::baserice < $outcome) {
$realoutcome = $nation['rice'] - GameConst::baserice;
$nation['rice'] = GameConst::baserice;
} elseif($nation['rice'] - GameConst::$baserice < $outcome) {
$realoutcome = $nation['rice'] - GameConst::$baserice;
$nation['rice'] = GameConst::$baserice;
// 실지급율
$ratio = $realoutcome / $originoutcome;
} else {
+6 -6
View File
@@ -158,8 +158,8 @@ function processWar($connect, $general, $city) {
$cityDef = getCityDef($city);
// 감소할 병사 수
$cityCrew = GameConst::armperphase + $myAtt - $cityDef;
$myCrew = GameConst::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; }
@@ -632,8 +632,8 @@ function processWar($connect, $general, $city) {
$opAtt = getAtt($game, $oppose, $destnation['tech'], $opplbonus);
$opDef = getDef($game, $oppose, $destnation['tech']);
// 감소할 병사 수
$myCrew = GameConst::armperphase + $opAtt - $myDef;
$opCrew = GameConst::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; }
//훈련 사기따라
@@ -1757,8 +1757,8 @@ function ConquerCity($connect, $game, $general, $city, $nation, $destnation) {
unset($genlog[1]);
// 승전국 보상
$losenation['gold'] -= GameConst::basegold;
$losenation['rice'] -= GameConst::baserice;
$losenation['gold'] -= GameConst::$basegold;
$losenation['rice'] -= GameConst::$baserice;
if($losenation['gold'] < 0) { $losenation['gold'] = 0; }
if($losenation['rice'] < 0) { $losenation['rice'] = 0; }
+35 -35
View File
@@ -3,69 +3,69 @@ namespace sammo;
class GameConst{
/** @var string 버전 */
const version = "삼국지 모의전투 PHP HideD v0.1";
public static $version = "삼국지 모의전투 PHP HideD v0.1";
/** @var string 코드 아래에 붙는 설명 코드 */
const banner = "KOEI의 이미지를 사용, 응용하였습니다 / 제작 : 유기체(jwh1807@gmail.com), HideD(hided62@gmail.com)";
public static $banner = "KOEI의 이미지를 사용, 응용하였습니다 / 제작 : 유기체(jwh1807@gmail.com), HideD(hided62@gmail.com)";
/** @var string 코드 아래에 붙는 설명 코드 */
const helper = "도움 주신 분들";
public static $helper = "도움 주신 분들";
/** @var int 내정시 최하 민심 설정*/
const develrate = 50;
public static $develrate = 50;
/** @var int 능력치 상승 경험치*/
const upgradeLimit = 30;
public static $upgradeLimit = 30;
/** @var int 숙련도 제한치*/
const dexLimit = 1000000;
public static $dexLimit = 1000000;
/** @var int 초기 사기치*/
const defaultatmos = 40;
public static $defaultatmos = 40;
/** @var int 초기 훈련치*/
const defaulttrain = 40;
public static $defaulttrain = 40;
/** @var int 초기 사기치*/
const defaultatmos2 = 70;
public static $defaultatmos2 = 70;
/** @var int 초기 훈련치*/
const defaulttrain2 = 70;
public static $defaulttrain2 = 70;
/** @var int 최대 훈련치*/
const maxtrain = 100;
public static $maxtrain = 100;
/** @var int 인위적으로 올릴 수 있는 최대 사기치*/
const maxatmos = 100;
public static $maxatmos = 100;
/** @var int 최대 사기치*/
const maximumatmos = 150;
public static $maximumatmos = 150;
/** @var int 최대 훈련치*/
const maximumtrain = 110;
public static $maximumtrain = 110;
/** @var int 풀징병시 훈련 1회 상승량*/
const training = 30;
public static $training = 30;
/** @var float 훈련시 사기 감소율*/
const atmosing = 0.98;
public static $atmosing = 0.98;
/** @var float 계략 기본 성공률*/
const basefiring = 0.25;
/** @var int 계략시 확률 가중치(수치가 클수록 변화가 적음 : (지력차/const firing + const basefiring)*/
const firing = 300;
public static $basefiring = 0.25;
/** @var int 계략시 확률 가중치(수치가 클수록 변화가 적음 : (지력차/public static $firing + public static $basefiring)*/
public static $firing = 300;
/** @var int 계략시 기본 수치 감소량*/
const firingbase = 100;
/** @var int 계략시 수치 감소량(const firingbase ~ const firingpower)*/
const firingpower = 400;
public static $firingbase = 100;
/** @var int 계략시 수치 감소량(public static $firingbase ~ public static $firingpower)*/
public static $firingpower = 400;
/** @var int 명장,지장에 사용될 통솔 제한*/
const goodgenleader = 65;
public static $goodgenleader = 65;
/** @var int 명장에 사용될 무력 제한*/
const goodgenpower = 65;
public static $goodgenpower = 65;
/** @var int 지장에 사용될 지력 제한*/
const goodgenintel = 65;
public static $goodgenintel = 65;
/** @var string 기본 배경색깔 푸른색*/
const basecolor = "#000044";
public static $basecolor = "#000044";
/** @var string 기본 배경색깔 초록색*/
const basecolor2 = "#225500";
public static $basecolor2 = "#225500";
/** @var string 기본 배경색깔 붉은색*/
const basecolor3 = "#660000";
public static $basecolor3 = "#660000";
/** @var string 기본 배경색깔 검붉은색*/
const basecolor4 = "#330000";
public static $basecolor4 = "#330000";
/** @var int 페이즈당 표준 감소 병사 수*/
const armperphase = 500;
public static $armperphase = 500;
/** @var int 기본 국고*/
const basegold = 0;
public static $basegold = 0;
/** @var int 기본 병량*/
const baserice = 2000;
public static $baserice = 2000;
/** @var int 최저 국고(긴급시) */
const minNationalgold = 0;
public static $minNationalgold = 0;
/** @var int 최저 병량(긴급시) */
const minNationalRice = 0;
public static $minNationalRice = 0;
/** @var float 군량 매매시 세율*/
const taxrate = 0.01;
public static $taxrate = 0.01;
}