징병, 모병 추가
This commit is contained in:
+18
-4
@@ -51,6 +51,8 @@ class AIAllowedAction{
|
|||||||
case 'warp':
|
case 'warp':
|
||||||
$this->warp = true;
|
$this->warp = true;
|
||||||
break;
|
break;
|
||||||
|
case 'recruit_high':
|
||||||
|
$this->recruit_high = true;
|
||||||
case 'recruit':
|
case 'recruit':
|
||||||
$this->recruit = true;
|
$this->recruit = true;
|
||||||
$this->changeWarCondition = true;
|
$this->changeWarCondition = true;
|
||||||
@@ -147,7 +149,7 @@ function SetDevelop($genType, $no, $city, $tech) {
|
|||||||
return;
|
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();
|
$db = DB::db();
|
||||||
$connect=$db->get();
|
$connect=$db->get();
|
||||||
|
|
||||||
@@ -224,7 +226,13 @@ function SetCrew($no, $nationID, $personal, $gold, $leader, $genType, $tech, $de
|
|||||||
}
|
}
|
||||||
|
|
||||||
if($types){
|
if($types){
|
||||||
$type = Util::choiceRandom($types);
|
if(!$allowedAction->randomRecruit && in_array($currentCrewType, $types)){
|
||||||
|
$type = $currentCrewType;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$type = Util::choiceRandom($types);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$type = GameUnitConst::DEFAULT_CREWTYPE;
|
$type = GameUnitConst::DEFAULT_CREWTYPE;
|
||||||
@@ -239,7 +247,13 @@ function SetCrew($no, $nationID, $personal, $gold, $leader, $genType, $tech, $de
|
|||||||
|
|
||||||
$crew = intdiv($gold, $cost);
|
$crew = intdiv($gold, $cost);
|
||||||
if($leader < $crew) { $crew = $leader; }
|
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'";
|
$query = "update general set turn0='$command' where no='$no'";
|
||||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||||
@@ -994,7 +1008,7 @@ function processAI($no) {
|
|||||||
return;
|
return;
|
||||||
case EncodeCommand(0, 0, 0, 11): //징병
|
case EncodeCommand(0, 0, 0, 11): //징병
|
||||||
if ($allowedAction->recruit) {
|
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{
|
else{
|
||||||
$db->update('general', [
|
$db->update('general', [
|
||||||
|
|||||||
@@ -166,6 +166,9 @@ if($session->userGrade < 5 && !$allowReset){
|
|||||||
<label class="btn btn-secondary">
|
<label class="btn btn-secondary">
|
||||||
<input type="checkbox" class="autorun_user_chk" data-key="recruit" name="autorun_recruit" id="autorun_recruit">징훈사
|
<input type="checkbox" class="autorun_user_chk" data-key="recruit" name="autorun_recruit" id="autorun_recruit">징훈사
|
||||||
</label>
|
</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">
|
<label class="btn btn-secondary">
|
||||||
<input type="checkbox" class="autorun_user_chk" data-key="battle" name="autorun_battle" id="autorun_battle">출병
|
<input type="checkbox" class="autorun_user_chk" data-key="battle" name="autorun_battle" id="autorun_battle">출병
|
||||||
</label>
|
</label>
|
||||||
|
|||||||
+12
-10
@@ -43,13 +43,14 @@ if(file_exists(__dir__.'/.htaccess')){
|
|||||||
foreach($options['autorun_user']['option'] as $auto_option => $value){
|
foreach($options['autorun_user']['option'] as $auto_option => $value){
|
||||||
assert($value);
|
assert($value);
|
||||||
switch($auto_option){
|
switch($auto_option){
|
||||||
case 'develop': $auto_info[] = '내정'; break;
|
case 'develop': $auto_info['내정'] = '내정'; break;
|
||||||
case 'warp': $auto_info[] = '순간이동'; break;
|
case 'warp': $auto_info['순간이동'] = '순간이동'; break;
|
||||||
case 'recruit': $auto_info[] = '징훈사'; break;
|
case 'recruit': $auto_info['징훈사'] = $auto_info['징훈사']??'징훈사'; break;
|
||||||
case 'battle': $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})";
|
$otherTextInfo[] = "자동행동({$auto_info})";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,13 +116,14 @@ if($admin['autorun_user']['limit_minutes']??false){
|
|||||||
foreach($admin['autorun_user']['option'] as $auto_option => $value){
|
foreach($admin['autorun_user']['option'] as $auto_option => $value){
|
||||||
assert($value);
|
assert($value);
|
||||||
switch($auto_option){
|
switch($auto_option){
|
||||||
case 'develop': $auto_info[] = '내정'; break;
|
case 'develop': $auto_info['내정'] = '내정'; break;
|
||||||
case 'warp': $auto_info[] = '순간이동'; break;
|
case 'warp': $auto_info['순간이동'] = '순간이동'; break;
|
||||||
case 'recruit': $auto_info[] = '징훈사'; break;
|
case 'recruit': $auto_info['징훈사'] = $auto_info['징훈사']??'징훈사'; break;
|
||||||
case 'battle': $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})";
|
$otherTextInfo[] = "자동행동({$auto_info})";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user