fix: 궁병이 아닌 경우에도 '맞 선제'가 정상 작동하도록 수정

- 궁병선제사격을 선제사격시도, 선제사격발동으로 분리
- 맞선제의 기준을 궁병이 아니라 '선제'의 활성화 여부로 구분
This commit is contained in:
2023-01-28 03:09:44 +09:00
parent 8ae0323dcc
commit 95776cda5c
4 changed files with 94 additions and 7 deletions
@@ -12,6 +12,7 @@ use sammo\GameUnitDetail;
use sammo\Util;
use sammo\ObjectTrigger;
/** @deprecated che_선제사격시도, che_선제사격발동 으로 이전*/
class che_궁병선제사격 extends BaseWarUnitTrigger
{
protected $priority = ObjectTrigger::PRIORITY_BEGIN + 50;
@@ -0,0 +1,50 @@
<?php
namespace sammo\WarUnitTrigger;
use sammo\ActionLogger;
use sammo\BaseWarUnitTrigger;
use sammo\GameUnitConst;
use sammo\WarUnitGeneral;
use sammo\WarUnitCity;
use sammo\WarUnit;
use sammo\GameUnitDetail;
use sammo\Util;
use sammo\ObjectTrigger;
class che_선제사격발동 extends BaseWarUnitTrigger
{
protected $priority = ObjectTrigger::PRIORITY_BEGIN + 51;
protected function actionWar(WarUnit $self, WarUnit $oppose, array &$selfEnv, array &$opposeEnv): bool
{
assert($self instanceof WarUnitGeneral, 'General만 발동 가능');
if (!$self->hasActivatedSkill('선제')) {
return true;
}
if ($oppose->hasActivatedSkill('선제') && $oppose->isAttacker()){
//맞 선제라면 공격자가 처리
return true;
}
$self->addPhase(-1);
$oppose->addPhase(-1);
if ($oppose->hasActivatedSkill('선제')) {
$self->multiplyWarPowerMultiply(2/3);
$oppose->multiplyWarPowerMultiply(2/3);
$oppose->getLogger()->pushGeneralBattleDetailLog('서로 <C>선제 사격</>을 주고 받았다!</>', ActionLogger::PLAIN);
$self->getLogger()->pushGeneralBattleDetailLog('서로 <C>선제 사격</>을 주고 받았다!</>', ActionLogger::PLAIN);
return true;
}
$oppose->multiplyWarPowerMultiply(0);
$self->multiplyWarPowerMultiply(2/3);
$self->activateSkill('회피불가', '필살불가', '계략불가');
$oppose->activateSkill('회피불가', '필살불가', '격노불가', '계략불가');
$oppose->getLogger()->pushGeneralBattleDetailLog('상대에게 <R>선제 사격</>을 받았다!</>', ActionLogger::PLAIN);
$self->getLogger()->pushGeneralBattleDetailLog('상대에게 <C>선제 사격</>을 했다!</>', ActionLogger::PLAIN);
return true;
}
}
@@ -0,0 +1,36 @@
<?php
namespace sammo\WarUnitTrigger;
use sammo\ActionLogger;
use sammo\BaseWarUnitTrigger;
use sammo\GameUnitConst;
use sammo\WarUnitGeneral;
use sammo\WarUnitCity;
use sammo\WarUnit;
use sammo\GameUnitDetail;
use sammo\Util;
use sammo\ObjectTrigger;
class che_선제사격시도 extends BaseWarUnitTrigger
{
protected $priority = ObjectTrigger::PRIORITY_BEGIN + 50;
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 ($self->hasActivatedSkill('선제')) {
return true;
}
if ($self->hasActivatedSkillOnLog('선제')) {
return true;
}
$self->activateSkill('특수', '선제');
return true;
}
}