From 79d2b047211729f2c672ea953db04e498ef30eae Mon Sep 17 00:00:00 2001 From: hide_d Date: Sun, 19 Aug 2018 02:57:25 +0900 Subject: [PATCH] =?UTF-8?q?=EC=A0=84=ED=88=AC=20=EA=B5=AC=ED=98=84=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/sammo/GameUnitDetail.php | 2 +- hwe/sammo/WarUnit.php | 6 ++- hwe/sammo/WarUnitCity.php | 35 ++++++------- hwe/sammo/WarUnitGeneral.php | 99 +++++++++++++++++++++++++++++++----- 4 files changed, 106 insertions(+), 36 deletions(-) diff --git a/hwe/sammo/GameUnitDetail.php b/hwe/sammo/GameUnitDetail.php index 7761a54d..e0d8d901 100644 --- a/hwe/sammo/GameUnitDetail.php +++ b/hwe/sammo/GameUnitDetail.php @@ -156,7 +156,7 @@ class GameUnitDetail{ $ratio = max($mainstat - 65, 0); $ratio *= $coef; - return min(50, $ratio); + return min(50, $ratio) / 100; } public function isValid($ownCities, $ownRegions, $relativeYear, $tech){ diff --git a/hwe/sammo/WarUnit.php b/hwe/sammo/WarUnit.php index 648d27ab..69cd68e9 100644 --- a/hwe/sammo/WarUnit.php +++ b/hwe/sammo/WarUnit.php @@ -260,7 +260,11 @@ class WarUnit{ return GameConst::$maxAtmosByCommand; } - function getComputedAvoidRatio(){ + function getComputedCriticalRatio():float{ + return $this->getCrewType()->getCriticalRatio($this->getRaw()); + } + + function getComputedAvoidRatio():float{ return $this->getCrewType()->avoid / 100; } diff --git a/hwe/sammo/WarUnitCity.php b/hwe/sammo/WarUnitCity.php index 17550ddf..f62b6211 100644 --- a/hwe/sammo/WarUnitCity.php +++ b/hwe/sammo/WarUnitCity.php @@ -2,43 +2,33 @@ namespace sammo; class WarUnitCity extends WarUnit{ - protected $logger; - protected $crewType; - protected $hp; - protected $rice = 0; - public $cityRate; - - protected $updatedVar = []; - - protected $year; - protected $month; + protected $cityRate; function __construct($raw, $rawNation, $year, $month, $cityRate){ $this->raw = $raw; $this->rawNation = $rawNation; - $this->year = $year; - $this->month = $month; - $this->isAttacker = false; $this->cityRate = $cityRate; - $this->logger = new ActionLogger(0, $raw['nation'], $year, $month, false); - $this->crewType = GameUnitConst::byID($raw['crewtype']); - - $this->rice = $this->getNationVar('rice'); - + $this->logger = new ActionLogger( + 0, + $this->getVar('nation'), + $year, + $month, + false + ); $this->crewType = GameUnitConst::byID(GameUnitConst::T_CASTLE); $this->hp = $this->getVar('def') * 10; //수비자 보정 - if($raw['level'] == 1){ + if($this->getCityVar('level') == 1){ $this->trainBonus += 5; } - else if($raw['level'] == 3){ + else if($this->getCityVar('level') == 3){ $this->trainBonus += 5; } } @@ -47,6 +37,10 @@ class WarUnitCity extends WarUnit{ return $this->getVar('name'); } + function getCityVar(string $key){ + return $this->raw[$key]; + } + function calcDamage():int{ $warPower = $this->getWarPower(); $warPower *= Util::randRange(0.9, 1.1); @@ -94,6 +88,7 @@ class WarUnitCity extends WarUnit{ } function addLose(){ + //NOTE: 도시 정복은 외부에서 처리함 } function heavyDecreseWealth(){ diff --git a/hwe/sammo/WarUnitGeneral.php b/hwe/sammo/WarUnitGeneral.php index 42a94ead..82e301de 100644 --- a/hwe/sammo/WarUnitGeneral.php +++ b/hwe/sammo/WarUnitGeneral.php @@ -4,13 +4,6 @@ namespace sammo; class WarUnitGeneral extends WarUnit{ protected $rawCity; - protected $logger; - protected $crewType; - - protected $win = 0; - - protected $updatedVar = []; - function __construct($raw, $rawCity, $rawNation, $isAttacker, $year, $month){ setLeadershipBonus($raw, $rawNation['level']); @@ -107,17 +100,49 @@ class WarUnitGeneral extends WarUnit{ } function getComputedAtmos(){ - return GameConst::$maxAtmosByCommand; + $train = $this->getVar('atmos'); + $train += $this->trainBonus; + + return $train; } - function getComputedAvoidRatio(){ + function getComputedCriticalRatio():float{ + $critialRatio = $this->getCrewType()->getCriticalRatio($this->getRaw()); + + $specialWar = $this->getSpecialWar(); + $item = $this->getItem(); + + if($this->isAttacker && $specialWar == 61){ + $critialRatio += 0.1; + } + if($specialWar == 71){ + $critialRatio += 0.2; + } + return $critialRatio; + } + + function getComputedAvoidRatio():float{ + $specialWar = $this->getSpecialWar(); + $item = $this->getItem(); + $avoidRatio = $this->getCrewType()->avoid / 100; + $avoidRatio *= $this->getComputedTrain() / 100; + + //특기보정 : 궁병 + if($specialWar == 51){ + $avoidRatio += 0.2; + } + + //도구 보정 : 둔갑천서, 태평요술 + if($item == 26 || $item == 25){ + $avoidRatio += 0.2; + } + + return $avoidRatio; } function addWin(){ - $this->win += 1; $this->increaseVar('killnum', 1); - $this->multiplyVarWithLimit('atmos', 1.1, null, GameConst::$maxAtmosByWar); $this->addStatExp(1); @@ -425,15 +450,61 @@ class WarUnitGeneral extends WarUnit{ } function checkPreActiveSkill():bool{ - return false; + $activated = false; + + $oppose = $this->getOppose(); + $specialWar = $this->getSpecialWar(); + $item = $this->getItem(); + + return $activated; } function checkActiveSkill():bool{ - return false; + $activated = false; + + $oppose = $this->getOppose(); + $specialWar = $this->getSpecialWar(); + $item = $this->getItem(); + + return $activated; } function checkPostActiveSkill():bool{ - return false; + $activated = false; + + $oppose = $this->getOppose(); + $specialWar = $this->getSpecialWar(); + $item = $this->getItem(); + + if( + !$this->hasActivatedSkill('특수') && + Util::randBool($this->getComputedCriticalRatio()) + ){ + $this->activateSkill('특수'); + $this->activateSkill('필살'); + } + + + if( + !$this->hasActivatedSkill('특수') && + Util::randBool($this->getComputedAvoidRatio()) + ){ + $this->activateSkill('특수'); + $this->activateSkill('회피'); + } + + if( + $specialWar == 63 && + $this->getPhase() == 0 && + $this->getHP() >= 1000 && + $this->getComputedAtmos() >= 90 && + $this->getComputedTrain() >= 90 + ){ + $this->activateSkill('위압'); + $activated = true; + } + + return $activated; } function applyActiveSkill():bool{