From 537416190e72b141bce7edeec3541e1427e617ac Mon Sep 17 00:00:00 2001 From: hide_d Date: Sat, 18 Aug 2018 21:24:02 +0900 Subject: [PATCH] =?UTF-8?q?=EC=A0=84=ED=88=AC=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/process_war.ng.php | 14 ++++++++++++-- hwe/sammo/WarUnitCity.php | 8 +++----- hwe/sammo/WarUnitGeneral.php | 33 +++++++++++++++++++++++++++++---- 3 files changed, 44 insertions(+), 11 deletions(-) diff --git a/hwe/process_war.ng.php b/hwe/process_war.ng.php index a6c97e0a..1c17488d 100644 --- a/hwe/process_war.ng.php +++ b/hwe/process_war.ng.php @@ -145,7 +145,12 @@ function processWar_NG( $josaYi = JosaUtil::pick($attacker->getCrewTypeName(), '이'); $logger->pushGlobalActionLog("{$attacker->getName()}의 {$attacker->getCrewTypeName()}{$josaYi} 퇴각했습니다."); - $attacker->getLogger()->pushGeneralActionLog("퇴각했습니다.", ActionLogger::PLAIN); + if($noRice){ + $attacker->getLogger()->pushGeneralActionLog("군량 부족으로 퇴각합니다.", ActionLogger::PLAIN); + } + else{ + $attacker->getLogger()->pushGeneralActionLog("퇴각했습니다.", ActionLogger::PLAIN); + } $defender->getLogger()->pushGeneralActionLog("{$attacker->getName()}의 {$attacker->getCrewTypeName()}{$josaYi} 퇴각했습니다.", ActionLogger::PLAIN); break; @@ -167,7 +172,12 @@ function processWar_NG( $josaYi = JosaUtil::pick($defender->getCrewTypeName(), '이'); $logger->pushGlobalActionLog("{$defender->getName()}의 {$defender->getCrewTypeName()}{$josaYi} 퇴각했습니다."); $attacker->getLogger()->pushGeneralActionLog("{$defender->getName()}의 {$defender->getCrewTypeName()}{$josaYi} 퇴각했습니다.", ActionLogger::PLAIN); - $defender->getLogger()->pushGeneralActionLog("퇴각했습니다.", ActionLogger::PLAIN); + if($noRice){ + $defender->getLogger()->pushGeneralActionLog("군량 부족으로 퇴각합니다.", ActionLogger::PLAIN); + } + else{ + $defender->getLogger()->pushGeneralActionLog("퇴각했습니다.", ActionLogger::PLAIN); + } $defender->finishBattle(); $defender = ($getNextDefender)($defender, true); diff --git a/hwe/sammo/WarUnitCity.php b/hwe/sammo/WarUnitCity.php index cede1e95..3be1f524 100644 --- a/hwe/sammo/WarUnitCity.php +++ b/hwe/sammo/WarUnitCity.php @@ -44,8 +44,6 @@ class WarUnitCity extends WarUnit{ $warPower *= Util::randRange(0.9, 1.1); } - - function increaseKilled(int $damage):int{ $this->killed += $damage; return $this->killed; @@ -59,7 +57,8 @@ class WarUnitCity extends WarUnit{ $damage = min($damage, $this->hp); $this->dead += $damage; $this->hp -= $damage; - $this->trainAtmos -= $damage / 2; + $this->trainAtmos = max(0, $this->trainAtmos - $damage / 2); + return $this->hp; } function continueWar(&$noRice):bool{ @@ -79,8 +78,7 @@ class WarUnitCity extends WarUnit{ $this->raw['wall'] = Util::round($this->trainAtmos / 10); $this->updatedVar['wall'] = true; - $this->raw['dead'] += $this->dead; - $this->updatedVar['dead'] = true; + //NOTE: 전투로 인한 사망자는 여기서 처리하지 않음 $decWealth = $this->dead / 10; $this->raw['agri'] = max(0, Util::round($this->raw['agri'] - $decWealth)); diff --git a/hwe/sammo/WarUnitGeneral.php b/hwe/sammo/WarUnitGeneral.php index 0ea5456e..8daa7810 100644 --- a/hwe/sammo/WarUnitGeneral.php +++ b/hwe/sammo/WarUnitGeneral.php @@ -137,7 +137,6 @@ class WarUnitGeneral extends WarUnit{ $this->updatedVar['deathnum'] = true; $this->addStatExp(1); - //TODO: 1패 로그 추가 } @@ -324,13 +323,39 @@ class WarUnitGeneral extends WarUnit{ return $this->raw['crew']; } + function addDex(GameUnitDetail $crewType, float $exp){ + $armType = $crewType->armType; + + if($armType == GameUnitConst::T_CASTLE){ + $armType = GameUnitConst::T_SIEGE; + } + + if($armType < 0){ + return; + } + + if($armType == GameUnitConst::T_WIZARD) { + $exp *= 0.9; + } + else if($armType == GameUnitConst::T_SIEGE) { + $exp *= 0.9; + } + $exp *= ($this->getComputedTrain() + $this->getComputeAtmos()) / 200; + + $ntype = $armType*10; + $dexType = "dex{$ntype}"; + + $this->raw[$dexType] += $exp; + $this->updatedVar[$dexType] = true; + } + function decreaseHP(int $damage):int{ $damage = min($damage, $this->raw['crew']); $this->dead += $damage; $this->raw['crew'] -= $damage; - //TODO: 죽은 만큼 숙련도 변경 + return $this->raw['crew']; } @@ -367,7 +392,7 @@ class WarUnitGeneral extends WarUnit{ return false; } - $wound = max(80, $this->raw['injury'] + rand(10, 80)); + $wound = min(80, $this->raw['injury'] + Util::randRangeInt(10, 80)); if($wound < $this->raw['injury']){ return false; } @@ -384,7 +409,7 @@ class WarUnitGeneral extends WarUnit{ $noRice = false; return false; } - if($this->raw['rice'] <= 0){ + if($this->raw['rice'] <= $this->getHP() / 100){ $noRice = true; return false; }