버그 수정

This commit is contained in:
2019-04-21 16:27:57 +09:00
parent d46b3154cc
commit c7748934b8
5 changed files with 20 additions and 19 deletions
+3 -3
View File
@@ -48,7 +48,7 @@ class che_징병 extends Command\GeneralCommand{
if(!key_exists('crewType', $this->arg)){
return false;
}
if(!key_exists('amount', $this->arg)){
if(!key_exists('amountCrew', $this->arg)){
return false;
}
$crewType = $this->arg['crewType'];
@@ -69,7 +69,7 @@ class che_징병 extends Command\GeneralCommand{
}
$this->arg = [
'crewType'=>$crewType,
'amount'=>$amount
'amountCrew'=>$amount
];
return true;
}
@@ -89,7 +89,7 @@ class che_징병 extends Command\GeneralCommand{
if($reqCrewType->id == $currCrewType->id){
$maxCrew -= $general->getVar('crew');
}
$reqCrew = Util::valueFit($this->arg['amount'], 100, $maxCrew);
$reqCrew = Util::valueFit($this->arg['amountCrew'], 100, $maxCrew);
$this->reqCrew = $reqCrew;
$this->reqCrewType = $reqCrewType;
$this->currCrewType = $currCrewType;
+3 -3
View File
@@ -237,13 +237,13 @@ class General implements iAction{
function kill($db){
$gameStor = KVStorage::getStorage($db, 'game_env');
$generalID = $this->getRaw('no');
$generalID = $this->getID();
$logger = $this->getLogger();
$generalName = $this->getName();
// 군주였으면 유지 이음
if($this->getRaw('level') == 12) {
if($this->getVar('level') == 12) {
nextRuler($this);
}
@@ -261,7 +261,7 @@ class General implements iAction{
], 'gen3=%i', $generalID);
// 부대 처리
$troopID = $this->getRaw('troop');
$troopID = $this->getVar('troop');
$troopLeaderID = $db->queryFirstField('SELECT `no` FROM troop WHERE troop=%i', $troopID);
if($troopLeaderID == $generalID){
//부대장일 경우
+6 -6
View File
@@ -321,20 +321,20 @@ class GeneralAI{
$types = [];
foreach(GameUnitConst::byType(GameUnitConst::T_FOOTMAN) as $crewtype){
if($crewtype->isValid($cities, $regions, $relYear, $tech)){
$score = $dex[GameConst::T_FOOTMAN] * $crewtype->pickScore($tech);
$score = $dex[GameUnitConst::T_FOOTMAN] * $crewtype->pickScore($tech);
$types[] = [$crewtype->id, $score];
}
}
foreach(GameUnitConst::byType(GameUnitConst::T_ARCHER) as $crewtype){
if($crewtype->isValid($cities, $regions, $relYear, $tech)){
$score = $dex[GameConst::T_ARCHER] * $crewtype->pickScore($tech);
$score = $dex[GameUnitConst::T_ARCHER] * $crewtype->pickScore($tech);
$types[] = [$crewtype->id, $score];
}
}
foreach(GameUnitConst::byType(GameUnitConst::T_CAVALRY) as $crewtype){
if($crewtype->isValid($cities, $regions, $relYear, $tech)){
$score = $dex[GameConst::T_CAVALRY] * $crewtype->pickScore($tech);
$types[] = [$crewtype->id, $dex[GameConst::T_CAVALRY] + 500];
$score = $dex[GameUnitConst::T_CAVALRY] * $crewtype->pickScore($tech);
$types[] = [$crewtype->id, $dex[GameUnitConst::T_CAVALRY] + 500];
}
}
foreach($types as [$crewtype, $score]){
@@ -346,7 +346,7 @@ class GeneralAI{
$types = [];
foreach(GameUnitConst::byType(GameUnitConst::T_WIZARD) as $crewtype){
if($crewtype->isValid($cities, $regions, $relYear, $tech)){
$score = $dex[GameConst::T_WIZARD] * $crewtype->pickScore($tech);
$score = $dex[GameUnitConst::T_WIZARD] * $crewtype->pickScore($tech);
$types[] = [$crewtype->id, $score];
}
}
@@ -1345,7 +1345,7 @@ class GeneralAI{
$sumLeadershipInCity = $db->queryFirstField('SELECT sum(leader) FROM general WHERE nation = %i AND city = %i AND leader > 40', $nationID, $cityID);
if(
$city['pop'] > 30000 + $general->getLeadership(false) * 100 * 1.3 &&
Util::bool(($city['pop'] - 30000) / $sumLeadershipInCity * 100)
Util::randBool(($city['pop'] - 30000) / $sumLeadershipInCity * 100)
){
return $this->chooseRecruitCrewType();
}
+7 -6
View File
@@ -101,7 +101,7 @@ class DyingMessage{
function __construct($name, ?int $npc = null)
{
if(static::$messages === null){
static::buildMessageList();
static::initMessageList();
}
if($name instanceof General){
$this->_constructWithObj($name);
@@ -112,17 +112,17 @@ class DyingMessage{
}
public function getText():string{
$name = $this->general->getName();
$npc = $this->general->getVar('npc');
$name = $this->name ;
$npc = $this->npc;
if($npc == 0){
$text = Util::choiceRandom(static::$messages);
$text = Util::choiceRandom(static::$messages??[]);
}
else if($npc == 2 || $npc == 6){
$text = Util::choiceRandom(static::$scenarioNPCMessages);
$text = Util::choiceRandom(static::$scenarioNPCMessages??[]);
}
else if($npc == 3 || $npc == 4){
$text = Util::choiceRandom(static::$utilNPCMessages);
$text = Util::choiceRandom(static::$utilNPCMessages??[]);
}
else{
$text = static::$defaultMessage;
@@ -131,5 +131,6 @@ class DyingMessage{
$text = str_replace(':name:', $name, $text);
JosaUtil::batch($text, $name);
return $text;
}
}
+1 -1
View File
@@ -610,7 +610,7 @@ class JosaUtil{
$search = [];
$replace = [];
foreach(static::DEFAULT_POSTPOSITION as [$wJong, $woJong]){
foreach(static::DEFAULT_POSTPOSITION as $wJong => $woJong){
$value = JosaUtil::pick($key, $wJong);
$search[] = "{$prefix}{$wJong}{$postfix}";
$replace[] = $value;