From 8c163515db0b880388f886e588f01aedbb879b9a Mon Sep 17 00:00:00 2001 From: hide_d Date: Mon, 13 May 2019 02:44:01 +0900 Subject: [PATCH] =?UTF-8?q?=EC=95=84=EC=9D=B4=ED=85=9C=20=EC=A0=84?= =?UTF-8?q?=EB=9F=89=20=EA=B5=AC=ED=98=84,=20=EB=A7=90,=20=EB=AC=B4?= =?UTF-8?q?=EA=B8=B0,=20=EC=B1=85=20=EC=A4=80=EB=B9=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/func_converter.php | 36 ++++------- hwe/sammo/ActionItem/che_Dummy.php | 2 +- hwe/sammo/ActionItem/che_사기_두강주.php | 20 +++++++ hwe/sammo/ActionItem/che_사기_보령압주.php | 20 +++++++ hwe/sammo/ActionItem/che_사기_의적주.php | 20 +++++++ hwe/sammo/ActionItem/che_사기_초선화.php | 20 +++++++ hwe/sammo/ActionItem/che_사기_춘화첩.php | 20 +++++++ hwe/sammo/ActionItem/che_사기_탁주.php | 20 +++++++ hwe/sammo/ActionItem/che_저격_수극.php | 3 +- hwe/sammo/ActionItem/che_회피_둔갑천서.php | 2 +- hwe/sammo/ActionItem/che_회피_태평요술.php | 2 +- hwe/sammo/ActionItem/che_훈련_과실주.php | 20 +++++++ hwe/sammo/ActionItem/che_훈련_단결도.php | 20 +++++++ hwe/sammo/ActionItem/che_훈련_이강주.php | 20 +++++++ hwe/sammo/ActionItem/che_훈련_철벽서.php | 20 +++++++ hwe/sammo/ActionItem/che_훈련_청주.php | 19 ++++++ hwe/sammo/ActionSpecialWar/che_궁병.php | 2 +- hwe/sammo/ActionSpecialWar/che_돌격.php | 2 +- hwe/sammo/ActionSpecialWar/che_필살.php | 2 +- hwe/sammo/General.php | 12 ++-- hwe/sammo/WarUnitGeneral.php | 26 +++++--- hwe/sammo/WarUnitTrigger/che_부상무효.php | 20 +++++++ hwe/sammo/WarUnitTrigger/che_성벽부상무효.php | 2 +- hwe/sammo/WarUnitTrigger/능력치변경.php | 60 +++++++++++++++++++ 24 files changed, 340 insertions(+), 50 deletions(-) create mode 100644 hwe/sammo/ActionItem/che_사기_두강주.php create mode 100644 hwe/sammo/ActionItem/che_사기_보령압주.php create mode 100644 hwe/sammo/ActionItem/che_사기_의적주.php create mode 100644 hwe/sammo/ActionItem/che_사기_초선화.php create mode 100644 hwe/sammo/ActionItem/che_사기_춘화첩.php create mode 100644 hwe/sammo/ActionItem/che_사기_탁주.php create mode 100644 hwe/sammo/ActionItem/che_훈련_과실주.php create mode 100644 hwe/sammo/ActionItem/che_훈련_단결도.php create mode 100644 hwe/sammo/ActionItem/che_훈련_이강주.php create mode 100644 hwe/sammo/ActionItem/che_훈련_철벽서.php create mode 100644 hwe/sammo/ActionItem/che_훈련_청주.php create mode 100644 hwe/sammo/WarUnitTrigger/che_부상무효.php create mode 100644 hwe/sammo/WarUnitTrigger/능력치변경.php diff --git a/hwe/func_converter.php b/hwe/func_converter.php index 16b78056..9187a908 100644 --- a/hwe/func_converter.php +++ b/hwe/func_converter.php @@ -272,41 +272,25 @@ function getPersonalityClass(?string $type){ throw new \InvalidArgumentException("{$type}은 올바른 성격 클래스가 아님"); } -function getItemClass(int $itemCode){ - //XXX: 임시 구현임 - - //iAction이 필요한 것만 반환 - - static $basePath = __NAMESPACE__.'\\ActionItem\\'; - - $itemPath = [ - 1=>'che_환약_치료', - 5=>'che_이추_계략', - 6=>'che_향낭_계략', - - 7=>'che_오석산_치료', - 8=>'che_무후행군_치료', - 9=>'che_도소연명_치료', - 10=>'che_칠엽청점_치료', - 11=>'che_정력견혈_치료', - 21=>'che_육도_계략', - 22=>'che_삼략_계략', - 23=>'che_청낭서_의술', - 24=>'che_태평청령_의술', - ]; - - $itemClass = $itemPath[$itemCode]??null; +function getItemClass(?string $itemClass){ if($itemClass === null){ return null; } + static $basePath = __NAMESPACE__.'\\ActionItem\\'; + $classPath = ($basePath.$itemClass); if(class_exists($classPath)){ return $classPath; } - throw new \InvalidArgumentException("{$itemCode}, {$itemClass}는 올바른 성격 클래스가 아님"); + throw new \InvalidArgumentException("{$itemClass}는 올바른 성격 클래스가 아님"); +} + +function buildItemClass(?string $itemClass):BaseItem{ + $class = getGeneralCommandClass($itemClass); + return new $class(); } function getGeneralSpecialDomesticClass(?string $type){ @@ -894,7 +878,7 @@ function getItemName($item) : ?string { return $itemname; } -function getItemInfo(?int $item):?string{ +function getItemInfo(?int $item):?array{ $itemInfo = [ 1=>['환약(치료)', '[군사] 턴 실행 전 부상 회복. 1회용'], 2=>['수극(저격)', '[전투] 전투 개시 전 20% 확률로 저격 시도. 1회용'], diff --git a/hwe/sammo/ActionItem/che_Dummy.php b/hwe/sammo/ActionItem/che_Dummy.php index c07dd405..e3e4b527 100644 --- a/hwe/sammo/ActionItem/che_Dummy.php +++ b/hwe/sammo/ActionItem/che_Dummy.php @@ -34,7 +34,7 @@ class che_Dummy extends \sammo\BaseItem{ public function __construct(int $itemCode) { - $this->_id = $itemCode = true; + $this->_id = $itemCode; [$this->_name, $this->_info] = getItemInfo($itemCode); $this->_cost = getItemCost2($itemCode); $this->_consumable = isConsumable($itemCode); diff --git a/hwe/sammo/ActionItem/che_사기_두강주.php b/hwe/sammo/ActionItem/che_사기_두강주.php new file mode 100644 index 00000000..eacab650 --- /dev/null +++ b/hwe/sammo/ActionItem/che_사기_두강주.php @@ -0,0 +1,20 @@ +personalityObj = new $personalityClass; - $itemClass = getItemClass($raw['item']); - if($itemClass !== null){ - $this->itemObjs['item'] = new $itemClass; - } - else{ - $this->itemObjs['item'] = new ActionItem\che_Dummy($raw['item']); - } - //TODO: $specialItemClass 설정 + $this->itemObjs['horse'] = buildItemClass($raw['horse']); + $this->itemObjs['weapon'] = buildItemClass($raw['weap']); + $this->itemObjs['book'] = buildItemClass($raw['book']); + $this->itemObjs['item'] = buildItemClass($raw['item']); } function initLogger(int $year, int $month){ diff --git a/hwe/sammo/WarUnitGeneral.php b/hwe/sammo/WarUnitGeneral.php index fca51213..08220ccc 100644 --- a/hwe/sammo/WarUnitGeneral.php +++ b/hwe/sammo/WarUnitGeneral.php @@ -204,14 +204,28 @@ class WarUnitGeneral extends WarUnit{ return [$warPower,$opposeWarPowerMultiply]; } - ///전투 개시 시에 작동하여 1회에만 작동하는 아이템 + ///전투 개시 시에 작동하여 1회에만 작동하는 아이템, 자체적인 Consumable을 처리하지 않는 경우에만 function useBattleInitItem():bool{ - $item = $this->getItem(); + $general = $this->getGeneral(); + $item = $general->getItem(); - if($item == 0){ + if($item === null){ return false; } + if(!$item->isConsumable()){ + return false; + } + + if(!$item->isValidTurnItem('Battle', 'NonHandledConsumable')){ + return false; + } + + $itemName = $item->getName(); + $josaUl = JosaUtil::pick($itemName, '을'); + $this->getLogger()->pushGeneralActionLog("{$itemName}{$josaUl} 사용!", ActionLogger::PLAIN); + return true; + $itemActivated = false; $itemConsumed = false; $itemName = getItemName($item); @@ -250,11 +264,7 @@ class WarUnitGeneral extends WarUnit{ $itemActivated = true; } - if($itemConsumed){ - $general->updateVar('item', 0); - $josaUl = JosaUtil::pick($itemName, '을'); - $this->getLogger()->pushGeneralActionLog("{$itemName}{$josaUl} 사용!", ActionLogger::PLAIN); - } + return $itemActivated; } diff --git a/hwe/sammo/WarUnitTrigger/che_부상무효.php b/hwe/sammo/WarUnitTrigger/che_부상무효.php new file mode 100644 index 00000000..ea1475bd --- /dev/null +++ b/hwe/sammo/WarUnitTrigger/che_부상무효.php @@ -0,0 +1,20 @@ +activateSkill('저격불가'); + $self->activateSkill('부상무효'); + + return true; + } +} \ No newline at end of file diff --git a/hwe/sammo/WarUnitTrigger/che_성벽부상무효.php b/hwe/sammo/WarUnitTrigger/che_성벽부상무효.php index ad3cf65c..2a93c8b6 100644 --- a/hwe/sammo/WarUnitTrigger/che_성벽부상무효.php +++ b/hwe/sammo/WarUnitTrigger/che_성벽부상무효.php @@ -8,7 +8,7 @@ use sammo\GameUnitDetail; use sammo\ObjectTrigger; class che_성벽부상무효 extends BaseWarUnitTrigger{ - static protected $priority = ObjectTrigger::PRIORITY_BEGIN; + static protected $priority = ObjectTrigger::PRIORITY_BEGIN + 100; protected function actionWar(WarUnit $self, WarUnit $oppose, array &$selfEnv, array &$opposeEnv):bool{ assert($self instanceof WarUnitGeneral, 'General만 발동 가능'); diff --git a/hwe/sammo/WarUnitTrigger/능력치변경.php b/hwe/sammo/WarUnitTrigger/능력치변경.php new file mode 100644 index 00000000..1dc461bb --- /dev/null +++ b/hwe/sammo/WarUnitTrigger/능력치변경.php @@ -0,0 +1,60 @@ +object = $unit; + $this->raiseType = $raiseType; + $this->variable = $variable; + $this->operator = $operator; + $this->value = $value; + $this->limitMin = $limitMin; + $this->limitMax = $limitMax; + + if(!in_array($this->operator, ['=', '+', '-', '*', '/'])){ + throw new \InvalidArgumentException("올바르지 않은 operator : {$operator}"); + } + } + + protected function actionWar(WarUnit $self, WarUnit $oppose, array &$selfEnv, array &$opposeEnv):bool{ + assert($self instanceof WarUnitGeneral, 'General만 발동 가능'); + $general = $self->getGeneral(); + if($this->operator === '='){ + $general->setVar($this->variable, $this->value); + } + else if($this->operator === '+'){ + $general->increaseVarWithLimit($this->variable, $this->value, $this->limitMin, $this->limitMax); + } + else if($this->operator === '-'){ + $general->increaseVarWithLimit($this->variable, -$this->value, $this->limitMin, $this->limitMax); + } + else if($this->operator === '*'){ + $general->multiplyVarWithLimit($this->variable, $this->value, $this->limitMin, $this->limitMax); + } + else if($this->operator === '/'){ + $general->multiplyVarWithLimit($this->variable, 1/$this->value, $this->limitMin, $this->limitMax); + } + else{ + throw new \sammo\MustNotBeReachedException(); + } + + $this->processConsumableItem(); + + return true; + } +} \ No newline at end of file