From 63f3ac807c0c16a5f2f0fe2f5978a32eed7eac90 Mon Sep 17 00:00:00 2001 From: hide_d Date: Sun, 19 Aug 2018 03:45:43 +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/WarUnit.php | 12 ++++--- hwe/sammo/WarUnitGeneral.php | 68 +++++++++++++++++++++++++++++------- 2 files changed, 63 insertions(+), 17 deletions(-) diff --git a/hwe/sammo/WarUnit.php b/hwe/sammo/WarUnit.php index 69cd68e9..5351b0ab 100644 --- a/hwe/sammo/WarUnit.php +++ b/hwe/sammo/WarUnit.php @@ -310,12 +310,16 @@ class WarUnit{ return $this->activatedSkill[$skillName] ?? false; } - function activateSkill(string $skillName):bool{ - $this->activatedSkill[$skillName] = true; + function activateSkill(... $skillNames):bool{ + foreach($skillNames as $skillName){ + $this->activatedSkill[$skillName] = true; + } } - function deactivateSkill(string $skillName):bool{ - $this->activatedSkill[$skillName] = false; + function deactivateSkill(... $skillNames):bool{ + foreach($skillNames as $skillName){ + $this->activatedSkill[$skillName] = false; + } } function checkPreActiveSkill():bool{ diff --git a/hwe/sammo/WarUnitGeneral.php b/hwe/sammo/WarUnitGeneral.php index 2e204df3..13815027 100644 --- a/hwe/sammo/WarUnitGeneral.php +++ b/hwe/sammo/WarUnitGeneral.php @@ -474,17 +474,17 @@ class WarUnitGeneral extends WarUnit{ $oppose = $this->getOppose(); $specialWar = $this->getSpecialWar(); $item = $this->getItem(); + $crewType = $this->getCrewType(); if( !$this->hasActivatedSkill('특수') && !$this->isAttacker && - $this->getCrewTypeName() == '목우' + $crewType->name == '목우' ){ //XXX: 병종에 특수 스킬이 달려있도록 설정해야함 $ratio = $this->getComputedAtmos() + $this->getComputedTrain(); if(Util::randBool($ratio / 400)){ - $this->activateSkill('특수'); - $this->activateSkill('저지'); + $this->activateSkill('특수', '저지'); $activated = true; } } @@ -498,10 +498,10 @@ class WarUnitGeneral extends WarUnit{ $oppose = $this->getOppose(); $specialWar = $this->getSpecialWar(); $item = $this->getItem(); + $crewType = $this->getCrewType(); if ($specialWar == 60 && $oppose->hasActivatedSkill('저지')) { - $oppose->deactivateSkill('저지'); - $oppose->deactivateSkill('특수'); + $oppose->deactivateSkill('특수', '저지'); $activated = true; } @@ -509,22 +509,53 @@ class WarUnitGeneral extends WarUnit{ !$this->hasActivatedSkill('특수') && Util::randBool($this->getComputedCriticalRatio()) ){ - $this->activateSkill('특수'); - $this->activateSkill('필살'); + $this->activateSkill('특수', '필살'); $activated = true; } - if( !$this->hasActivatedSkill('특수') && Util::randBool($this->getComputedAvoidRatio()) ){ - $this->activateSkill('특수'); - $this->activateSkill('회피시도'); - $this->activateSkill('회피'); + $this->activateSkill('특수', '회피시도', '회피'); $activated = true; } + //계략 + if($crewType->magicCoef){ + $magicRatio = getGeneralIntel($general, true, true, true, false) / 100; + $magicRatio *= $crewType->magicCoef; + + if($specialWar == 41){ + $magicRatio += 0.2; + } + + if(Util::randBool($magicRatio)){ + $magicSuccessRatio = 0.3; + if($specialWar == 40){ + $magicSuccessRatio += 0.2; + } + if($specialWar == 41){ + $magicSuccessRatio += 0.2; + } + if($specialWar == 42){ + $magicSuccessRatio += 0.1; + } + if($specialWar == 44){ + $magicSuccessRatio += 1; + } + + $magic = Util::choiceRandom(['위보', '매복', '반목', '화계', '혼란']); + $this->activateSkill($magic); + if(Util::randBool($magicSuccessRatio)){ + $this->activateSkill('계략'); + } + else{ + $this->activateSkill('계략실패'); + } + } + } + return $activated; } @@ -534,6 +565,7 @@ class WarUnitGeneral extends WarUnit{ $oppose = $this->getOppose(); $specialWar = $this->getSpecialWar(); $item = $this->getItem(); + $crewType = $this->getCrewType(); if($specialWar == 73 && Util::randBool(0.2)){ $this->activateSkill('치료'); @@ -543,8 +575,7 @@ class WarUnitGeneral extends WarUnit{ if($specialWar == 74 && $oppose->hasActivatedSkill('필살')){ if($this->isAttacker){ if(Util::randBool(1/3)){ - $this->activateSkill('진노'); - $this->activateSkill('격노'); + $this->activateSkill('진노', '격노'); $activated = true; } else if(Util::randBool(1/4)){ @@ -590,6 +621,17 @@ class WarUnitGeneral extends WarUnit{ $activated = true; } + //계략 + if( + $specialWar == 45 && + $oppose->hasActivatedSkill('계략') && + Util::randBool(0.3) + ){ + $this->activateSkill('반계'); + $oppose->deactivateSkill('계략'); + $activated = true; + } + return $activated; }