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