fix: 성벽 선제가 호출조차 되지 않는 버그 수정
This commit is contained in:
@@ -328,7 +328,7 @@ function buildGeneralSpecialWarClass(?string $type):BaseSpecial{
|
|||||||
|
|
||||||
function getActionCrewTypeClass(?string $type){
|
function getActionCrewTypeClass(?string $type){
|
||||||
if($type === null || $type === ''){
|
if($type === null || $type === ''){
|
||||||
$type = GameConst::$defaultSpecialWar;
|
$type = 'None';
|
||||||
}
|
}
|
||||||
|
|
||||||
static $basePath = __NAMESPACE__.'\\ActionCrewType\\';
|
static $basePath = __NAMESPACE__.'\\ActionCrewType\\';
|
||||||
|
|||||||
@@ -337,10 +337,6 @@ if ($action == 'reorder') {
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
usort($defenderList, function (WarUnit $lhs, WarUnit $rhs) use ($attacker) {
|
|
||||||
return - (extractBattleOrder($lhs, $attacker) <=> extractBattleOrder($rhs, $attacker));
|
|
||||||
});
|
|
||||||
|
|
||||||
$rawDefenderList = [];
|
$rawDefenderList = [];
|
||||||
foreach($defenderList as $unit){
|
foreach($defenderList as $unit){
|
||||||
if(extractBattleOrder($unit, $attacker) <= 0){
|
if(extractBattleOrder($unit, $attacker) <= 0){
|
||||||
@@ -409,10 +405,13 @@ function simulateBattle(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(count($defenderList) == 0 && extractBattleOrder($city, $attacker) > 0){
|
if(count($defenderList) && extractBattleOrder($city, $attacker) > 0){
|
||||||
$defenderList[] = $city;
|
$defenderList[] = $city;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
usort($defenderList, function (WarUnit $lhs, WarUnit $rhs) use ($attacker) {
|
||||||
|
return - (extractBattleOrder($lhs, $attacker) <=> extractBattleOrder($rhs, $attacker));
|
||||||
|
});
|
||||||
|
|
||||||
$iterDefender = new \ArrayIterator($defenderList);
|
$iterDefender = new \ArrayIterator($defenderList);
|
||||||
$iterDefender->rewind();
|
$iterDefender->rewind();
|
||||||
@@ -447,7 +446,9 @@ function simulateBattle(
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$defenderRice += $defender->getVar('rice');
|
if($defender instanceof WarUnitGeneral){
|
||||||
|
$defenderRice += $defender->getVar('rice');
|
||||||
|
}
|
||||||
|
|
||||||
$iterDefender->next();
|
$iterDefender->next();
|
||||||
return $defender;
|
return $defender;
|
||||||
|
|||||||
+17
-10
@@ -51,7 +51,7 @@ function processWar(string $warSeed, General $attackerGeneral, array $rawAttacke
|
|||||||
$defenderList[] = $defenderCandidate;
|
$defenderList[] = $defenderCandidate;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(count($defenderList) == 0 && extractBattleOrder($city, $attacker) > 0){
|
if(count($defenderList) && extractBattleOrder($city, $attacker) > 0){
|
||||||
$defenderList[] = $city;
|
$defenderList[] = $city;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -424,21 +424,28 @@ function processWar_NG(
|
|||||||
$attacker->logBattleResult();
|
$attacker->logBattleResult();
|
||||||
$defender->logBattleResult();
|
$defender->logBattleResult();
|
||||||
|
|
||||||
$attacker->addWin();
|
if (!($defender instanceof WarUnitCity) || $defender->isSiege()){
|
||||||
$defender->addLose();
|
$attacker->addWin();
|
||||||
|
$defender->addLose();
|
||||||
|
|
||||||
$attacker->tryWound();
|
$attacker->tryWound();
|
||||||
$defender->tryWound();
|
$defender->tryWound();
|
||||||
|
|
||||||
if ($defender === $city) {
|
if ($defender === $city) {
|
||||||
$attacker->addLevelExp(1000);
|
$attacker->addLevelExp(1000);
|
||||||
$conquerCity = true;
|
$conquerCity = true;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$josaYi = JosaUtil::pick($defender->getCrewTypeName(), '이');
|
$josaYi = JosaUtil::pick($defender->getCrewTypeName(), '이');
|
||||||
|
|
||||||
if ($noRice) {
|
if ($defender instanceof WarUnitCity && !$defender->isSiege()){
|
||||||
|
//실제 공성을 위해 다시 초기화
|
||||||
|
$defender->setOppose(null);
|
||||||
|
}
|
||||||
|
else if ($noRice) {
|
||||||
$logger->pushGlobalActionLog("<Y>{$defender->getName()}</>의 {$defender->getCrewTypeName()}{$josaYi} 패퇴했습니다.");
|
$logger->pushGlobalActionLog("<Y>{$defender->getName()}</>의 {$defender->getCrewTypeName()}{$josaYi} 패퇴했습니다.");
|
||||||
$attacker->getLogger()->pushGeneralActionLog("<Y>{$defender->getName()}</>의 {$defender->getCrewTypeName()}{$josaYi} 패퇴했습니다.", ActionLogger::PLAIN);
|
$attacker->getLogger()->pushGeneralActionLog("<Y>{$defender->getName()}</>의 {$defender->getCrewTypeName()}{$josaYi} 패퇴했습니다.", ActionLogger::PLAIN);
|
||||||
$defender->getLogger()->pushGeneralActionLog("군량 부족으로 패퇴합니다.", ActionLogger::PLAIN);
|
$defender->getLogger()->pushGeneralActionLog("군량 부족으로 패퇴합니다.", ActionLogger::PLAIN);
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo\ActionCrewType;
|
||||||
|
use \sammo\iAction;
|
||||||
|
use \sammo\General;
|
||||||
|
|
||||||
|
class None implements iAction{
|
||||||
|
use \sammo\DefaultAction;
|
||||||
|
|
||||||
|
protected $id = -1;
|
||||||
|
protected $name = '-';
|
||||||
|
protected $info = '';
|
||||||
|
}
|
||||||
@@ -334,7 +334,7 @@ class GameUnitConstBase{
|
|||||||
[self::T_FOOTMAN=>1.25, self::T_ARCHER=>1.25, self::T_CAVALRY=>1.25, self::T_WIZARD=>1.25, self::T_CASTLE=>1.8, 1106=>1.112],
|
[self::T_FOOTMAN=>1.25, self::T_ARCHER=>1.25, self::T_CAVALRY=>1.25, self::T_WIZARD=>1.25, self::T_CASTLE=>1.8, 1106=>1.112],
|
||||||
[self::T_FOOTMAN=>1.2, self::T_ARCHER=>1.2, self::T_CAVALRY=>1.2, self::T_WIZARD=>1.2, 1106=>1.067],
|
[self::T_FOOTMAN=>1.2, self::T_ARCHER=>1.2, self::T_CAVALRY=>1.2, self::T_WIZARD=>1.2, 1106=>1.067],
|
||||||
['상대에게 돌덩이를 날립니다.'],
|
['상대에게 돌덩이를 날립니다.'],
|
||||||
['che_성벽부상무효'], ['che_선제사격시도', 'che_선제사격발동'], null
|
['che_성벽부상무효'], ['che_선제사격시도', 'che_선제사격발동'], ['che_성벽선제']
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
1503, self::T_SIEGE, '목우',
|
1503, self::T_SIEGE, '목우',
|
||||||
@@ -343,7 +343,7 @@ class GameUnitConstBase{
|
|||||||
[self::T_FOOTMAN=>1, self::T_ARCHER=>1, self::T_CAVALRY=>1, self::T_WIZARD=>1, self::T_CASTLE=>1.8],
|
[self::T_FOOTMAN=>1, self::T_ARCHER=>1, self::T_CAVALRY=>1, self::T_WIZARD=>1, self::T_CASTLE=>1.8],
|
||||||
[self::T_FOOTMAN=>1, self::T_ARCHER=>1, self::T_CAVALRY=>1, self::T_WIZARD=>1, 1106=>1],
|
[self::T_FOOTMAN=>1, self::T_ARCHER=>1, self::T_CAVALRY=>1, self::T_WIZARD=>1, 1106=>1],
|
||||||
['상대를 저지하는 특수병기입니다.'],
|
['상대를 저지하는 특수병기입니다.'],
|
||||||
['che_성벽부상무효'], ['che_저지시도', 'che_저지발동'], ['che_성벽선제']
|
['che_성벽부상무효'], ['che_저지시도', 'che_저지발동'], null
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ class GameUnitDetail implements iAction
|
|||||||
$this->initSkillTrigger = $initSkillTrigger;
|
$this->initSkillTrigger = $initSkillTrigger;
|
||||||
$this->phaseSkillTrigger = $phaseSkillTrigger;
|
$this->phaseSkillTrigger = $phaseSkillTrigger;
|
||||||
$this->iActionList = [];
|
$this->iActionList = [];
|
||||||
foreach($iActionList as $rawAction){
|
foreach($iActionList ?? [] as $rawAction){
|
||||||
$action = buildActionCrewTypeClass($rawAction);
|
$action = buildActionCrewTypeClass($rawAction);
|
||||||
if(!$action){
|
if(!$action){
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -80,6 +80,13 @@ class WarUnitCity extends WarUnit{
|
|||||||
|
|
||||||
function setSiege(){
|
function setSiege(){
|
||||||
$this->onSiege = true;
|
$this->onSiege = true;
|
||||||
|
$this->currPhase = 0;
|
||||||
|
$this->prePhase = 0;
|
||||||
|
$this->bonusPhase = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
function isSiege(): bool{
|
||||||
|
return $this->onSiege;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDex(GameUnitDetail $crewType){
|
function getDex(GameUnitDetail $crewType){
|
||||||
@@ -99,6 +106,12 @@ class WarUnitCity extends WarUnit{
|
|||||||
function continueWar(&$noRice):bool{
|
function continueWar(&$noRice):bool{
|
||||||
//전투가 가능하면 true
|
//전투가 가능하면 true
|
||||||
$noRice = false;
|
$noRice = false;
|
||||||
|
|
||||||
|
//본 공성이 아닌 경우에는 한대만 맞아줌
|
||||||
|
if(!$this->onSiege){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if($this->getHP() <= 0){
|
if($this->getHP() <= 0){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user