수극을 통한 저격 예시
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
namespace sammo\WarInitTrigger;
|
||||
use sammo\BaseWarUnitTrigger;
|
||||
use sammo\WarUnitGeneral;
|
||||
use sammo\WarUnitCity;
|
||||
use sammo\WarUnit;
|
||||
use sammo\GameUnitDetail;
|
||||
use sammo\Util;
|
||||
|
||||
class che_저격발동 extends BaseWarUnitTrigger{
|
||||
static protected $priority = 20000;
|
||||
|
||||
protected function actionWar(WarUnit $self, WarUnit $oppose, array &$selfEnv, array &$opposeEnv):void{
|
||||
if(!$oppose->hasActivatedSkill('저격')){
|
||||
return;
|
||||
}
|
||||
|
||||
if($selfEnv['저격발동']){
|
||||
return;
|
||||
}
|
||||
$selfEnv['저격발동'] = true;
|
||||
|
||||
$general = $self->general;
|
||||
|
||||
$oppose->getLogger()->pushGeneralActionLog("상대를 <C>저격</>했다!", ActionLogger::PLAIN);
|
||||
$oppose->getLogger()->pushGeneralBattleDetailLog("상대를 <C>저격</>했다!", ActionLogger::PLAIN);
|
||||
$self->getLogger()->pushGeneralActionLog("상대에게 <R>저격</>당했다!", ActionLogger::PLAIN);
|
||||
$self->getLogger()->pushGeneralBattleDetailLog("상대에게 <R>저격</>당했다!", ActionLogger::PLAIN);
|
||||
|
||||
$general->increaseVarWithLimit('injury', Util::randRangeInt($opposeEnv['woundMin'], $opposeEnv['woundMax']), null, 80);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
namespace sammo\WarInitTrigger;
|
||||
use sammo\BaseWarUnitTrigger;
|
||||
use sammo\WarUnitGeneral;
|
||||
use sammo\WarUnitCity;
|
||||
use sammo\WarUnit;
|
||||
use sammo\GameUnitDetail;
|
||||
|
||||
class che_저격시도 extends BaseWarUnitTrigger{
|
||||
static protected $priority = 20000;
|
||||
|
||||
protected $woundMin;
|
||||
protected $woundMax;
|
||||
|
||||
public function __construct(WarUnit $unit, int $raiseType, float $woundMin, float $woundMax){
|
||||
$this->object = $unit;
|
||||
$this->raiseType = $raiseType;
|
||||
}
|
||||
|
||||
protected function actionWar(WarUnit $self, WarUnit $oppose, array &$selfEnv, array &$opposeEnv):void{
|
||||
assert($self instanceof WarUnitGeneral, 'General만 발동 가능');
|
||||
if(!$oppose instanceof WarUnitGeneral){
|
||||
return;
|
||||
}
|
||||
if($self->hasActivatedSkill('저격')){
|
||||
return;
|
||||
}
|
||||
if($self->hasActivatedSkill('저격불가')){
|
||||
return;
|
||||
}
|
||||
if(!Util::randBool(1/5)){
|
||||
return;
|
||||
}
|
||||
|
||||
$this->activateSkill('저격');
|
||||
$selfEnv['woundMin'] = $this->woundMin;
|
||||
$selfEnv['woundMax'] = $this->woundMax;
|
||||
|
||||
if(!($this->raiseType & static::TYPE_ITEM)){
|
||||
return;
|
||||
}
|
||||
|
||||
$self->activateSkill('아이템사용');
|
||||
$item = $self->getGeneral()->getItem();
|
||||
$itemName = $item->getName();
|
||||
$self->activateSkill($itemName);
|
||||
|
||||
if (!($this->raiseType & static::TYPE_CONSUMABLE_ITEM)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$self->activateSkill('아이템소모');
|
||||
$josaUl = JosaUtil::pick($itemName, '을');
|
||||
$self->getLogger()->pushGeneralActionLog("<C>{$itemName}</>{$josaUl} 사용!", ActionLogger::PLAIN);
|
||||
$self->general->deleteItem();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user