전투 엔진 버그 2차 수정

This commit is contained in:
2018-08-21 01:22:18 +09:00
parent d0ca46cfde
commit d8cc820572
6 changed files with 28 additions and 23 deletions
+1 -1
View File
@@ -533,7 +533,7 @@ function processCommand($no) {
}
//장수정보 재로드
$query = "select npc,no,name,picture,imgsvr,nation,nations,city,troop,injury,affinity,leader,leader2,power,power2,intel,intel2,experience,dedication,level,gold,rice,crew,crewtype,train,atmos,weap,book,horse,item,turntime,makenation,makelimit,killturn,block,dedlevel,explevel,age,belong,personal,special,special2,term,turn0,dex0,dex10,dex20,dex30,dex40 from general where no='$no'";
$query = "select npc,no,name,picture,imgsvr,nation,nations,city,troop,injury,affinity,leader,leader2,power,power2,intel,intel2,experience,dedication,level,gold,rice,crew,crewtype,train,atmos,weap,book,horse,item,turntime,makenation,makelimit,killturn,block,dedlevel,explevel,age,belong,personal,special,special2,term,turn0,dex0,dex10,dex20,dex30,dex40,warnum,killnum,deathnum,killcrew,deathcrew,recwar from general where no='$no'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$general = MYDB_fetch_array($result);
}
+7 -13
View File
@@ -186,11 +186,7 @@ function processWar_NG(
$logger->pushGlobalActionLog("<D><b>{$attacker->getNationVar('name')}</b></>의 <Y>{$attacker->getName()}</>{$josaYi} <G><b>{$city->getName()}</b></>{$josaRo} 진격합니다.");
$logger->pushGeneralActionLog("<G><b>{$city->getName()}</b></>{$josaRo} <M>진격</>합니다. <1>$date</>");
$battleBegin = false;
for($currPhase = 0; $currPhase < $attacker->getMaxPhase(); $currPhase+=1){
$battleBegin = true;
if($defender === null){
$defender = $city;
@@ -346,7 +342,6 @@ function processWar_NG(
}
if(!$defender->continueWar($noRice)){
$battleBegin = false;
$attacker->logBattleResult();
$defender->logBattleResult();
@@ -376,22 +371,23 @@ function processWar_NG(
$defender->getLogger()->pushGeneralActionLog("전멸했습니다.", ActionLogger::PLAIN);
}
if($currPhase + 1 == $attacker->getMaxPhase()){
break;
}
$defender->finishBattle();
$defender = ($getNextDefender)($defender, true);
if($defender !== null && !($defender instanceof WarUnitGeneral)){
throw new \RuntimeException('다음 수비자를 받아오는데 실패');
}
}
}
}
$attacker->finishBattle();
if(!$battleBegin){
// 마지막 페이즈까지 갔지만, '갱신된 수비자'와 전투하지 않았다.
return false;
}
$defender->finishBattle();
if($currPhase == $attacker->getMaxPhase()){
//마지막 페이즈의 전투 마무리
@@ -402,8 +398,6 @@ function processWar_NG(
$defender->logBattleResult();
}
$defender->finishBattle();
if($defender instanceof WarUnitCity){
$newConflict = $defender->addConflict();
if($newConflict){
+2 -2
View File
@@ -69,12 +69,12 @@ class ActionLogger{
}
if($this->generalBattleResultLog){
pushGenLog(['no'=>$this->generalId], $this->generalBattleResultLog);
pushBatRes(['no'=>$this->generalId], $this->generalBattleResultLog);
$this->generalBattleResultLog = [];
}
if($this->generalBattleDetailLog){
pushGenLog(['no'=>$this->generalId], $this->generalBattleDetailLog);
pushBatLog(['no'=>$this->generalId], $this->generalBattleDetailLog);
$this->generalBattleDetailLog = [];
}
+5 -4
View File
@@ -26,6 +26,7 @@ class WarUnit{
protected $warPowerMultiply = 1.0;
protected $activatedSkill = [];
protected $isFinished = false;
private function __construct(){
}
@@ -72,10 +73,10 @@ class WarUnit{
function increaseVarWithLimit(string $key, $value, $min = null, $max = null){
$targetValue = $this->raw[$key] + $value;
if($min !== null && $targetValue < $min){
$value = $min;
$targetValue = $min;
}
if($max !== null && $targetValue > $max){
$value = $max;
$targetValue = $max;
}
$this->updateVar($key, $targetValue);
}
@@ -92,10 +93,10 @@ class WarUnit{
function multiplyVarWithLimit(string $key, $value, $min = null, $max = null){
$targetValue = $this->raw[$key] * $value;
if($min !== null && $targetValue < $min){
$value = $min;
$targetValue = $min;
}
if($max !== null && $targetValue > $max){
$value = $max;
$targetValue = $max;
}
$this->updateVar($key, $targetValue);
}
+6 -1
View File
@@ -85,7 +85,12 @@ class WarUnitCity extends WarUnit{
}
function finishBattle(){
$this->updateVar('def', Util::round($this->hp / 10));
if($this->isFinished){
return;
}
$this->isFinished = true;
$this->updateVar('def', Util::round($this->getHP() / 10));
$this->updateVar('wall', Util::round($this->getVar('wall')));
//NOTE: 전투로 인한 사망자는 여기서 처리하지 않음
+7 -2
View File
@@ -556,7 +556,7 @@ class WarUnitGeneral extends WarUnit{
//계략
if($crewType->magicCoef){
$magicRatio = getGeneralIntel($general, true, true, true, false) / 100;
$magicRatio = getGeneralIntel($this->raw, true, true, true, false) / 100;
$magicRatio *= $crewType->magicCoef;
if($specialWar == 41){
@@ -931,7 +931,12 @@ class WarUnitGeneral extends WarUnit{
return $result;
}
function finishBattle(){
function finishBattle(){
if($this->isFinished){
return;
}
$this->isFinished = true;
$this->increaseVar('killcrew', $this->killed);
$this->increaseVar('deathcrew', $this->dead);