feat, refac(wip): 징병 기준을 GameUnitConstraint 기반으로 변경

This commit is contained in:
2025-01-21 15:41:41 +00:00
parent 77ec4c6572
commit 01094d376f
7 changed files with 36 additions and 47 deletions
+5 -31
View File
@@ -56,7 +56,11 @@ class GameUnitDetail implements iAction
$this->magicCoef = $magicCoef;
$this->cost = $cost;
$this->rice = $rice;
$this->reqConstraints = $reqConstraints;
$this->reqConstraints = [];
foreach($reqConstraints as $constraint){
$className = Util::getClassNameFromObj($constraint);
$this->reqConstraints[$className] = $constraint;
}
$this->attackCoef = $attackCoef;
$this->defenceCoef = $defenceCoef;
$this->initSkillTrigger = $initSkillTrigger;
@@ -205,36 +209,6 @@ class GameUnitDetail implements iAction
}
}
if ($tech < $this->reqTech) {
return false;
}
if ($this->reqCities !== null) {
$valid = false;
foreach ($this->reqCities as $reqCity) {
if (\key_exists($reqCity, $ownCities)) {
$valid = true;
break;
}
}
if (!$valid) {
return false;
}
}
if ($this->reqRegions !== null) {
$valid = false;
foreach ($this->reqRegions as $reqRegion) {
if (\key_exists($reqRegion, $ownRegions)) {
$valid = true;
break;
}
}
if (!$valid) {
return false;
}
}
return true;
}