무장 신산 가능

This commit is contained in:
2020-06-09 01:25:35 +09:00
parent 6248d72852
commit 6565fdbe7e
+77 -79
View File
@@ -1,80 +1,78 @@
<?php <?php
namespace sammo\WarUnitTrigger; namespace sammo\WarUnitTrigger;
use sammo\BaseWarUnitTrigger; use sammo\BaseWarUnitTrigger;
use sammo\WarUnitGeneral; use sammo\WarUnitGeneral;
use sammo\WarUnitCity; use sammo\WarUnitCity;
use sammo\WarUnit; use sammo\WarUnit;
use sammo\GameUnitDetail; use sammo\GameUnitDetail;
use sammo\ObjectTrigger; use sammo\ObjectTrigger;
use sammo\Util; use sammo\Util;
class che_계략시도 extends BaseWarUnitTrigger{ class che_계략시도 extends BaseWarUnitTrigger{
protected $priority = ObjectTrigger::PRIORITY_PRE + 300; protected $priority = ObjectTrigger::PRIORITY_PRE + 300;
static protected $tableToGeneral = [ static protected $tableToGeneral = [
'위보'=>[1.2, 1.1], '위보'=>[1.2, 1.1],
'매복'=>[1.4, 1.2], '매복'=>[1.4, 1.2],
'반목'=>[1.6, 1.3], '반목'=>[1.6, 1.3],
'화계'=>[1.8, 1.4], '화계'=>[1.8, 1.4],
'혼란'=>[2.0, 1.5] '혼란'=>[2.0, 1.5]
]; ];
static protected $tableToCity = [ static protected $tableToCity = [
'급습'=>[1.2, 1.1], '급습'=>[1.2, 1.1],
'위보'=>[1.4, 1.2], '위보'=>[1.4, 1.2],
'혼란'=>[1.6, 1.3] '혼란'=>[1.6, 1.3]
]; ];
protected function actionWar(WarUnit $self, WarUnit $oppose, array &$selfEnv, array &$opposeEnv):bool{ protected function actionWar(WarUnit $self, WarUnit $oppose, array &$selfEnv, array &$opposeEnv):bool{
assert($self instanceof WarUnitGeneral, 'General만 발동 가능'); assert($self instanceof WarUnitGeneral, 'General만 발동 가능');
$general = $self->getGeneral(); $general = $self->getGeneral();
$crewType = $general->getCrewTypeObj(); $crewType = $general->getCrewTypeObj();
if($crewType->magicCoef <= 0){ if($self->hasActivatedSkill('계략불가')){
//NOTE: -인 경우를 고려해야하나? 계략 맞을 확률 증가? return true;
return true; }
}
$magicTrialProb = $general->getIntel(true, true, true, false) / 100;
if($self->hasActivatedSkill('계략불가')){ $magicTrialProb *= $crewType->magicCoef;
return true;
} $magicTrialProb = $general->onCalcStat($general, 'warMagicTrialProb', $magicTrialProb);
if($magicTrialProb <= 0){
$magicTrialProb = $general->getIntel(true, true, true, false) / 100; return true;
$magicTrialProb *= $crewType->magicCoef; }
$magicTrialProb = $general->onCalcStat($general, 'warMagicTrialProb', $magicTrialProb); if(!Util::randBool($magicTrialProb)){
return true;
if(!Util::randBool($magicTrialProb)){ }
return true;
} $magicSuccessProb = 0.7;
$magicSuccessProb = $general->onCalcStat($general, 'warMagicSuccessProb', $magicSuccessProb);
$magicSuccessProb = 0.7; if($self->hasActivatedSkill('계략약화')){
$magicSuccessProb = $general->onCalcStat($general, 'warMagicSuccessProb', $magicSuccessProb); $magicSuccessProb -= 0.1; //NOTE: 앞으로 이건 oppose의 onCalcStat에 들어가야하지 않을까?
if($self->hasActivatedSkill('계략약화')){ }
$magicSuccessProb -= 0.1; //NOTE: 앞으로 이건 oppose의 onCalcStat에 들어가야하지 않을까?
} if($oppose instanceof WarUnitCity){
$magic = Util::choiceRandom(array_keys(static::$tableToCity));
if($oppose instanceof WarUnitCity){ [$successDamage, $failDamage] = static::$tableToCity[$magic];
$magic = Util::choiceRandom(array_keys(static::$tableToCity)); }
[$successDamage, $failDamage] = static::$tableToCity[$magic]; else{
} $magic = Util::choiceRandom(array_keys(static::$tableToGeneral));
else{ [$successDamage, $failDamage] = static::$tableToGeneral[$magic];
$magic = Util::choiceRandom(array_keys(static::$tableToGeneral)); }
[$successDamage, $failDamage] = static::$tableToGeneral[$magic];
} $successDamage = $general->onCalcStat($general, 'warMagicSuccessDamage', $successDamage, $magic);
$successDamage = $general->onCalcStat($general, 'warMagicSuccessDamage', $successDamage, $magic); $self->activateSkill('계략시도', $magic);
if(Util::randBool($magicSuccessProb)){
$self->activateSkill('계략시도', $magic); $self->activateSkill('계략');
if(Util::randBool($magicSuccessProb)){ $selfEnv['magic'] = [$magic, $successDamage];
$self->activateSkill('계략'); }
$selfEnv['magic'] = [$magic, $successDamage]; else{
} $self->activateSkill('계략실패');
else{ $selfEnv['magic'] = [$magic, $failDamage];
$self->activateSkill('계략실패'); }
$selfEnv['magic'] = [$magic, $failDamage];
} return true;
}
return true;
}
} }