50 lines
2.5 KiB
PowerShell
50 lines
2.5 KiB
PowerShell
param(
|
|
[string]$UnitLogicFile = "Unity/Assets/Scripts/TH1_Logic/Unit/UnitLogic.cs",
|
|
[string]$UnitDataFile = "Unity/Assets/Scripts/TH1_Data/UnitData.cs",
|
|
[string]$MomijiHunterSkillFile = "Unity/Assets/Scripts/TH1_Logic/Skill/AllSkill/MomijiHunterSkill.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())
|
|
|
|
function Read-RepoFile([string]$relativePath) {
|
|
$fullPath = Join-Path $repoRoot $relativePath
|
|
if (-not (Test-Path -LiteralPath $fullPath)) {
|
|
throw "Required file not found: $fullPath"
|
|
}
|
|
return Get-Content -LiteralPath $fullPath -Raw -Encoding UTF8
|
|
}
|
|
|
|
function Assert-Contains([string]$text, [string]$needle, [string]$label) {
|
|
if (-not $text.Contains($needle)) {
|
|
throw "Momiji hunter movement guardrail failed: $label missing '$needle'."
|
|
}
|
|
}
|
|
|
|
$unitLogicText = Read-RepoFile $UnitLogicFile
|
|
$unitDataText = Read-RepoFile $UnitDataFile
|
|
$momijiHunterSkillText = Read-RepoFile $MomijiHunterSkillFile
|
|
|
|
Assert-Contains $unitDataText 'public int FinalMoveRangeIgnoringSkill(MapData mapData, SkillType ignoredSkillType)' 'movement calculation can exclude conditional skill bonuses'
|
|
Assert-Contains $unitLogicText 'unitData.FinalMoveRangeIgnoringSkill(mapData, SkillType.MOMIJIHUNTER)' 'base movement must exclude Momiji hunter bonus'
|
|
Assert-Contains $unitLogicText 'MomijiHunterMovementRemainMap' 'separate Momiji hunter movement map'
|
|
Assert-Contains $unitLogicText 'MomijiHunterTargetMap' 'separate Momiji hunter target map'
|
|
Assert-Contains $unitLogicText 'MomijiHunterTargetMap[end.x, end.y] || SanaeFromMomijiHunterMap[end.x, end.y]' 'path lookup must use hunter map for hunter-derived targets'
|
|
Assert-Contains $unitLogicText 'if (floor > 0.1f) continue;' 'hunter bonus must only apply to prey-adjacent target grids'
|
|
Assert-Contains $momijiHunterSkillText 'unit.HasEffectiveSkill(SkillType.MOMIJIPREY, out var _)' 'prey marker must be an effective skill'
|
|
|
|
if ($unitLogicText.Contains('MovementRemainMap[i, j] + MoveRealCostMap[i, j] - floor')) {
|
|
throw "Momiji hunter movement guardrail failed: old global add-then-payback formula returned."
|
|
}
|
|
|
|
if ($unitLogicText.Contains('FinalReachMap[i,j] = NormalReachMap[i, j] && MomijiHunterReachMap[i, j]')) {
|
|
throw "Momiji hunter movement guardrail failed: old NormalReachMap && MomijiHunterReachMap merge returned."
|
|
}
|
|
|
|
Write-Host "Momiji hunter movement guardrail passed."
|