phan 1차

This commit is contained in:
2020-05-01 17:33:14 +09:00
parent beb7553629
commit 180b3c7c5d
27 changed files with 76 additions and 48 deletions
+3 -2
View File
@@ -15,13 +15,14 @@ return [
// Note that the **only** effect of choosing `'5.6'` is to infer
// that functions removed in php 7.0 exist.
// (See `backward_compatibility_checks` for additional options)
"target_php_version" => '7.4',
"target_php_version" => '8.0',
'backward_compatibility_checks ' => false,
'ignore_undeclared_variables_in_global_scope' => false,
'minimum_severity'=>\Phan\Issue::SEVERITY_LOW,
'minimum_severity'=>\Phan\Issue::SEVERITY_CRITICAL,
'file_list' => [
'f_config/config.php',
'hwe/MYDB.php',
'hwe/a_bestGeneral.php',
'hwe/a_emperior.php',
'hwe/a_emperior2.php',
+1 -1
View File
@@ -63,7 +63,7 @@ case "분지연":
$locked = true;
break;
}
sleep(0.5);
usleep(500000);
}
$gameStor->cacheValues(['turntime', 'starttime', 'tnmt_time']);
$turntime = (new \DateTimeImmutable($gameStor->turntime))->add(new \DateInterval("PT{$minute}M"));
+1 -1
View File
@@ -342,7 +342,7 @@ switch($btn) {
$turntime = getRandTurn($turnterm);
$cutTurn = cutTurn($turntime, $turnterm);
$db->update('general', [
'turntime'=>$curTurn
'turntime'=>$cutTurn
], '`no` IN %li', $genlist);
}
break;
+3 -1
View File
@@ -2,6 +2,8 @@
namespace sammo;
use sammo\Command\BaseCommand;
/**
* Value Converter
*
@@ -156,7 +158,7 @@ function getNationTypeClass(?string $type){
throw new \InvalidArgumentException("{$type}은 올바른 국가 타입 클래스가 아님");
}
function buildNationTypeClass(?string $type):iAction{
function buildNationTypeClass(?string $type):BaseNation{
static $cache = [];
if($type === null){
$type = 'None';
+1 -2
View File
@@ -2,8 +2,7 @@
namespace sammo\ActionNationType;
use \sammo\iAction;
class None implements iAction{
use \sammo\DefaultAction;
class None extends \sammo\BaseNation{
protected $name = '-';
protected $info = '';
+1 -2
View File
@@ -3,8 +3,7 @@ namespace sammo\ActionNationType;
use \sammo\iAction;
use \sammo\General;
class che_덕가 implements iAction{
use \sammo\DefaultAction;
class che_덕가 extends \sammo\BaseNation{
protected $name = '덕가';
protected $info = '';
+1 -2
View File
@@ -3,8 +3,7 @@ namespace sammo\ActionNationType;
use \sammo\iAction;
use \sammo\General;
class che_도가 implements iAction{
use \sammo\DefaultAction;
class che_도가 extends \sammo\BaseNation{
protected $name = '도가';
protected $info = '';
+1 -2
View File
@@ -3,8 +3,7 @@ namespace sammo\ActionNationType;
use \sammo\iAction;
use \sammo\General;
class che_도적 implements iAction{
use \sammo\DefaultAction;
class che_도적 extends \sammo\BaseNation{
protected $name = '도적';
protected $info = '';
+1 -2
View File
@@ -3,8 +3,7 @@ namespace sammo\ActionNationType;
use \sammo\iAction;
use \sammo\General;
class che_명가 implements iAction{
use \sammo\DefaultAction;
class che_명가 extends \sammo\BaseNation{
protected $name = '명가';
protected $info = '';
+1 -2
View File
@@ -3,8 +3,7 @@ namespace sammo\ActionNationType;
use \sammo\iAction;
use \sammo\General;
class che_묵가 implements iAction{
use \sammo\DefaultAction;
class che_묵가 extends \sammo\BaseNation{
protected $name = '묵가';
protected $info = '';
+1 -2
View File
@@ -3,8 +3,7 @@ namespace sammo\ActionNationType;
use \sammo\iAction;
use \sammo\General;
class che_법가 implements iAction{
use \sammo\DefaultAction;
class che_법가 extends \sammo\BaseNation{
protected $name = '법가';
protected $info = '';
+1 -2
View File
@@ -3,8 +3,7 @@ namespace sammo\ActionNationType;
use \sammo\iAction;
use \sammo\General;
class che_병가 implements iAction{
use \sammo\DefaultAction;
class che_병가 extends \sammo\BaseNation{
protected $name = '병가';
protected $info = '';
+1 -2
View File
@@ -3,8 +3,7 @@ namespace sammo\ActionNationType;
use \sammo\iAction;
use \sammo\General;
class che_불가 implements iAction{
use \sammo\DefaultAction;
class che_불가 extends \sammo\BaseNation{
protected $name = '불가';
protected $info = '';
@@ -3,8 +3,7 @@ namespace sammo\ActionNationType;
use \sammo\iAction;
use \sammo\General;
class che_오두미도 implements iAction{
use \sammo\DefaultAction;
class che_오두미도 extends \sammo\BaseNation{
protected $name = '오두미도';
protected $info = '';
+1 -2
View File
@@ -3,8 +3,7 @@ namespace sammo\ActionNationType;
use \sammo\iAction;
use \sammo\General;
class che_유가 implements iAction{
use \sammo\DefaultAction;
class che_유가 extends \sammo\BaseNation{
protected $name = '유가';
protected $info = '';
+1 -2
View File
@@ -3,8 +3,7 @@ namespace sammo\ActionNationType;
use \sammo\iAction;
use \sammo\General;
class che_음양가 implements iAction{
use \sammo\DefaultAction;
class che_음양가 extends \sammo\BaseNation{
protected $name = '음양가';
protected $info = '';
+1 -2
View File
@@ -4,8 +4,7 @@ use \sammo\iAction;
use \sammo\General;
use \sammo\Util;
class che_종횡가 implements iAction{
use \sammo\DefaultAction;
class che_종횡가 extends \sammo\BaseNation{
protected $name = '종횡가';
protected $info = '';
+1 -2
View File
@@ -3,8 +3,7 @@ namespace sammo\ActionNationType;
use \sammo\iAction;
use \sammo\General;
class che_중립 implements iAction{
use \sammo\DefaultAction;
class che_중립 extends \sammo\BaseNation{
protected $name = '-';
protected $info = '';
+1 -2
View File
@@ -3,8 +3,7 @@ namespace sammo\ActionNationType;
use \sammo\iAction;
use \sammo\General;
class che_태평도 implements iAction{
use \sammo\DefaultAction;
class che_태평도 extends \sammo\BaseNation{
protected $name = '태평도';
protected $info = '';
+13
View File
@@ -0,0 +1,13 @@
<?php
namespace sammo;
use \sammo\iAction;
use \sammo\General;
abstract class BaseNation implements iAction{
use \sammo\DefaultAction;
protected $name = '-';
protected $info = '';
static $pros = '';
static $cons = '';
}
+1 -1
View File
@@ -285,7 +285,7 @@ class che_화계 extends Command\GeneralCommand{
$this->affectDestCity($injuryCount);
$itemObj = $general->getItem();
if($itemObj->isConsumableNow('GeneralCommand', '계략') && $itemObj::$consumable){
if($itemObj->isConsumableNow('GeneralCommand', '계략') && $itemObj->isConsumableNow('GeneralCommand', '계략')){
$itemName = $itemObj->getName();
$itemRawName = $itemObj->getRawName();
$josaUl = JosaUtil::pick($itemRawName, '을');
+19 -2
View File
@@ -3332,8 +3332,24 @@ class GeneralAI
$picked = false;
foreach(Util::range(5) as $idx){
/** @var General */
$randGeneral = Util::choiceRandom($this->npcWarGenerals);
if($this->npcWarGenerals){
$randGeneral = Util::choiceRandom($this->npcWarGenerals);
}
else if($this->npcCivilGenerals){
$randGeneral = Util::choiceRandom($this->npcCivilGenerals);
}
else if($this->userWarGenerals){
$randGeneral = Util::choiceRandom($this->userWarGenerals);
}
else if($this->userCivilGenerals){
$randGeneral = Util::choiceRandom($this->userCivilGenerals);
}
else{
break;
}
if($randGeneral->getVar('officer_level') != 1){
continue;
}
@@ -3357,10 +3373,11 @@ class GeneralAI
break;
}
if(!$picked){
if(!$picked || !$randGeneral){
continue;
}
/** @var General $randGeneral */
$randGeneral->setVar('officer_level', $chiefLevel);
$randGeneral->setVar('officer_city', 0);
$randGeneral->applyDB($db);
+8
View File
@@ -473,4 +473,12 @@ class Message
], 'id=%i', $this->id);
}
public function agreeMessage(int $receiverID, string &$reason):int{
throw new NotInheritedMethodException();
}
public function declineMessage(int $receiverID, string &$reason):int{
throw new NotInheritedMethodException();
}
}
+4 -2
View File
@@ -18,7 +18,9 @@ class Scenario{
private $history;
/** @var \sammo\Scenario\Nation[] */
private $nations;
/** @var \sammo\Scenario\Nation[] */
private $nationsInv;
private $diplomacy;
@@ -125,7 +127,7 @@ class Scenario{
) = $rawGeneral;
if(key_exists($nationName, $this->nationsInv)){
$nationID = $this->nationsInv[$nationName]->id;;
$nationID = $this->nationsInv[$nationName]->getID();
}
else if(key_exists($nationName, $this->nations)){
$nationID = (int)$nationName;
@@ -167,7 +169,7 @@ class Scenario{
) = $rawGeneral;
if(key_exists($nationName, $this->nationsInv)){
$nationID = $this->nationsInv[$nationName]->id;;
$nationID = $this->nationsInv[$nationName]->getID();
}
else if(key_exists($nationName, $this->nations)){
$nationID = (int)$nationName;
+7 -1
View File
@@ -18,6 +18,7 @@ class WarUnit{
protected $currPhase = 0;
protected $prePhase = 0;
protected $bonusPhase = 0;
protected $atmosBonus = 0;
protected $trainBonus = 0;
@@ -166,7 +167,8 @@ class WarUnit{
}
function getMaxPhase():int{
return $this->getCrewType()->speed;
$phase = $this->getCrewType()->speed;
return $phase + $this->bonusPhase;
}
function setPrePhase(int $phase){
@@ -177,6 +179,10 @@ class WarUnit{
$this->currPhase += 1;
}
function addBonusPhase(int $cnt){
$this->bonusPhase += $cnt;
}
function setOppose(?WarUnit $oppose){
$this->oppose = $oppose;
$this->killedCurr = 0;
-6
View File
@@ -2,8 +2,6 @@
namespace sammo;
class WarUnitGeneral extends WarUnit{
protected $bonusPhase = 0;
function __construct(General $general, array $rawNation, bool $isAttacker){
$this->general = $general;
$this->raw = $general->getRaw();
@@ -56,10 +54,6 @@ class WarUnitGeneral extends WarUnit{
}
}
function addBonusPhase(int $cnt){
$this->bonusPhase += $cnt;
}
function getMaxPhase():int{
$phase = $this->getCrewType()->speed;
$phase = $this->general->onCalcStat($this->general, 'initWarPhase', $phase);
+1 -1
View File
@@ -63,7 +63,7 @@ class Util extends \utilphp\util
throw new \InvalidArgumentException('올바르지 않은 type 지정');
}
public static function zip(iterable ...$iterators){
public static function zip(\Generator ...$iterators){
while(true){
$hasValue = false;
$values = [];