집합장 테스트

This commit is contained in:
2018-09-18 00:29:44 +09:00
parent 78f8b56203
commit 87171b4246
6 changed files with 85 additions and 3 deletions
+4 -1
View File
@@ -150,12 +150,15 @@ if($meLevel >= 5 && $nation["l{$meLevel}set"] == 0) {
echo "
<select name=outlist size=1 style=color:white;background-color:black;>";
$query = "select no,name,level,leader,power,intel,killturn from general where nation='{$me['nation']}' and level!='12' and no!='{$me['no']}' order by npc,binary(name)";
$query = "select no,npc,name,level,leader,power,intel,killturn from general where nation='{$me['nation']}' and level!='12' and no!='{$me['no']}' order by npc,binary(name)";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$gencount = MYDB_num_rows($result);
for($i=0; $i < $gencount; $i++) {
$general = MYDB_fetch_array($result);
if($general['npc'] == 5){
continue;
}
echo "
<option value={$general['no']}>{$general['name']} <small>({$general['leader']}/{$general['power']}/{$general['intel']}, {$general['killturn']}턴)</small></option>";
}
+6
View File
@@ -75,6 +75,12 @@ if($btn == "임명") {
header('location:b_myBossInfo.php');
exit();
}
//집합장 추방 불가
if($general['npc'] == 5){
header('location:b_myBossInfo.php');
exit();
}
}
//나와 대상 장수는 국가가 같아야 함
+34
View File
@@ -1020,6 +1020,40 @@ function updateNationState() {
break;
}
$lastAssemblerID = $gameStor->assemblerID??0;
foreach(range($nation['level'] + 1, $nationLevel) as $levelGen){
$lastAssemblerID += 1;
$npcObj = new Scenario\NPC(
999, '집합장'.$lastAssemblerID, null, $nation['nation'], $nation['capital'],
10, 10, 10, 1, $admin['year'] - 15, $admin['year'] + 15, 10, 75
);
$npcObj->npc = 5;
$npcObj->build();
$npcID = $npcObj->generalID;
$db->insert('troop', [
'name'=>$npcObj->realName,
'nation'=>$nation['nation'],
'no'=>$npcID
]);
$troopID = $db->insertId();
$command = EncodeCommand(0, 0, 0, 26); //집합
$db->update('general', [
'troop'=>$troopID,
'turn0'=>$command,
'turn1'=>$command,
'turn2'=>$command,
'turn3'=>$command,
'turn4'=>$command,
'turn5'=>$command,
'killturn'=>80
], 'no=%i', $npcID);
}
$gameStor->assemberlID = $lastAssemblerID;
//작위 상승
$query = "update nation set level='{$nation['level']}' where nation='{$nation['nation']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
+24
View File
@@ -201,6 +201,30 @@ function processAI($no) {
return;
}
if($general['npc'] == 5){
if($general['nation'] == 0 && $general['killturn'] > 1){
$command = EncodeCommand(0, 0, 0, 0); //휴식
$db->update('general', [
'turn0'=>$command,
'killturn'=>1
], 'no=$i', $general['no']);
}
else{
$command = EncodeCommand(0, 0, 0, 26); //집합
$db->update('general', [
'turn0'=>$command,
'turn1'=>$command,
'turn2'=>$command,
'turn3'=>$command,
'turn4'=>$command,
'turn5'=>$command,
'killturn'=>80
], 'no=%i', $general['no']);
}
return;
}
$query = "select city,region,nation,level,path,rate,gen1,gen2,gen3,pop,supply,front from city where city='{$general['city']}'";
$result = MYDB_query($query, $connect) or Error("processAI02 ".MYDB_error($connect),"");
$city = MYDB_fetch_array($result);
+16 -1
View File
@@ -8,6 +8,9 @@ use \sammo\GameUnitConst;
class NPC{
public $generalID = null;
public $realName = null;
public $affinity;
public $name;
public $picturePath;
@@ -24,6 +27,16 @@ class NPC{
public $charWar = 0;
public $npc = 2;
public $text;
static $prefixList = [
1 => 'ⓝ', //빙의 NPC
2 => 'ⓝ', //NPC
3 => 'ⓜ', //인탐 장수
4 => 'ⓖ', //의병장(전략)
5 => '㉥', //부대장
6 => 'ⓤ', //unselectable npc, 빙의 불가 npc
9 => 'ⓞ', //오랑캐?
];
//[ 1, "헌제",1002, 1, null, 17, 13, 61, 0, 170, 250, "안전", null, "산 넘어 산이로구나..."],
public function __construct(
@@ -156,7 +169,8 @@ class NPC{
$charDomestic = 0;
}
$name = ''.$this->name;
$name = (static::$prefixList[$this->npc]?:'').$this->name;
$this->realName = $name;
$picturePath = $this->picturePath;
if($env['show_img_level'] < 3){
@@ -260,6 +274,7 @@ class NPC{
'bornyear'=>$this->birth,
'deadyear'=>$this->death
]);
$this->generalID = $db->insertId();
return true; //생성되었다.
}
+1 -1
View File
@@ -177,7 +177,7 @@ class StringUtil
public static function removeSpecialCharacter($str)
{
return str_replace([
'"', '\'', 'ⓝ', 'ⓜ', 'ⓖ', '\\', '/', '`', '#',
'"', '\'', 'ⓝ', 'ⓜ', 'ⓖ', 'ⓞ', 'ⓧ', '㉥', '\\', '/', '`', '#',
'-', '#', '|'
], '', $str);
}