병종 기본 설정 추가 수정

This commit is contained in:
2018-03-31 04:45:12 +09:00
parent a1d37e5697
commit c976e55d72
3 changed files with 70 additions and 59 deletions
+45 -3
View File
@@ -11,7 +11,7 @@ class GameUnitDetail{
public $cost;
public $rice;
public $recruitType;
public $recruitPlace;
public $recruitCondition;
public $recruitFirst;
public function __construct(
@@ -24,7 +24,7 @@ class GameUnitDetail{
int $cost,
int $rice,
int $recruitType,
int $recruitPlace,
int $recruitCondition,
bool $recruitFirst
){
$this->name = $name;
@@ -35,7 +35,49 @@ class GameUnitDetail{
$this->cost = $cost;
$this->rice = $rice;
$this->recruitType = $recruitType;
$this->recruitPlace = $recruitPlace;
$this->recruitCondition = $recruitCondition;
$this->recruitFirst = $recruitFirst;
}
public function isValid($ownCities, $ownRegions, $relativeYear, $tech){
if($relativeYear < 3 && !$this->recruitFirst){
return false;
}
if($this->recruitType == 0){
if($tech < $this->recruitCondition){
return false;
}
}
if($this->recruitType == 1){
if(!key_exists($this->recruitCondition, $ownRegions)){
return false;
}
if ($tech < 1000) {
return false;
}
}
if($this->recruitType == 2){
$cityLevel = CityConst::byID($id)->level;
$cityLevel = CityConst::$regionMap[$cityLevel];
if(!key_exists($this->recruitCondition, $ownCities)){
return false;
}
if($cityLevel == '특'){
if ($tech < 3000) {
return false;
}
}
else{ //if($cityLevel == '이')
if ($tech < 2000) {
return false;
}
}
}
return true;
}
}