전투 엔진 버그 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
+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);