diff --git a/hwe/sammo/AutorunGeneralPolicy.php b/hwe/sammo/AutorunGeneralPolicy.php new file mode 100644 index 00000000..e4a934a0 --- /dev/null +++ b/hwe/sammo/AutorunGeneralPolicy.php @@ -0,0 +1,176 @@ +getVar('npc'); + $nationID = $general->getNationID(); + + if($npc==5){ + $this->can선양 = true; + $this->can집합 = true; + $this->can임관 = false; + return; + } + + if($nationID != 0){ + $this->can임관 = false; + $this->can건국 = false; + } + + + } + + function __construct(General $general, $aiOptions){ + + + if($general->getVar('npc') >= 2){ + $this->doNPCState($general); + return; + } + + $this->can일반내정 = false; + $this->can긴급내정 = false; + $this->can전쟁내정 = false; + + $this->can금쌀구매 = false; + $this->can상인무시 = false; + + $this->can징병 = false; + $this->can모병 = false; + $this->can한계징병 = true; + $this->can고급병종 = true; + $this->can전투준비 = false; + + $this->can출병 = false; + + $this->canNPC증여 = false; + $this->canNPC헌납 = false; + + $this->can후방워프 = false; + $this->can전방워프 = false; + $this->can내정워프 = false; + + $this->can임관 = false; + $this->can집합 = false; + $this->can건국 = false; + $this->can선양 = false; + + foreach($aiOptions as $key=>$value){ + assert($value); + switch($key){ + case 'develop': + $this->can일반내정 = true; + //유저장은 '긴급'을 하지 않음 + $this->can전쟁내정 = true; + $this->can금쌀구매 = true; + break; + case 'warp': + $this->can후방워프 = true; + $this->can전방워프 = true; + $this->can내정워프 = true; + $this->can금쌀구매 = true; + $this->can상인무시 = true; + break; + case 'recruit_high': + $this->can모병 = true; + case 'recruit': + $this->can징병 = true; + $this->can소집해제 = true; + $this->can금쌀구매 = true; + break; + case 'train': + $this->can전투준비 = true; + $this->can금쌀구매 = true; + break; + case 'battle': + $this->can출병 = true; + $this->can금쌀구매 = true; + break; + } + } + } +} \ No newline at end of file diff --git a/hwe/sammo/AutorunNationPolicy.php b/hwe/sammo/AutorunNationPolicy.php new file mode 100644 index 00000000..fe606024 --- /dev/null +++ b/hwe/sammo/AutorunNationPolicy.php @@ -0,0 +1,128 @@ +$value){ + if(!property_exists($this, $policy)){ + throw new \InvalidArgumentException($policy); + } + $this->$policy = $value; + } + + foreach($nationPolicy as $policy){ + if(!property_exists($this, $policy)){ + throw new \InvalidArgumentException($policy); + } + $this->$policy = $value; + } + + if(!$this->priority){ + $this->priority = $this::$defaultPriority; + } + } +} diff --git a/hwe/sammo/GeneralAI.php b/hwe/sammo/GeneralAI.php index 033c65b8..5bce2b3c 100644 --- a/hwe/sammo/GeneralAI.php +++ b/hwe/sammo/GeneralAI.php @@ -10,6 +10,11 @@ class GeneralAI{ protected $nation; protected $genType; + /** @var AutorunGeneralPolicy */ + protected $generalPolicy; + /** @var AutorunNationPolicy */ + protected $nationPolicy; + protected $env; protected $baseDevelCost; @@ -264,7 +269,7 @@ class GeneralAI{ if($develRate['trust'] < 1){ $commandObj = buildGeneralCommandClass('che_주민선정', $general, $env); if($commandObj->isRunnable()){ - $commandList['che_주민선정'] = power($leadership * 2, 1 / ($develRate['trust'] + 0.001)); + $commandList['che_주민선정'] = pow($leadership * 2, 1 / ($develRate['trust'] + 0.001)); } } if($develRate['pop'] < 0.99){ diff --git a/hwe/sql/schema.sql b/hwe/sql/schema.sql index 6bd362b4..6b289896 100644 --- a/hwe/sql/schema.sql +++ b/hwe/sql/schema.sql @@ -231,7 +231,7 @@ CREATE TABLE `city` ( `officer3set` INT(1) NOT NULL DEFAULT '0', `officer2set` INT(1) NOT NULL DEFAULT '0', `state` INT(2) NOT NULL DEFAULT '0', - `region` INT(2) NOT NULL COMMENT 'TODO:Delete', + `region` INT(2) NOT NULL, `term` INT(1) NOT NULL DEFAULT '0', `conflict` VARCHAR(500) NOT NULL DEFAULT '{}', PRIMARY KEY (`city`),