강행, 단련 추가

This commit is contained in:
2018-10-17 02:01:00 +09:00
parent 9846d7f8e4
commit cbd2e136ed
6 changed files with 245 additions and 197 deletions
-192
View File
@@ -551,69 +551,6 @@ function process_16(&$general) {
pushGenLog($general, $log);
}
function process_21(&$general) {
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
$connect=$db->get();
$log = [];
$alllog = [];
$history = [];
$date = substr($general['turntime'],11,5);
$db = DB::db();
$admin = $gameStor->getValues(['year', 'month', 'develcost']);
$city = CityConst::byID($general['city']);
$command = DecodeCommand($general['turn0']);
$destination = $command[1];
$destCity = CityConst::byID($destination);
$josaRo = JosaUtil::pick($destCity->name, '로');
if(!key_exists($destCity->id, $city->path)) {
$log[] = "<C>●</>{$admin['month']}월:인접도시가 아닙니다. <G><b>{$destCity->name}</b></>{$josaRo} 이동 실패. <1>$date</>";
} elseif($general['gold'] < $admin['develcost']) {
$log[] = "<C>●</>{$admin['month']}월:자금이 부족합니다. <G><b>{$destCity->name}</b></>{$josaRo} 이동 실패. <1>$date</>";
} else {
$log[] = "<C>●</>{$admin['month']}월:<G><b>{$destCity->name}</b></>{$josaRo} 이동했습니다. <1>$date</>";
$exp = 50;
// 성격 보정
$exp = CharExperience($exp, $general['personal']);
// 이동, 경험치 상승, 명성 상승, 사기 감소
$general['leader2']++;
$db->update('general',[
'resturn'=>'SUCCESS',
'gold'=>$db->sqleval('gold - %i',$admin['develcost']),
'city'=>$destCity->id,
'atmos'=>$db->sqleval('atmos*0.95'),
'leader2'=>$general['leader2'],
'experience'=>$db->sqleval('experience + %i',$exp)
], 'no = %i', $general['no']);
if($general['level'] == 12) {
$nation = getNationStaticInfo($general['nation']);
if($nation['level'] == 0) {
$db->update('general', [
'city'=>$destCity->id
], 'nation = %i', $general['nation']);
$genlog = ["<C>●</>방랑군 세력이 <G><b>{$destCity->name}</b></>{$josaRo} 이동했습니다."];
foreach($db->query('SELECT `no` FROM general WHERE nation=%i and `level`<12', $general['nation']) as $follower){
pushGenLog($follower, $genlog);
}
}
}
$log = checkAbility($general, $log);
}
pushGenLog($general, $log);
}
function process_26(&$general) {
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
@@ -746,74 +683,6 @@ function process_28(&$general) {
//pushGenLog($you, $youlog);
}
function process_30(&$general) {
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
$connect=$db->get();
$log = [];
$alllog = [];
$history = [];
$date = substr($general['turntime'],11,5);
$admin = $gameStor->getValues(['year', 'month', 'develcost']);
$query = "select path from city where city='{$general['city']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$city = MYDB_fetch_array($result);
$dist = searchDistance($general['city'], 3, false);
$command = DecodeCommand($general['turn0']);
$destination = $command[1];
$query = "select name from city where city='$destination'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$destcity = MYDB_fetch_array($result);
$cost = $admin['develcost'] * 5;
$josaRo = JosaUtil::pick($destcity['name'], '로');
if($destination == $general['city']){
$log[] = "<C>●</>{$admin['month']}월:같은 도시입니다. <G><b>{$destcity['name']}</b></>{$josaRo} 강행 실패. <1>$date</>";
} elseif(!key_exists($destination, $dist)) {
$log[] = "<C>●</>{$admin['month']}월:거리가 멉니다. <G><b>{$destcity['name']}</b></>{$josaRo} 강행 실패. <1>$date</>";
} elseif($general['gold'] < $cost) {
$log[] = "<C>●</>{$admin['month']}월:자금이 부족합니다. <G><b>{$destcity['name']}</b></>{$josaRo} 강행 실패. <1>$date</>";
} else {
$log[] = "<C>●</>{$admin['month']}월:<G><b>{$destcity['name']}</b></>{$josaRo} 강행했습니다. <1>$date</>";
$exp = 100;
// 성격 보정
$exp = CharExperience($exp, $general['personal']);
// 이동, 경험치 상승, 명성 상승, 병력/사기/훈련 감소
$general['leader2']++;
$query = "update general set resturn='SUCCESS',gold=gold-'$cost',city='$destination',crew=crew*0.95,atmos=atmos*0.9,train=train*0.95,leader2='{$general['leader2']}',experience=experience+'$exp' where no='{$general['no']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
if($general['level'] == 12) {
$nation = getNationStaticInfo($general['nation']);
if($nation['level'] == 0) {
$query = "update general set city='$destination' where nation='{$general['nation']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$query = "select no,name from general where nation='{$general['nation']}' and level<'12'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$gencount = MYDB_num_rows($result);
$genlog = ["<C>●</>방랑군 세력이 <G><b>{$destcity['name']}</b></>{$josaRo} 강행했습니다."];
for($j=0; $j < $gencount; $j++) {
$gen = MYDB_fetch_array($result);
pushGenLog($gen, $genlog);
}
}
}
$log = checkAbility($general, $log);
}
pushGenLog($general, $log);
}
function process_31(&$general) {
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
@@ -957,67 +826,6 @@ function process_31(&$general) {
pushGenLog($general, $log);
}
function process_41(&$general) {
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
$connect=$db->get();
$log = [];
$alllog = [];
$history = [];
$date = substr($general['turntime'],11,5);
$admin = $gameStor->getValues(['year', 'month', 'develcost']);
$ratio = rand() % 100;
$exp = $general['crew'] / 400;
$crewexp = $general['crew'] * $general['train'] * $general['atmos'] / 20 / 10000;
// 랜덤치
$exp = Util::round($exp * (80 + rand() % 41)/100); // 80 ~ 120%
$crewexp = Util::round($crewexp * (80 + rand() % 41)/100); // 80 ~ 120%
// 성격 보정
$exp = CharExperience($exp, $general['personal']);
$ratio = CharCritical($ratio, $general['personal']);
if($general['nation'] == 0) {
$log[] = "<C>●</>{$admin['month']}월:재야입니다. 단련 실패. <1>$date</>";
} elseif($general['gold'] < $admin['develcost']) {
$log[] = "<C>●</>{$admin['month']}월:자금이 모자랍니다. 단련 실패. <1>$date</>";
} elseif($general['rice'] < $admin['develcost']) {
$log[] = "<C>●</>{$admin['month']}월:군량이 모자랍니다. 단련 실패. <1>$date</>";
} elseif($general['train'] < 40) {
$log[] = "<C>●</>{$admin['month']}월:훈련이 너무 낮습니다. 단련 실패. <1>$date</>";
} elseif($general['atmos'] < 40) {
$log[] = "<C>●</>{$admin['month']}월:사기가 너무 낮습니다. 단련 실패. <1>$date</>";
} elseif($crewexp == 0) {
$log[] = "<C>●</>{$admin['month']}월:병사가 모자랍니다. 단련 실패. <1>$date</>";
} else {
$crewstr = GameUnitConst::allType()[GameUnitConst::byID($general['crewtype'])->armType];
if($ratio < 33) {
// 숙련도 증가
addGenDex($general['no'], GameConst::$maxAtmosByCommand, GameConst::$maxTrainByCommand, $general['crewtype'], $crewexp);
$log[] = "<C>●</>{$admin['month']}월:$crewstr 숙련도 향상이 <span class='ev_failed'>지지부진</span>했습니다. <1>$date</>";
} elseif($ratio < 66) {
$exp = $exp * 2;
// 숙련도 증가
addGenDex($general['no'], GameConst::$maxAtmosByCommand, GameConst::$maxTrainByCommand, $general['crewtype'], $crewexp * 2);
$log[] = "<C>●</>{$admin['month']}월:$crewstr 숙련도가 향상되었습니다. <1>$date</>";
} else {
$exp = $exp * 3;
// 숙련도 증가
addGenDex($general['no'], GameConst::$maxAtmosByCommand, GameConst::$maxTrainByCommand, $general['crewtype'], $crewexp * 3);
$log[] = "<C>●</>{$admin['month']}월:$crewstr 숙련도가 <S>일취월장</>했습니다. <1>$date</>";
}
// 경험치 상승 // 명성 상승
$query = "update general set resturn='SUCCESS',gold=gold-'{$admin['develcost']}',rice=rice-'{$admin['develcost']}',experience=experience+'$exp' where no='{$general['no']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
}
pushGenLog($general, $log);
}
function process_42(&$general) {
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');