전투 이벤트 갱신

This commit is contained in:
2019-06-05 01:36:57 +09:00
parent 7fd8bfbe4e
commit 44b9ba96c3
11 changed files with 214 additions and 4 deletions
@@ -0,0 +1,33 @@
<?php
namespace sammo\WarUnitTrigger;
use sammo\BaseWarUnitTrigger;
use sammo\WarUnitGeneral;
use sammo\WarUnitCity;
use sammo\WarUnit;
use sammo\GameUnitDetail;
use sammo\Util;
use sammo\ObjectTrigger;
class che_격노발동 extends BaseWarUnitTrigger{
static protected $priority = ObjectTrigger::PRIORITY_POST + 600;
protected function actionWar(WarUnit $self, WarUnit $oppose, array &$selfEnv, array &$opposeEnv):bool{
if(!$self->hasActivatedSkill('격노') && !$self->hasActivatedSkill('진노')){
return true;
}
$targetAct = $oppose->hasActivatedSkill('필살')?'필살 공격':'회피 시도';
$is진노 = $self->hasActivatedSkill('진노');
$reaction = $is진노?'진노':'격노';
$self->getLogger()->pushGeneralBattleDetailLog("상대의 {$targetAct}에 <C>{$reaction}</>했다!</>", ActionLogger::PLAIN);
$oppose->getLogger()->pushGeneralBattleDetailLog("{$targetAct}에 상대가 <R>{$reaction}</>했다!</>", ActionLogger::PLAIN);
if($is진노){
$self->bonusPhase += 1;
}
$self->multiplyWarPowerMultiply($self->criticalDamage());
return true;
}
}
@@ -8,7 +8,7 @@ use sammo\GameUnitDetail;
use sammo\ObjectTrigger;
class che_계략시도 extends BaseWarUnitTrigger{
static protected $priority = ObjectTrigger::PRIORITY_PRE + 300; //최 우선 순위
static protected $priority = ObjectTrigger::PRIORITY_PRE + 300;
static protected $tableToGeneral = [
'위보'=>[1.2, 1.1],
@@ -9,7 +9,7 @@ use sammo\Util;
use sammo\ObjectTrigger;
class che_계략실패 extends BaseWarUnitTrigger{
static protected $priority = ObjectTrigger::PRIORITY_POST + 300;
static protected $priority = ObjectTrigger::PRIORITY_POST + 200;
protected function actionWar(WarUnit $self, WarUnit $oppose, array &$selfEnv, array &$opposeEnv):bool{
if(!$self->hasActivatedSkill('계략실패')){
@@ -0,0 +1,33 @@
<?php
namespace sammo\WarUnitTrigger;
use sammo\BaseWarUnitTrigger;
use sammo\WarUnitGeneral;
use sammo\WarUnitCity;
use sammo\WarUnit;
use sammo\GameUnitDetail;
use sammo\Util;
use sammo\ObjectTrigger;
class che_계략발동 extends BaseWarUnitTrigger{
static protected $priority = ObjectTrigger::PRIORITY_POST + 150;
protected function actionWar(WarUnit $self, WarUnit $oppose, array &$selfEnv, array &$opposeEnv):bool{
if(!$self->hasActivatedSkill('반계')){
return true;
}
$general = $self->getGeneral();
[$opposeMagic, $damage] = $opposeEnv['magic'][0];
$josaUl = \sammo\JosaUtil::pick($opposeMagic, '을');
$general->pushGeneralBattleDetailLog("<C>반계</>로 상대의 <D>{$opposeMagic}</>{$josaUl} 되돌렸다!", ActionLogger::PLAIN);
$oppose->getLogger()->pushGeneralBattleDetailLog("<D>{$opposeMagic}</>{$josaUl} <R>역으로</> 당했다!", ActionLogger::PLAIN);
$self->multiplyWarPowerMultiply($damage);
return true;
}
}
@@ -0,0 +1,29 @@
<?php
namespace sammo\WarUnitTrigger;
use sammo\BaseWarUnitTrigger;
use sammo\WarUnitGeneral;
use sammo\WarUnitCity;
use sammo\WarUnit;
use sammo\GameUnitDetail;
use sammo\ObjectTrigger;
class che_반계시도 extends BaseWarUnitTrigger{
static protected $priority = ObjectTrigger::PRIORITY_BODY + 300;
protected function actionWar(WarUnit $self, WarUnit $oppose, array &$selfEnv, array &$opposeEnv):bool{
if(!$oppose->hasActivatedSkill('계략')){
return true;
}
if(!Util::randBool(0.4)){
return true;
}
assert(key_exists('magic', $opposeEnv));
$self->activateSkill('반계');
$oppose->deactivateSkill('계략');
return true;
}
}
@@ -0,0 +1,25 @@
<?php
namespace sammo\WarUnitTrigger;
use sammo\BaseWarUnitTrigger;
use sammo\WarUnitGeneral;
use sammo\WarUnitCity;
use sammo\WarUnit;
use sammo\GameUnitDetail;
use sammo\Util;
use sammo\ObjectTrigger;
class che_위압발동 extends BaseWarUnitTrigger{
static protected $priority = ObjectTrigger::PRIORITY_POST + 700;
protected function actionWar(WarUnit $self, WarUnit $oppose, array &$selfEnv, array &$opposeEnv):bool{
if(!$self->hasActivatedSkill('위압')){
return true;
}
$oppose->getLogger()->pushGeneralBattleDetailLog('상대에게 <R>위압</>받았다!</>', ActionLogger::PLAIN);
$self->getLogger()->pushGeneralBattleDetailLog('상대에게 <C>위압</>을 줬다!</>', ActionLogger::PLAIN);
$oppose->setWarPowerMultiply(0);
return true;
}
}
@@ -9,7 +9,7 @@ use sammo\Util;
use sammo\ObjectTrigger;
class che_전투치료발동 extends BaseWarUnitTrigger{
static protected $priority = ObjectTrigger::PRIORITY_POST + 200;
static protected $priority = ObjectTrigger::PRIORITY_POST + 300;
protected function actionWar(WarUnit $self, WarUnit $oppose, array &$selfEnv, array &$opposeEnv):bool{
if(!$self->hasActivatedSkill('치료')){
@@ -8,7 +8,7 @@ use sammo\GameUnitDetail;
use sammo\ObjectTrigger;
class che_전투치료시도 extends BaseWarUnitTrigger{
static protected $priority = ObjectTrigger::PRIORITY_PRE + 200;
static protected $priority = ObjectTrigger::PRIORITY_PRE + 300;
protected function actionWar(WarUnit $self, WarUnit $oppose, array &$selfEnv, array &$opposeEnv):bool{
assert($self instanceof WarUnitGeneral, 'General만 발동 가능');
@@ -0,0 +1,31 @@
<?php
namespace sammo\WarUnitTrigger;
use sammo\BaseWarUnitTrigger;
use sammo\WarUnitGeneral;
use sammo\WarUnitCity;
use sammo\WarUnit;
use sammo\GameUnitDetail;
use sammo\Util;
use sammo\ObjectTrigger;
class che_필살발동 extends BaseWarUnitTrigger{
static protected $priority = ObjectTrigger::PRIORITY_POST + 400;
protected function actionWar(WarUnit $self, WarUnit $oppose, array &$selfEnv, array &$opposeEnv):bool{
if(!$self->hasActivatedSkill('필살')){
return true;
}
if($selfEnv['필살발동']??false){
return true;
}
$selfEnv['필살발동'] = true;
$oppose->getLogger()->pushGeneralBattleDetailLog("상대의 <R>필살</>공격!</>", ActionLogger::PLAIN);
$self->getLogger()->pushGeneralBattleDetailLog("<C>필살</>공격!</>", ActionLogger::PLAIN);
$self->multiplyWarPowerMultiply($self->criticalDamage());
return true;
}
}
@@ -0,0 +1,33 @@
<?php
namespace sammo\WarUnitTrigger;
use sammo\BaseWarUnitTrigger;
use sammo\WarUnitGeneral;
use sammo\WarUnitCity;
use sammo\WarUnit;
use sammo\GameUnitDetail;
use sammo\ObjectTrigger;
class che_필살시도 extends BaseWarUnitTrigger{
static protected $priority = ObjectTrigger::PRIORITY_PRE + 100;
protected function actionWar(WarUnit $self, WarUnit $oppose, array &$selfEnv, array &$opposeEnv):bool{
if(!($self instanceof WarUnitGeneral)){
return true;
}
if($self->hasActivatedSkill('특수')){
return true;
}
if($self->hasActivatedSkill('필살불가')){
return true;
}
if(!Util::randBool($self->getComputedCriticalRatio())){
return true;
}
$this->activateSkill('특수', '필살시도', '필살');
return true;
}
}
@@ -0,0 +1,26 @@
<?php
namespace sammo\WarUnitTrigger;
use sammo\BaseWarUnitTrigger;
use sammo\WarUnitGeneral;
use sammo\WarUnitCity;
use sammo\WarUnit;
use sammo\GameUnitDetail;
use sammo\Util;
use sammo\ObjectTrigger;
class che_회피발동 extends BaseWarUnitTrigger{
static protected $priority = ObjectTrigger::PRIORITY_POST + 500;
protected function actionWar(WarUnit $self, WarUnit $oppose, array &$selfEnv, array &$opposeEnv):bool{
if(!$self->hasActivatedSkill('회피')){
return true;
}
$oppose->getLogger()->pushGeneralBattleDetailLog("상대가 <R>회피</>했다!</>", ActionLogger::PLAIN);
$self->getLogger()->pushGeneralBattleDetailLog("<C>회피</>했다!</>", ActionLogger::PLAIN);
$oppose->multiplyWarPowerMultiply(0.2);
return true;
}
}