From 5fc5adb14d8eea2c876b572e5ec5489a7012de98 Mon Sep 17 00:00:00 2001 From: hide_d Date: Sun, 20 Feb 2022 03:13:03 +0900 Subject: [PATCH] =?UTF-8?q?feat,game:=20=EC=A0=84=ED=88=AC=20=EC=A4=91=20?= =?UTF-8?q?=EC=95=BD=ED=83=88=20=EC=B6=94=EA=B0=80,=20=EC=95=BD=ED=83=88?= =?UTF-8?q?=20=EC=9C=A0=EB=8B=88=ED=81=AC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/sammo/ActionItem/che_약탈_옥벽.php | 24 +++++++++ hwe/sammo/WarUnitTrigger/che_약탈발동.php | 59 +++++++++++++++++++++++ hwe/sammo/WarUnitTrigger/che_약탈시도.php | 47 ++++++++++++++++++ 3 files changed, 130 insertions(+) create mode 100644 hwe/sammo/ActionItem/che_약탈_옥벽.php create mode 100644 hwe/sammo/WarUnitTrigger/che_약탈발동.php create mode 100644 hwe/sammo/WarUnitTrigger/che_약탈시도.php diff --git a/hwe/sammo/ActionItem/che_약탈_옥벽.php b/hwe/sammo/ActionItem/che_약탈_옥벽.php new file mode 100644 index 00000000..de7047bf --- /dev/null +++ b/hwe/sammo/ActionItem/che_약탈_옥벽.php @@ -0,0 +1,24 @@ +hasActivatedSkill('약탈')) { + return true; + } + + if ($selfEnv['약탈발동'] ?? false) { + return true; + } + $selfEnv['약탈발동'] = true; + + $general = $self->getGeneral(); + + if (!($oppose instanceof WarUnitGeneral)) { + return true; + } + + + $general->increaseVarWithLimit('atmos', $selfEnv['addAtmos'], 0, GameConst::$maxAtmosByWar); + + $opposeGeneral = $oppose->getGeneral(); + + $theftGold = $opposeGeneral->getVar('gold') * $selfEnv['theftRatio']; + $theftRice = $opposeGeneral->getVar('rice') * $selfEnv['theftRatio']; + + $opposeGeneral->increaseVarWithLimit('gold', -$theftGold, 0); + $opposeGeneral->increaseVarWithLimit('rice', -$theftRice, 0); + + $general->increaseVar('gold', $theftGold); + $general->increaseVar('rice', $theftRice); + + $self->getLogger()->pushGeneralActionLog("상대를 약탈했다!", ActionLogger::PLAIN); + $self->getLogger()->pushGeneralBattleDetailLog("상대에게서 금 {$theftGold}, 쌀 {$theftRice} 만큼을 약탈했다!", ActionLogger::PLAIN); + $oppose->getLogger()->pushGeneralActionLog("상대에게 약탈당했다!", ActionLogger::PLAIN); + $oppose->getLogger()->pushGeneralBattleDetailLog("상대에게 금 {$theftGold}, 쌀 {$theftRice} 만큼을 약탈당했다!", ActionLogger::PLAIN); + + $this->processConsumableItem(); + + return true; + } +} diff --git a/hwe/sammo/WarUnitTrigger/che_약탈시도.php b/hwe/sammo/WarUnitTrigger/che_약탈시도.php new file mode 100644 index 00000000..e22c6477 --- /dev/null +++ b/hwe/sammo/WarUnitTrigger/che_약탈시도.php @@ -0,0 +1,47 @@ +object = $unit; + $this->raiseType = $raiseType; + $this->ratio = $ratio; + $this->theftRatio = $theftRatio; + } + + protected function actionWar(WarUnit $self, WarUnit $oppose, array &$selfEnv, array &$opposeEnv):bool{ + assert($self instanceof WarUnitGeneral, 'General만 발동 가능'); + if($self->getPhase() !== 0 && $oppose->getPhase() !== 0){ + return true; + } + if(!($oppose instanceof WarUnitGeneral)){ + return true; + } + if($self->hasActivatedSkill('약탈')){ + return true; + } + if($self->hasActivatedSkill('약탈불가')){ + return true; + } + if(!Util::randBool($this->ratio)){ + return true; + } + + $self->activateSkill('약탈'); + $selfEnv['theftRatio'] = $this->theftRatio; + + return true; + } +} \ No newline at end of file