WarUnitTrigger 개편, 병종 Trigger 개념 추가, 저지, 성벽부상무효

This commit is contained in:
2019-05-13 00:49:44 +09:00
parent b6e667a291
commit 7ce1e64ee8
13 changed files with 364 additions and 139 deletions
@@ -0,0 +1,23 @@
<?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_BEGIN;
protected function actionWar(WarUnit $self, WarUnit $oppose, array &$selfEnv, array &$opposeEnv):bool{
assert($self instanceof WarUnitGeneral, 'General만 발동 가능');
if(!$oppose instanceof WarUnitCity){
return true;
}
$self->activateSkill('부상무효');
return true;
}
}
@@ -5,6 +5,7 @@ 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;
@@ -0,0 +1,35 @@
<?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; //최우선 순위
protected function actionWar(WarUnit $self, WarUnit $oppose, array &$selfEnv, array &$opposeEnv):bool{
if(!$self->hasActivatedSkill('저지')){
return true;
}
if($selfEnv['저지발동']??false){
return true;
}
$selfEnv['저지발동'] = true;
$self->getLogger()->pushGeneralBattleDetailLog("상대를 <C>저지</>했다!", ActionLogger::PLAIN);
$oppose->getLogger()->pushGeneralBattleDetailLog("저지</>당했다!", ActionLogger::PLAIN);
$self->addDex($oppose->getCrewType(), $oppose->getWarPower() * 0.9);
$self->addDex($self->getCrewType(), $self->getWarPower() * 0.9);
$self->setWarPowerMultiply(0);
$oppose->setWarPowerMultiply(0);
return false; //저지는 모든 특수 이벤트를 중지시킨다.
}
}
@@ -0,0 +1,32 @@
<?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; //최 우선 순위
protected function actionWar(WarUnit $self, WarUnit $oppose, array &$selfEnv, array &$opposeEnv):bool{
assert($self instanceof WarUnitGeneral, 'General만 발동 가능');
if($self->isAttacker()){
return true;
}
if($self->hasActivatedSkill('특수')){
return true;
}
if($self->hasActivatedSkill('저지불가')){
return true;
}
$ratio = $self->getComputedAtmos() + $self->getComputedTrain();
if(Util::randBool($ratio / 400)){
$self->activateSkill('특수', '저지');
}
return true;
}
}