병종 테이블에 상성 값 확장
This commit is contained in:
@@ -16,6 +16,8 @@ class GameUnitDetail{
|
||||
public $reqCities;
|
||||
public $reqRegions;
|
||||
public $reqYear;
|
||||
public $attackCoef;
|
||||
public $defenceCoef;
|
||||
public $info;
|
||||
|
||||
public function __construct(
|
||||
@@ -33,6 +35,8 @@ class GameUnitDetail{
|
||||
?array $reqCities,
|
||||
?array $reqRegions,
|
||||
int $reqYear,
|
||||
array $attackCoef,
|
||||
array $defenceCoef,
|
||||
array $info
|
||||
){
|
||||
$this->name = $name;
|
||||
@@ -48,6 +52,8 @@ class GameUnitDetail{
|
||||
$this->reqCities = $reqCities;
|
||||
$this->reqRegions = $reqRegions;
|
||||
$this->reqYear = $reqYear;
|
||||
$this->attackCoef = $attackCoef;
|
||||
$this->defenceCoef = $defenceCoef;
|
||||
$this->info = $info;
|
||||
}
|
||||
|
||||
@@ -55,6 +61,22 @@ class GameUnitDetail{
|
||||
return $this->cost * getTechCost($tech) * $crew / 100;
|
||||
}
|
||||
|
||||
public function getAttackCoef($armType):float{
|
||||
if($armType instanceof GameUnitDetail){
|
||||
$armType = $armType->armType;
|
||||
}
|
||||
assert(is_numeric($armType), '$armType should be int or GameUnitDetail');
|
||||
return $this->attackCoef[$armType]??1;
|
||||
}
|
||||
|
||||
public function getDefenceCoef($armType):float{
|
||||
if($armType instanceof GameUnitDetail){
|
||||
$armType = $armType->armType;
|
||||
}
|
||||
assert(is_numeric($armType), '$armType should be int or GameUnitDetail');
|
||||
return $this->defenceCoef[$armType]??1;
|
||||
}
|
||||
|
||||
public function isValid($ownCities, $ownRegions, $relativeYear, $tech){
|
||||
if($relativeYear < $this->reqYear){
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user