diff --git a/hwe/sammo/ActionSpecialWar/che_견고.php b/hwe/sammo/ActionSpecialWar/che_견고.php index 236d5e05..c2477b37 100644 --- a/hwe/sammo/ActionSpecialWar/che_견고.php +++ b/hwe/sammo/ActionSpecialWar/che_견고.php @@ -5,6 +5,8 @@ use \sammo\General; use \sammo\SpecialityConst; use \sammo\WarUnit; use sammo\WarUnitTriggerCaller; +use sammo\BaseWarUnitTrigger; +use sammo\WarUnitTrigger\WarActivateSkills; class che_견고 implements iAction{ use \sammo\DefaultAction; @@ -19,4 +21,10 @@ class che_견고 implements iAction{ SpecialityConst::STAT_LEADERSHIP, SpecialityConst::STAT_POWER ]; + + public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{ + return new WarUnitTriggerCaller([ + new WarActivateSkills($unit, BaseWarUnitTrigger::TYPE_NONE, false, '필살불가', '위압불가', '격노불가', '계략약화') + ]); + } } \ No newline at end of file diff --git a/hwe/sammo/ActionSpecialWar/che_귀병.php b/hwe/sammo/ActionSpecialWar/che_귀병.php index ea641e39..f00362b9 100644 --- a/hwe/sammo/ActionSpecialWar/che_귀병.php +++ b/hwe/sammo/ActionSpecialWar/che_귀병.php @@ -26,4 +26,11 @@ class che_귀병 implements iAction{ return $value; } + + public function onCalcStat(General $general, string $statName, $value, $aux=null){ + if($statName === 'warMagicSuccessProb'){ + return $value + 0.2; + } + return $value; + } } \ No newline at end of file diff --git a/hwe/sammo/ActionSpecialWar/che_돌격.php b/hwe/sammo/ActionSpecialWar/che_돌격.php index b9145faa..ce239478 100644 --- a/hwe/sammo/ActionSpecialWar/che_돌격.php +++ b/hwe/sammo/ActionSpecialWar/che_돌격.php @@ -32,4 +32,10 @@ class che_돌격 implements iAction{ } return [1, 1]; } + + public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{ + return new WarUnitTriggerCaller([ + new WarActivateSkills($unit, BaseWarUnitTrigger::TYPE_NONE, false, '회피불가') + ]); + } } \ No newline at end of file diff --git a/hwe/sammo/ActionSpecialWar/che_반계.php b/hwe/sammo/ActionSpecialWar/che_반계.php index f011189b..dbf371f5 100644 --- a/hwe/sammo/ActionSpecialWar/che_반계.php +++ b/hwe/sammo/ActionSpecialWar/che_반계.php @@ -5,6 +5,9 @@ use \sammo\General; use \sammo\SpecialityConst; use \sammo\WarUnit; use sammo\WarUnitTriggerCaller; +use \sammo\WarUnitTrigger\WarActivateSkills; +use \sammo\WarUnitTrigger\che_반목시도; +use \sammo\WarUnitTrigger\che_반목발동; class che_반계 implements iAction{ use \sammo\DefaultAction; @@ -18,4 +21,19 @@ class che_반계 implements iAction{ static $type = [ SpecialityConst::STAT_INTEL, ]; + + public function onCalcStat(General $general, string $statName, $value, $aux=null){ + if($statName === 'warMagicSuccessDamage' && $aux === '반목'){ + return $value + 0.4; + } + return $value; + } + + public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{ + return new WarUnitTriggerCaller([ + new WarActivateSkills($unit, BaseWarUnitTrigger::TYPE_NONE, false, '계략약화'), + new che_반목시도($unit), + new che_반목발동($unit) + ]); + } } \ No newline at end of file diff --git a/hwe/sammo/ActionSpecialWar/che_신산.php b/hwe/sammo/ActionSpecialWar/che_신산.php index aef68529..a176bd5e 100644 --- a/hwe/sammo/ActionSpecialWar/che_신산.php +++ b/hwe/sammo/ActionSpecialWar/che_신산.php @@ -25,4 +25,14 @@ class che_신산 implements iAction{ return $value; } + + public function onCalcStat(General $general, string $statName, $value, $aux=null){ + if($statName === 'warMagicTrialProb'){ + return $value + 0.2; + } + if($statName === 'warMagicSuccessProb'){ + return $value + 0.2; + } + return $value; + } } \ No newline at end of file diff --git a/hwe/sammo/ActionSpecialWar/che_신중.php b/hwe/sammo/ActionSpecialWar/che_신중.php index cb57742f..0c78359a 100644 --- a/hwe/sammo/ActionSpecialWar/che_신중.php +++ b/hwe/sammo/ActionSpecialWar/che_신중.php @@ -17,4 +17,11 @@ class che_신중 implements iAction{ static $type = [ SpecialityConst::STAT_INTEL, ]; + + public function onCalcStat(General $general, string $statName, $value, $aux=null){ + if($statName === 'warMagicSuccessProb'){ + return $value + 1; + } + return $value; + } } \ No newline at end of file diff --git a/hwe/sammo/ActionSpecialWar/che_위압.php b/hwe/sammo/ActionSpecialWar/che_위압.php index 52357451..94ceef33 100644 --- a/hwe/sammo/ActionSpecialWar/che_위압.php +++ b/hwe/sammo/ActionSpecialWar/che_위압.php @@ -5,6 +5,8 @@ use \sammo\General; use \sammo\SpecialityConst; use \sammo\WarUnit; use sammo\WarUnitTriggerCaller; +use \sammo\WarUnitTrigger\che_위압시도; +use \sammo\WarUnitTrigger\che_위압발동; class che_위압 implements iAction{ use \sammo\DefaultAction; @@ -19,4 +21,14 @@ class che_위압 implements iAction{ SpecialityConst::STAT_LEADERSHIP, SpecialityConst::STAT_POWER ]; + + public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{ + if($unit->getPhase() != 0){ + return null; + } + return new WarUnitTriggerCaller([ + new che_위압시도(), + new che_위압발동() + ]); + } } \ No newline at end of file diff --git a/hwe/sammo/ActionSpecialWar/che_집중.php b/hwe/sammo/ActionSpecialWar/che_집중.php index 2a0b5283..cad40621 100644 --- a/hwe/sammo/ActionSpecialWar/che_집중.php +++ b/hwe/sammo/ActionSpecialWar/che_집중.php @@ -17,4 +17,11 @@ class che_집중 implements iAction{ static $type = [ SpecialityConst::STAT_INTEL, ]; + + public function onCalcStat(General $general, string $statName, $value, $aux=null){ + if($statName === 'warMagicSuccessDamage'){ + return $value * 1.5; + } + return $value; + } } \ No newline at end of file diff --git a/hwe/sammo/ActionSpecialWar/che_징병.php b/hwe/sammo/ActionSpecialWar/che_징병.php index ec0772da..950dc67d 100644 --- a/hwe/sammo/ActionSpecialWar/che_징병.php +++ b/hwe/sammo/ActionSpecialWar/che_징병.php @@ -27,4 +27,11 @@ class che_징병 implements iAction{ return $value; } + + public function onCalcStat(General $general, string $statName, $value, $aux=null){ + if($statName === 'rawLeadership'){ + return $value *= 1.15; + } + return $value; + } } \ No newline at end of file diff --git a/hwe/sammo/ActionSpecialWar/che_환술.php b/hwe/sammo/ActionSpecialWar/che_환술.php index 11c8ff80..8c8eb826 100644 --- a/hwe/sammo/ActionSpecialWar/che_환술.php +++ b/hwe/sammo/ActionSpecialWar/che_환술.php @@ -17,4 +17,14 @@ class che_환술 implements iAction{ static $type = [ SpecialityConst::STAT_INTEL, ]; + + public function onCalcStat(General $general, string $statName, $value, $aux=null){ + if($statName === 'warMagicSuccessProb'){ + return $value + 0.1; + } + if($statName === 'warMagicSuccessDamage'){ + return $value * 1.3; + } + return $value; + } } \ No newline at end of file diff --git a/hwe/sammo/WarUnitTrigger/WarActivateSkills.php b/hwe/sammo/WarUnitTrigger/WarActivateSkills.php new file mode 100644 index 00000000..09ea65dd --- /dev/null +++ b/hwe/sammo/WarUnitTrigger/WarActivateSkills.php @@ -0,0 +1,34 @@ +object = $unit; + $this->raiseType = $raiseType; + $this->isSelf = $isSelf; + $this->activeSkills = $activeSkills; + } + + protected function actionWar(WarUnit $self, WarUnit $oppose, array &$selfEnv, array &$opposeEnv):bool{ + if($this->isSelf){ + $self->activateSkill(...$this->activeSkills); + } + else{ + $oppose->activateSkill(...$this->activeSkills); + } + + return true; + } +} \ No newline at end of file diff --git a/hwe/sammo/WarUnitTrigger/che_계략발동.php b/hwe/sammo/WarUnitTrigger/che_계략발동.php new file mode 100644 index 00000000..0df5b8a2 --- /dev/null +++ b/hwe/sammo/WarUnitTrigger/che_계략발동.php @@ -0,0 +1,38 @@ +hasActivatedSkill('계략')){ + return true; + } + + if($selfEnv['계략발동']??false){ + return true; + } + $selfEnv['계략발동'] = true; + + $general = $self->getGeneral(); + + [$magic, $damage] = $selfEnv['magic']; + + $damage = $general->onCalcStat($general, 'warMagicFailDamage', $damage, $magic); + $josaUl = \sammo\JosaUtil::pick($magic, '을'); + + $general->pushGeneralBattleDetailLog("{$magic}{$josaUl} 성공했다!", ActionLogger::PLAIN); + $oppose->getLogger()->pushGeneralBattleDetailLog("{$magic}에 당했다!", ActionLogger::PLAIN); + + $self->multiplyWarPowerMultiply($damage); + + return true; + } +} \ No newline at end of file diff --git a/hwe/sammo/WarUnitTrigger/che_계략시도.php b/hwe/sammo/WarUnitTrigger/che_계략시도.php new file mode 100644 index 00000000..5fec9b26 --- /dev/null +++ b/hwe/sammo/WarUnitTrigger/che_계략시도.php @@ -0,0 +1,77 @@ +[1.2, 1.1], + '매복'=>[1.4, 1.2], + '반목'=>[1.6, 1.3], + '화계'=>[1.8, 1.4], + '혼란'=>[2.0, 1.5] + ]; + static protected $tableToCity = [ + '급습'=>[1.2, 1.1], + '위보'=>[1.4, 1.2], + '혼란'=>[1.6, 1.3] + ]; + + protected function actionWar(WarUnit $self, WarUnit $oppose, array &$selfEnv, array &$opposeEnv):bool{ + assert($self instanceof WarUnitGeneral, 'General만 발동 가능'); + + $general = $self->getGeneral(); + $crewType = $general->getCrewTypeObj(); + + if($crewType->magicCoef <= 0){ + //NOTE: -인 경우를 고려해야하나? 계략 맞을 확률 증가? + return true; + } + + if($self->hasActivatedSkill('계략불가')){ + return true; + } + + $magicTrialProb = $general->getIntel(true, true, true, false) / 100; + $magicTrialProb *= $crewType->magicCoef; + + $magicTrialProb = $general->onCalcStat($general, 'warMagicTrialProb', $magicTrialProb); + + if(!Util::randBool($magicTrialProb)){ + return true; + } + + $magicSuccessProb = 0.7; + $magicSuccessProb = $general->onCalcStat($general, 'warMagicSuccessProb', $magicSuccessProb); + if($this->hasActivatedSkill('계략약화')){ + $magicSuccessProb -= 0.1; //NOTE: 앞으로 이건 oppose의 onCalcStat에 들어가야하지 않을까? + } + + if($oppose instanceof WarUnitCity){ + $magic = Util::choiceRandom(array_keys(static::$tableToCity)); + [$successDamage, $failDamage] = static::$tableToCity[$magic]; + } + else{ + $magic = Util::choiceRandom(array_keys(static::$tableToGeneral)); + [$successDamage, $failDamage] = static::$tableToGeneral[$magic]; + } + + $self->activateSkill('계략시도', $magic); + if(Util::randBool($magicSuccessProb)){ + $self->activateSkill('계략'); + $selfEnv['magic'] = [$magic, $successDamage]; + } + else{ + $self->activateSkill('계략실패'); + $selfEnv['magic'] = [$magic, $failDamage]; + } + + return true; + } +} \ No newline at end of file diff --git a/hwe/sammo/WarUnitTrigger/che_계략실패.php b/hwe/sammo/WarUnitTrigger/che_계략실패.php new file mode 100644 index 00000000..506e6e62 --- /dev/null +++ b/hwe/sammo/WarUnitTrigger/che_계략실패.php @@ -0,0 +1,39 @@ +hasActivatedSkill('계략실패')){ + return true; + } + + if($selfEnv['계략실패']??false){ + return true; + } + $selfEnv['계략실패'] = true; + + $general = $self->getGeneral(); + + [$magic, $damage] = $selfEnv['magic']; + + $damage = $general->onCalcStat($general, 'warMagicFailDamage', $damage, $magic); + $josaUl = \sammo\JosaUtil::pick($magic, '을'); + + $general->pushGeneralBattleDetailLog("{$magic}{$josaUl} 실패했다!", ActionLogger::PLAIN); + $oppose->getLogger()->pushGeneralBattleDetailLog("{$magic}{$josaUl} 간파했다!", ActionLogger::PLAIN); + + $self->multiplyWarPowerMultiply(1/$damage); + $oppose->multiplyWarPowerMultiply($damage); + + return true; + } +} \ No newline at end of file