game: 궁병에 '선제 사격' 추가

- 공격 시, 상대의 공격력을 1/2로 약화
- 수비 시, '선제 공격' 수행
   - 필살, 계략이 없는 일반 평타 공격
   - 공격자의 총 페이즈는 유지
This commit is contained in:
2022-04-12 21:42:54 +09:00
parent 3eee7795dc
commit d9743eadb1
2 changed files with 58 additions and 6 deletions
@@ -0,0 +1,52 @@
<?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;
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('특수', '선제');
if (!$self->isAttacker()) {
$self->addPhase(-1);
$oppose->addPhase(-1);
if ($oppose->getCrewType()->armType == GameUnitConst::T_ARCHER) {
$oppose->multiplyWarPowerMultiply(0.5);
} else {
$oppose->multiplyWarPowerMultiply(0);
$self->activateSkill('회피불가', '필살불가', '계략불가');
$oppose->activateSkill('회피불가', '계략불가');
}
} else {
$oppose->multiplyWarPowerMultiply(0.5);
}
$oppose->getLogger()->pushGeneralBattleDetailLog('상대에게 <R>선제 사격</>을 받았다!</>', ActionLogger::PLAIN);
$self->getLogger()->pushGeneralBattleDetailLog('상대에게 <C>선제 사격</>을 했다!</>', ActionLogger::PLAIN);
return true;
}
}