저격 다시 세팅, 아이템 namespace 버그 수정, 전투치료(의술) 구현
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace sammo\ActionNationType;
|
||||
namespace sammo\ActionItem;
|
||||
use \sammo\iAction;
|
||||
use \sammo\General;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace sammo\ActionNationType;
|
||||
namespace sammo\ActionItem;
|
||||
use \sammo\iAction;
|
||||
use \sammo\General;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace sammo\ActionNationType;
|
||||
namespace sammo\ActionItem;
|
||||
use \sammo\iAction;
|
||||
use \sammo\General;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace sammo\ActionNationType;
|
||||
namespace sammo\ActionItem;
|
||||
use \sammo\iAction;
|
||||
use \sammo\General;
|
||||
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
<?php
|
||||
namespace sammo\ActionNationType;
|
||||
namespace sammo\ActionItem;
|
||||
use \sammo\iAction;
|
||||
use \sammo\General;
|
||||
use \sammo\GeneralTrigger;
|
||||
use \sammo\GeneralTriggerCaller;
|
||||
use sammo\WarUnitTrigger\che_전투치료발동;
|
||||
use sammo\WarUnitTrigger\che_전투치료시도;
|
||||
use sammo\BaseWarUnitTrigger;
|
||||
use sammo\WarUnitTriggerCaller;
|
||||
|
||||
class che_의술_청낭서 extends \sammo\BaseItem{
|
||||
|
||||
@@ -18,4 +22,13 @@ class che_의술_청낭서 extends \sammo\BaseItem{
|
||||
new GeneralTrigger\che_도시치료($general)
|
||||
]);
|
||||
}
|
||||
|
||||
public function getBattlePhaseSkillTriggerList(\sammo\WarUnit $unit): ?WarUnitTriggerCaller
|
||||
{
|
||||
return new WarUnitTriggerCaller([
|
||||
new che_전투치료시도($unit, BaseWarUnitTrigger::TYPE_ITEM),
|
||||
new che_전투치료발동($unit, BaseWarUnitTrigger::TYPE_ITEM)
|
||||
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace sammo\ActionNationType;
|
||||
namespace sammo\ActionItem;
|
||||
use \sammo\iAction;
|
||||
use \sammo\General;
|
||||
use \sammo\GeneralTrigger;
|
||||
@@ -18,4 +18,13 @@ class che_의술_태평청령 extends \sammo\BaseItem{
|
||||
new GeneralTrigger\che_도시치료($general)
|
||||
]);
|
||||
}
|
||||
|
||||
public function getBattlePhaseSkillTriggerList(\sammo\WarUnit $unit): ?WarUnitTriggerCaller
|
||||
{
|
||||
return new WarUnitTriggerCaller([
|
||||
new che_전투치료시도($unit, BaseWarUnitTrigger::TYPE_ITEM),
|
||||
new che_전투치료발동($unit, BaseWarUnitTrigger::TYPE_ITEM)
|
||||
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
<?php
|
||||
namespace sammo\ActionNationType;
|
||||
namespace sammo\ActionItem;
|
||||
use \sammo\iAction;
|
||||
use \sammo\General;
|
||||
use \sammo\WarUnitTriggerCaller;
|
||||
use \sammo\WarUnit;
|
||||
use \sammo\WarInitTrigger\che_저격시도;
|
||||
use \sammo\WarInitTrigger\che_저격발동;
|
||||
use \sammo\WarUnitTrigger\che_저격시도;
|
||||
use \sammo\WarUnitTrigger\che_저격발동;
|
||||
|
||||
class che_저격_수극 extends \sammo\BaseItem{
|
||||
|
||||
@@ -17,7 +17,7 @@ class che_저격_수극 extends \sammo\BaseItem{
|
||||
|
||||
public function getBattleInitSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
|
||||
return new WarUnitTriggerCaller([
|
||||
new che_저격시도($unit, che_저격시도::TYPE_CONSUMABLE_ITEM, 20, 40),
|
||||
new che_저격시도($unit, che_저격시도::TYPE_CONSUMABLE_ITEM, 0.2, 20, 40),
|
||||
new che_저격발동($unit)
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace sammo\ActionNationType;
|
||||
namespace sammo\ActionItem;
|
||||
use \sammo\iAction;
|
||||
use \sammo\General;
|
||||
use \sammo\GeneralTrigger;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace sammo\ActionNationType;
|
||||
namespace sammo\ActionItem;
|
||||
use \sammo\iAction;
|
||||
use \sammo\General;
|
||||
use \sammo\GeneralTrigger;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace sammo\ActionNationType;
|
||||
namespace sammo\ActionItem;
|
||||
use \sammo\iAction;
|
||||
use \sammo\General;
|
||||
use \sammo\GeneralTrigger;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace sammo\ActionNationType;
|
||||
namespace sammo\ActionItem;
|
||||
use \sammo\iAction;
|
||||
use \sammo\General;
|
||||
use \sammo\GeneralTrigger;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace sammo\ActionNationType;
|
||||
namespace sammo\ActionItem;
|
||||
use \sammo\iAction;
|
||||
use \sammo\General;
|
||||
use \sammo\GeneralTrigger;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace sammo\ActionNationType;
|
||||
namespace sammo\ActionItem;
|
||||
use \sammo\iAction;
|
||||
use \sammo\General;
|
||||
use \sammo\GeneralTrigger;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace sammo\ActionNationType;
|
||||
namespace sammo\ActionItem;
|
||||
use \sammo\iAction;
|
||||
use \sammo\General;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace sammo\ActionNationType;
|
||||
namespace sammo\ActionItem;
|
||||
use \sammo\iAction;
|
||||
use \sammo\General;
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ use \sammo\iAction;
|
||||
use \sammo\General;
|
||||
use \sammo\SpecialityConst;
|
||||
use \sammo\WarUnit;
|
||||
use sammo\WarUnitTriggerCaller;
|
||||
|
||||
class che_격노 implements iAction{
|
||||
use \sammo\DefaultAction;
|
||||
|
||||
@@ -4,6 +4,7 @@ use \sammo\iAction;
|
||||
use \sammo\General;
|
||||
use \sammo\SpecialityConst;
|
||||
use \sammo\WarUnit;
|
||||
use sammo\WarUnitTriggerCaller;
|
||||
|
||||
class che_견고 implements iAction{
|
||||
use \sammo\DefaultAction;
|
||||
|
||||
@@ -4,6 +4,7 @@ use \sammo\iAction;
|
||||
use \sammo\General;
|
||||
use \sammo\SpecialityConst;
|
||||
use \sammo\WarUnit;
|
||||
use sammo\WarUnitTriggerCaller;
|
||||
|
||||
class che_반계 implements iAction{
|
||||
use \sammo\DefaultAction;
|
||||
|
||||
@@ -4,6 +4,7 @@ use \sammo\iAction;
|
||||
use \sammo\General;
|
||||
use \sammo\SpecialityConst;
|
||||
use \sammo\WarUnit;
|
||||
use sammo\WarUnitTriggerCaller;
|
||||
|
||||
class che_위압 implements iAction{
|
||||
use \sammo\DefaultAction;
|
||||
|
||||
@@ -7,6 +7,9 @@ use \sammo\General;
|
||||
use \sammo\GeneralTrigger;
|
||||
use \sammo\GeneralTriggerCaller;
|
||||
use \sammo\WarUnit;
|
||||
use sammo\WarUnitTrigger\che_전투치료발동;
|
||||
use sammo\WarUnitTrigger\che_전투치료시도;
|
||||
use sammo\WarUnitTriggerCaller;
|
||||
|
||||
class che_의술 implements iAction{
|
||||
use \sammo\DefaultAction;
|
||||
@@ -28,4 +31,12 @@ class che_의술 implements iAction{
|
||||
new GeneralTrigger\che_도시치료($general)
|
||||
]);
|
||||
}
|
||||
|
||||
public function getBattlePhaseSkillTriggerList(\sammo\WarUnit $unit): ?WarUnitTriggerCaller
|
||||
{
|
||||
return new WarUnitTriggerCaller([
|
||||
new che_전투치료시도($unit),
|
||||
new che_전투치료발동($unit)
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,9 @@ use \sammo\iAction;
|
||||
use \sammo\General;
|
||||
use \sammo\SpecialityConst;
|
||||
use \sammo\WarUnit;
|
||||
use sammo\WarUnitTriggerCaller;
|
||||
use \sammo\WarUnitTrigger\che_저격시도;
|
||||
use \sammo\WarUnitTrigger\che_저격발동;
|
||||
|
||||
class che_저격 implements iAction{
|
||||
use \sammo\DefaultAction;
|
||||
@@ -19,4 +22,11 @@ class che_저격 implements iAction{
|
||||
SpecialityConst::STAT_POWER,
|
||||
SpecialityConst::STAT_INTEL
|
||||
];
|
||||
|
||||
public function getBattleInitSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
|
||||
return new WarUnitTriggerCaller([
|
||||
new che_저격시도($unit, che_저격시도::TYPE_NONE, 1/3, 20, 60),
|
||||
new che_저격발동($unit)
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -16,16 +16,6 @@ abstract class BaseWarUnitTrigger extends ObjectTrigger{
|
||||
}
|
||||
|
||||
public function action(?array $env=null, $arg=null):?array{
|
||||
/** @var WarUnitGeneral $attacker */
|
||||
/** @var WarUnit $defender */
|
||||
[$attacker, $defender] = $arg;
|
||||
|
||||
|
||||
/** @var WarUnit $self */
|
||||
$self = $this->object;
|
||||
$isAttacker = $self->isAttacker();
|
||||
$oppose = $isAttacker?$defender:$attacker;
|
||||
|
||||
if($env === null){
|
||||
$env = [];
|
||||
}
|
||||
@@ -36,16 +26,66 @@ abstract class BaseWarUnitTrigger extends ObjectTrigger{
|
||||
$env['e_defender'] = [];
|
||||
}
|
||||
|
||||
if($env['stopNextAction']??false){
|
||||
return $env;
|
||||
}
|
||||
|
||||
/** @var WarUnitGeneral $attacker */
|
||||
/** @var WarUnit $defender */
|
||||
[$attacker, $defender] = $arg;
|
||||
|
||||
/** @var WarUnit $self */
|
||||
$self = $this->object;
|
||||
$isAttacker = $self->isAttacker();
|
||||
$oppose = $isAttacker?$defender:$attacker;
|
||||
|
||||
$selfEnv = $isAttacker?$env['e_attacker']:$env['e_defender'];
|
||||
$opposeEnv = $isAttacker?$env['e_defender']:$env['e_attacker'];
|
||||
|
||||
$this->actionWar($self, $oppose, $selfEnv, $opposeEnv);
|
||||
$callNextAction = $this->actionWar($self, $oppose, $selfEnv, $opposeEnv);
|
||||
|
||||
$env['e_attacker'] = $isAttacker?$selfEnv:$opposeEnv;
|
||||
$env['e_defender'] = $isAttacker?$opposeEnv:$selfEnv;
|
||||
|
||||
if($callNextAction){
|
||||
$env['stopNextAction'] = true;
|
||||
}
|
||||
|
||||
return $env;
|
||||
}
|
||||
|
||||
abstract protected function actionWar(WarUnit $self, WarUnit $oppose, array &$selfEnv, array &$opposeEnv):void;
|
||||
|
||||
public function processConsumableItem():bool{
|
||||
if(!($this->raiseType & static::TYPE_ITEM)){
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @var WarUnit $self */
|
||||
$self = $this->object;
|
||||
|
||||
if($self->hasActivatedSkill('아이템사용')){
|
||||
return false;
|
||||
}
|
||||
|
||||
$self->activateSkill('아이템사용');
|
||||
$item = $self->getGeneral()->getItem();
|
||||
$itemName = $item->getName();
|
||||
$self->activateSkill($itemName);
|
||||
|
||||
if (!($this->raiseType & static::TYPE_CONSUMABLE_ITEM)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if($self->hasActivatedSkill('아이템소모')){
|
||||
return false;
|
||||
}
|
||||
|
||||
$self->activateSkill('아이템소모');
|
||||
$josaUl = JosaUtil::pick($itemName, '을');
|
||||
$self->getLogger()->pushGeneralActionLog("<C>{$itemName}</>{$josaUl} 사용!", ActionLogger::PLAIN);
|
||||
$self->general->deleteItem();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
<?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();
|
||||
}
|
||||
}
|
||||
@@ -90,6 +90,7 @@ class WarUnitGeneral extends WarUnit{
|
||||
$general = $this->general;
|
||||
$criticalRatio = $this->getCrewType()->getCriticalRatio($general);
|
||||
|
||||
/** @var float $criticalRatio */
|
||||
$criticalRatio = $general->onCalcStat($general, 'warCriticalRatio', $criticalRatio, ['isAttacker'=>$this->isAttacker]);
|
||||
return $criticalRatio;
|
||||
}
|
||||
@@ -100,6 +101,7 @@ class WarUnitGeneral extends WarUnit{
|
||||
$avoidRatio = $this->getCrewType()->avoid / 100;
|
||||
$avoidRatio *= $this->getComputedTrain() / 100;
|
||||
|
||||
/** @var float $avoidRatio */
|
||||
$avoidRatio = $general->onCalcStat($general, 'warAvoidRatio', $avoidRatio, ['isAttacker'=>$this->isAttacker]);
|
||||
|
||||
if($this->getOppose()->getCrewType()->armType == GameUnitConst::T_FOOTMAN){
|
||||
|
||||
@@ -1,22 +1,23 @@
|
||||
<?php
|
||||
namespace sammo\WarInitTrigger;
|
||||
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 = 20000;
|
||||
static protected $priority = ObjectTrigger::PRIORITY_POST + 100;
|
||||
|
||||
protected function actionWar(WarUnit $self, WarUnit $oppose, array &$selfEnv, array &$opposeEnv):void{
|
||||
protected function actionWar(WarUnit $self, WarUnit $oppose, array &$selfEnv, array &$opposeEnv):bool{
|
||||
if(!$oppose->hasActivatedSkill('저격')){
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
if($selfEnv['저격발동']){
|
||||
return;
|
||||
if($selfEnv['저격발동']??false){
|
||||
return true;
|
||||
}
|
||||
$selfEnv['저격발동'] = true;
|
||||
|
||||
@@ -28,5 +29,9 @@ class che_저격발동 extends BaseWarUnitTrigger{
|
||||
$self->getLogger()->pushGeneralBattleDetailLog("상대에게 <R>저격</>당했다!", ActionLogger::PLAIN);
|
||||
|
||||
$general->increaseVarWithLimit('injury', Util::randRangeInt($opposeEnv['woundMin'], $opposeEnv['woundMax']), null, 80);
|
||||
|
||||
$this->processConsumableItem();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
namespace sammo\WarUnitTrigger;
|
||||
use sammo\BaseWarUnitTrigger;
|
||||
use sammo\WarUnitGeneral;
|
||||
use sammo\WarUnitCity;
|
||||
use sammo\WarUnit;
|
||||
use sammo\GameUnitDetail;
|
||||
|
||||
class che_저격시도 extends BaseWarUnitTrigger{
|
||||
static protected $priority = ObjectTrigger::PRIORITY_PRE + 100;
|
||||
|
||||
protected $woundMin;
|
||||
protected $woundMax;
|
||||
protected $ratio;
|
||||
|
||||
public function __construct(WarUnit $unit, int $raiseType, float $ratio, float $woundMin, float $woundMax){
|
||||
$this->object = $unit;
|
||||
$this->raiseType = $raiseType;
|
||||
$this->ratio = $ratio;
|
||||
$this->woundMin = $woundMin;
|
||||
$this->woundMax = $woundMax;
|
||||
}
|
||||
|
||||
protected function actionWar(WarUnit $self, WarUnit $oppose, array &$selfEnv, array &$opposeEnv):bool{
|
||||
assert($self instanceof WarUnitGeneral, 'General만 발동 가능');
|
||||
if(!$oppose instanceof WarUnitGeneral){
|
||||
return true;
|
||||
}
|
||||
if($self->hasActivatedSkill('저격')){
|
||||
return true;
|
||||
}
|
||||
if($self->hasActivatedSkill('저격불가')){
|
||||
return true;
|
||||
}
|
||||
if(!Util::randBool($this->ratio)){
|
||||
return true;
|
||||
}
|
||||
|
||||
$this->activateSkill('저격');
|
||||
$selfEnv['woundMin'] = $this->woundMin;
|
||||
$selfEnv['woundMax'] = $this->woundMax;
|
||||
|
||||
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\Util;
|
||||
use sammo\ObjectTrigger;
|
||||
|
||||
class che_전투치료발동 extends BaseWarUnitTrigger{
|
||||
static protected $priority = ObjectTrigger::PRIORITY_POST + 200;
|
||||
|
||||
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("상대가 <C>치료</>했다!", ActionLogger::PLAIN);
|
||||
$self->getLogger()->pushGeneralBattleDetailLog("<C>치료</>했다!", ActionLogger::PLAIN);
|
||||
|
||||
$oppose->getGeneral()->multiplyWarPowerMultiply(1/1.5);
|
||||
|
||||
$this->processConsumableItem();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?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 + 200;
|
||||
|
||||
protected function actionWar(WarUnit $self, WarUnit $oppose, array &$selfEnv, array &$opposeEnv):bool{
|
||||
assert($self instanceof WarUnitGeneral, 'General만 발동 가능');
|
||||
if($self->hasActivatedSkill('치료')){
|
||||
return true;
|
||||
}
|
||||
if($self->hasActivatedSkill('치료불가')){
|
||||
return true;
|
||||
}
|
||||
if(!Util::randBool(1/5)){
|
||||
return true;
|
||||
}
|
||||
|
||||
$this->activateSkill('치료');
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user