forked from devsam/core
전투 스킬 세팅 중
This commit is contained in:
@@ -5,6 +5,8 @@ use \sammo\General;
|
||||
use \sammo\SpecialityConst;
|
||||
use \sammo\WarUnit;
|
||||
use sammo\WarUnitTriggerCaller;
|
||||
use sammo\BaseWarUnitTrigger;
|
||||
use sammo\WarUnitTrigger\WarActivateSkills;
|
||||
|
||||
class che_견고 implements iAction{
|
||||
use \sammo\DefaultAction;
|
||||
@@ -19,4 +21,10 @@ class che_견고 implements iAction{
|
||||
SpecialityConst::STAT_LEADERSHIP,
|
||||
SpecialityConst::STAT_POWER
|
||||
];
|
||||
|
||||
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
|
||||
return new WarUnitTriggerCaller([
|
||||
new WarActivateSkills($unit, BaseWarUnitTrigger::TYPE_NONE, false, '필살불가', '위압불가', '격노불가', '계략약화')
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -26,4 +26,11 @@ class che_귀병 implements iAction{
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
public function onCalcStat(General $general, string $statName, $value, $aux=null){
|
||||
if($statName === 'warMagicSuccessProb'){
|
||||
return $value + 0.2;
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
@@ -32,4 +32,10 @@ class che_돌격 implements iAction{
|
||||
}
|
||||
return [1, 1];
|
||||
}
|
||||
|
||||
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
|
||||
return new WarUnitTriggerCaller([
|
||||
new WarActivateSkills($unit, BaseWarUnitTrigger::TYPE_NONE, false, '회피불가')
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,9 @@ use \sammo\General;
|
||||
use \sammo\SpecialityConst;
|
||||
use \sammo\WarUnit;
|
||||
use sammo\WarUnitTriggerCaller;
|
||||
use \sammo\WarUnitTrigger\WarActivateSkills;
|
||||
use \sammo\WarUnitTrigger\che_반목시도;
|
||||
use \sammo\WarUnitTrigger\che_반목발동;
|
||||
|
||||
class che_반계 implements iAction{
|
||||
use \sammo\DefaultAction;
|
||||
@@ -18,4 +21,19 @@ class che_반계 implements iAction{
|
||||
static $type = [
|
||||
SpecialityConst::STAT_INTEL,
|
||||
];
|
||||
|
||||
public function onCalcStat(General $general, string $statName, $value, $aux=null){
|
||||
if($statName === 'warMagicSuccessDamage' && $aux === '반목'){
|
||||
return $value + 0.4;
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
|
||||
return new WarUnitTriggerCaller([
|
||||
new WarActivateSkills($unit, BaseWarUnitTrigger::TYPE_NONE, false, '계략약화'),
|
||||
new che_반목시도($unit),
|
||||
new che_반목발동($unit)
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -25,4 +25,14 @@ class che_신산 implements iAction{
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
public function onCalcStat(General $general, string $statName, $value, $aux=null){
|
||||
if($statName === 'warMagicTrialProb'){
|
||||
return $value + 0.2;
|
||||
}
|
||||
if($statName === 'warMagicSuccessProb'){
|
||||
return $value + 0.2;
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
@@ -17,4 +17,11 @@ class che_신중 implements iAction{
|
||||
static $type = [
|
||||
SpecialityConst::STAT_INTEL,
|
||||
];
|
||||
|
||||
public function onCalcStat(General $general, string $statName, $value, $aux=null){
|
||||
if($statName === 'warMagicSuccessProb'){
|
||||
return $value + 1;
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,8 @@ 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 +21,14 @@ class che_위압 implements iAction{
|
||||
SpecialityConst::STAT_LEADERSHIP,
|
||||
SpecialityConst::STAT_POWER
|
||||
];
|
||||
|
||||
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
|
||||
if($unit->getPhase() != 0){
|
||||
return null;
|
||||
}
|
||||
return new WarUnitTriggerCaller([
|
||||
new che_위압시도(),
|
||||
new che_위압발동()
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -17,4 +17,11 @@ class che_집중 implements iAction{
|
||||
static $type = [
|
||||
SpecialityConst::STAT_INTEL,
|
||||
];
|
||||
|
||||
public function onCalcStat(General $general, string $statName, $value, $aux=null){
|
||||
if($statName === 'warMagicSuccessDamage'){
|
||||
return $value * 1.5;
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
@@ -27,4 +27,11 @@ class che_징병 implements iAction{
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
public function onCalcStat(General $general, string $statName, $value, $aux=null){
|
||||
if($statName === 'rawLeadership'){
|
||||
return $value *= 1.15;
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
@@ -17,4 +17,14 @@ class che_환술 implements iAction{
|
||||
static $type = [
|
||||
SpecialityConst::STAT_INTEL,
|
||||
];
|
||||
|
||||
public function onCalcStat(General $general, string $statName, $value, $aux=null){
|
||||
if($statName === 'warMagicSuccessProb'){
|
||||
return $value + 0.1;
|
||||
}
|
||||
if($statName === 'warMagicSuccessDamage'){
|
||||
return $value * 1.3;
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?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 WarActivateSkills extends BaseWarUnitTrigger{
|
||||
static protected $priority = ObjectTrigger::PRIORITY_INIT;
|
||||
|
||||
protected $isSelf;
|
||||
protected $activeSkills;
|
||||
|
||||
public function __construct(WarUnit $unit, int $raiseType, bool $isSelf, string ...$activeSkills){
|
||||
$this->object = $unit;
|
||||
$this->raiseType = $raiseType;
|
||||
$this->isSelf = $isSelf;
|
||||
$this->activeSkills = $activeSkills;
|
||||
}
|
||||
|
||||
protected function actionWar(WarUnit $self, WarUnit $oppose, array &$selfEnv, array &$opposeEnv):bool{
|
||||
if($this->isSelf){
|
||||
$self->activateSkill(...$this->activeSkills);
|
||||
}
|
||||
else{
|
||||
$oppose->activateSkill(...$this->activeSkills);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?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 + 100;
|
||||
|
||||
protected function actionWar(WarUnit $self, WarUnit $oppose, array &$selfEnv, array &$opposeEnv):bool{
|
||||
if(!$self->hasActivatedSkill('계략')){
|
||||
return true;
|
||||
}
|
||||
|
||||
if($selfEnv['계략발동']??false){
|
||||
return true;
|
||||
}
|
||||
$selfEnv['계략발동'] = true;
|
||||
|
||||
$general = $self->getGeneral();
|
||||
|
||||
[$magic, $damage] = $selfEnv['magic'];
|
||||
|
||||
$damage = $general->onCalcStat($general, 'warMagicFailDamage', $damage, $magic);
|
||||
$josaUl = \sammo\JosaUtil::pick($magic, '을');
|
||||
|
||||
$general->pushGeneralBattleDetailLog("<D>{$magic}</>{$josaUl} <C>성공</>했다!", ActionLogger::PLAIN);
|
||||
$oppose->getLogger()->pushGeneralBattleDetailLog("<D>{$magic}</>에 당했다!", ActionLogger::PLAIN);
|
||||
|
||||
$self->multiplyWarPowerMultiply($damage);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
<?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 + 300; //최 우선 순위
|
||||
|
||||
static protected $tableToGeneral = [
|
||||
'위보'=>[1.2, 1.1],
|
||||
'매복'=>[1.4, 1.2],
|
||||
'반목'=>[1.6, 1.3],
|
||||
'화계'=>[1.8, 1.4],
|
||||
'혼란'=>[2.0, 1.5]
|
||||
];
|
||||
static protected $tableToCity = [
|
||||
'급습'=>[1.2, 1.1],
|
||||
'위보'=>[1.4, 1.2],
|
||||
'혼란'=>[1.6, 1.3]
|
||||
];
|
||||
|
||||
protected function actionWar(WarUnit $self, WarUnit $oppose, array &$selfEnv, array &$opposeEnv):bool{
|
||||
assert($self instanceof WarUnitGeneral, 'General만 발동 가능');
|
||||
|
||||
$general = $self->getGeneral();
|
||||
$crewType = $general->getCrewTypeObj();
|
||||
|
||||
if($crewType->magicCoef <= 0){
|
||||
//NOTE: -인 경우를 고려해야하나? 계략 맞을 확률 증가?
|
||||
return true;
|
||||
}
|
||||
|
||||
if($self->hasActivatedSkill('계략불가')){
|
||||
return true;
|
||||
}
|
||||
|
||||
$magicTrialProb = $general->getIntel(true, true, true, false) / 100;
|
||||
$magicTrialProb *= $crewType->magicCoef;
|
||||
|
||||
$magicTrialProb = $general->onCalcStat($general, 'warMagicTrialProb', $magicTrialProb);
|
||||
|
||||
if(!Util::randBool($magicTrialProb)){
|
||||
return true;
|
||||
}
|
||||
|
||||
$magicSuccessProb = 0.7;
|
||||
$magicSuccessProb = $general->onCalcStat($general, 'warMagicSuccessProb', $magicSuccessProb);
|
||||
if($this->hasActivatedSkill('계략약화')){
|
||||
$magicSuccessProb -= 0.1; //NOTE: 앞으로 이건 oppose의 onCalcStat에 들어가야하지 않을까?
|
||||
}
|
||||
|
||||
if($oppose instanceof WarUnitCity){
|
||||
$magic = Util::choiceRandom(array_keys(static::$tableToCity));
|
||||
[$successDamage, $failDamage] = static::$tableToCity[$magic];
|
||||
}
|
||||
else{
|
||||
$magic = Util::choiceRandom(array_keys(static::$tableToGeneral));
|
||||
[$successDamage, $failDamage] = static::$tableToGeneral[$magic];
|
||||
}
|
||||
|
||||
$self->activateSkill('계략시도', $magic);
|
||||
if(Util::randBool($magicSuccessProb)){
|
||||
$self->activateSkill('계략');
|
||||
$selfEnv['magic'] = [$magic, $successDamage];
|
||||
}
|
||||
else{
|
||||
$self->activateSkill('계략실패');
|
||||
$selfEnv['magic'] = [$magic, $failDamage];
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?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 + 300;
|
||||
|
||||
protected function actionWar(WarUnit $self, WarUnit $oppose, array &$selfEnv, array &$opposeEnv):bool{
|
||||
if(!$self->hasActivatedSkill('계략실패')){
|
||||
return true;
|
||||
}
|
||||
|
||||
if($selfEnv['계략실패']??false){
|
||||
return true;
|
||||
}
|
||||
$selfEnv['계략실패'] = true;
|
||||
|
||||
$general = $self->getGeneral();
|
||||
|
||||
[$magic, $damage] = $selfEnv['magic'];
|
||||
|
||||
$damage = $general->onCalcStat($general, 'warMagicFailDamage', $damage, $magic);
|
||||
$josaUl = \sammo\JosaUtil::pick($magic, '을');
|
||||
|
||||
$general->pushGeneralBattleDetailLog("<D>{$magic}</>{$josaUl} <R>실패</>했다!", ActionLogger::PLAIN);
|
||||
$oppose->getLogger()->pushGeneralBattleDetailLog("<D>{$magic}</>{$josaUl} 간파했다!", ActionLogger::PLAIN);
|
||||
|
||||
$self->multiplyWarPowerMultiply(1/$damage);
|
||||
$oppose->multiplyWarPowerMultiply($damage);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user