67 lines
2.2 KiB
PowerShell
67 lines
2.2 KiB
PowerShell
param(
|
|
[string]$SkillFile = "Unity/Assets/Scripts/TH1_Logic/Skill/AllSkill/HakureiKarviEmbarkSkill.cs",
|
|
[string]$UnitLogicFile = "Unity/Assets/Scripts/TH1_Logic/Unit/UnitLogic.cs"
|
|
)
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
$repoRoot = git rev-parse --show-toplevel 2>$null
|
|
if (-not $repoRoot) {
|
|
throw "Not inside a git repository."
|
|
}
|
|
|
|
$repoRoot = [System.IO.Path]::GetFullPath($repoRoot.Trim())
|
|
$skillPath = Join-Path $repoRoot $SkillFile
|
|
$unitLogicPath = Join-Path $repoRoot $UnitLogicFile
|
|
|
|
if (-not (Test-Path -LiteralPath $skillPath)) {
|
|
throw "Hakurei Karvi embark skill file not found: $skillPath"
|
|
}
|
|
if (-not (Test-Path -LiteralPath $unitLogicPath)) {
|
|
throw "UnitLogic file not found: $unitLogicPath"
|
|
}
|
|
|
|
$skillText = Get-Content -LiteralPath $skillPath -Raw -Encoding UTF8
|
|
$unitLogicText = Get-Content -LiteralPath $unitLogicPath -Raw -Encoding UTF8
|
|
|
|
$afterTransformMatch = [regex]::Match(
|
|
$skillText,
|
|
'public override void AfterTransformFromBoat\(UnitData self, GridData grid, MapData mapData, MoveType moveType,\s*\r?\n\s*List<Vector2Int> path = null\)\s*\{[\s\S]*?\r?\n \}'
|
|
)
|
|
if (-not $afterTransformMatch.Success) {
|
|
throw "Karvi landing guardrail failed: missing AfterTransformFromBoat override."
|
|
}
|
|
|
|
$afterTransform = $afterTransformMatch.Value
|
|
foreach ($needle in @(
|
|
'if (moveType != MoveType.ActiveMove) return;',
|
|
'if (!self.GetSkill(SkillType.DASH, out _)) return;',
|
|
'self.AddActionPoint(ActionPointType.Attack);'
|
|
)) {
|
|
if (-not $afterTransform.Contains($needle)) {
|
|
throw "Karvi landing guardrail failed: AfterTransformFromBoat missing '$needle'."
|
|
}
|
|
}
|
|
|
|
foreach ($forbidden in @(
|
|
'TryTriggerMoveBonus',
|
|
'skill is not DashSkill',
|
|
'Level <= 0',
|
|
'HasCharge()'
|
|
)) {
|
|
if ($afterTransform.Contains($forbidden)) {
|
|
throw "Karvi landing guardrail failed: landing reward must not depend on Dash charge state ('$forbidden')."
|
|
}
|
|
}
|
|
|
|
foreach ($needle in @(
|
|
'BoatToLand(mapData, unitData, moveType, path);',
|
|
'unitData.AfterTransformFromBoat(mapData, gridData, moveType, path);'
|
|
)) {
|
|
if (-not $unitLogicText.Contains($needle)) {
|
|
throw "Karvi landing guardrail failed: UnitLogic missing '$needle'."
|
|
}
|
|
}
|
|
|
|
Write-Host "Hakurei Karvi landing dash guardrail passed."
|