징병, 모병 추가

This commit is contained in:
2019-09-21 01:09:17 +09:00
parent 53ba1db79f
commit 7bebbe3a16
3 changed files with 33 additions and 14 deletions
+18 -4
View File
@@ -51,6 +51,8 @@ class AIAllowedAction{
case 'warp':
$this->warp = true;
break;
case 'recruit_high':
$this->recruit_high = true;
case 'recruit':
$this->recruit = true;
$this->changeWarCondition = true;
@@ -147,7 +149,7 @@ function SetDevelop($genType, $no, $city, $tech) {
return;
}
function SetCrew($no, $nationID, $personal, $gold, $leader, $genType, $tech, $dex0, $dex10, $dex20, $dex30, $dex40) {
function SetCrew($no, $nationID, $personal, $gold, $leader, $genType, $tech, $dex0, $dex10, $dex20, $dex30, $dex40, $currentCrewType, AIAllowedAction $allowedAction) {
$db = DB::db();
$connect=$db->get();
@@ -224,7 +226,13 @@ function SetCrew($no, $nationID, $personal, $gold, $leader, $genType, $tech, $de
}
if($types){
$type = Util::choiceRandom($types);
if(!$allowedAction->randomRecruit && in_array($currentCrewType, $types)){
$type = $currentCrewType;
}
else{
$type = Util::choiceRandom($types);
}
}
else{
$type = GameUnitConst::DEFAULT_CREWTYPE;
@@ -239,7 +247,13 @@ function SetCrew($no, $nationID, $personal, $gold, $leader, $genType, $tech, $de
$crew = intdiv($gold, $cost);
if($leader < $crew) { $crew = $leader; }
$command = EncodeCommand(0, $type, $crew, 11);
if($allowedAction->recruit_high && $crew * $cost * 8 < $gold){
$command = EncodeCommand(0, $type, $crew, 12);
}
else{
$command = EncodeCommand(0, $type, $crew, 11);
}
$query = "update general set turn0='$command' where no='$no'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
@@ -994,7 +1008,7 @@ function processAI($no) {
return;
case EncodeCommand(0, 0, 0, 11): //징병
if ($allowedAction->recruit) {
SetCrew($general['no'], $general['nation'], $general['personal'], $general['gold'], $general['leader'], $genType, $nation['tech'], $general['dex0'], $general['dex10'], $general['dex20'], $general['dex30'], $general['dex40']);
SetCrew($general['no'], $general['nation'], $general['personal'], $general['gold'], $general['leader'], $genType, $nation['tech'], $general['dex0'], $general['dex10'], $general['dex20'], $general['dex30'], $general['dex40'], $general['crewtype'], $allowedAction);
}
else{
$db->update('general', [
+3
View File
@@ -166,6 +166,9 @@ if($session->userGrade < 5 && !$allowReset){
<label class="btn btn-secondary">
<input type="checkbox" class="autorun_user_chk" data-key="recruit" name="autorun_recruit" id="autorun_recruit">징훈사
</label>
<label class="btn btn-secondary">
<input type="checkbox" class="autorun_user_chk" data-key="recruit_high" name="autorun_recruit_high" id="autorun_recruit_high">모병
</label>
<label class="btn btn-secondary">
<input type="checkbox" class="autorun_user_chk" data-key="battle" name="autorun_battle" id="autorun_battle">출병
</label>
+12 -10
View File
@@ -43,13 +43,14 @@ if(file_exists(__dir__.'/.htaccess')){
foreach($options['autorun_user']['option'] as $auto_option => $value){
assert($value);
switch($auto_option){
case 'develop': $auto_info[] = '내정'; break;
case 'warp': $auto_info[] = '순간이동'; break;
case 'recruit': $auto_info[] = '징훈사'; break;
case 'battle': $auto_info[] = '출병'; break;
case 'develop': $auto_info['내정'] = '내정'; break;
case 'warp': $auto_info['순간이동'] = '순간이동'; break;
case 'recruit': $auto_info['징훈사'] = $auto_info['징훈사']??'징훈사'; break;
case 'recruit_high': $auto_info['징훈사'] = '모훈사'; break;
case 'battle': $auto_info['출병'] = '출병'; break;
}
}
$auto_info = join(',', $auto_info);
$auto_info = join(', ', array_values($auto_info));
$otherTextInfo[] = "자동행동({$auto_info})";
}
@@ -115,13 +116,14 @@ if($admin['autorun_user']['limit_minutes']??false){
foreach($admin['autorun_user']['option'] as $auto_option => $value){
assert($value);
switch($auto_option){
case 'develop': $auto_info[] = '내정'; break;
case 'warp': $auto_info[] = '순간이동'; break;
case 'recruit': $auto_info[] = '징훈사'; break;
case 'battle': $auto_info[] = '출병'; break;
case 'develop': $auto_info['내정'] = '내정'; break;
case 'warp': $auto_info['순간이동'] = '순간이동'; break;
case 'recruit': $auto_info['징훈사'] = $auto_info['징훈사']??'징훈사'; break;
case 'recruit_high': $auto_info['징훈사'] = '모훈사'; break;
case 'battle': $auto_info['출병'] = '출병'; break;
}
}
$auto_info = join(', ', $auto_info);
$auto_info = join(', ', array_values($auto_info));
$otherTextInfo[] = "자동행동({$auto_info})";
}