Add weapon move-type effectiveness

This commit is contained in:
2026-06-18 11:20:55 +09:00
parent 47d02e1537
commit 6ca276082e
9 changed files with 173 additions and 10 deletions

View File

@@ -105,10 +105,30 @@ $validSkillEffectTypes = @("stat_bonus", "damage_over_time", "action_lock")
$validSkillAreaShapes = @("single", "diamond")
$validDialogueSides = @("left", "right")
$validPortraitPathPattern = '^res://.+\.(png|jpg|jpeg|webp)$'
$validMoveTypes = New-Object System.Collections.Generic.HashSet[string]
$knownFlagIds = New-Object System.Collections.Generic.HashSet[string]
$knownFlagValueKinds = @{}
$joinedOfficerIds = New-Object System.Collections.Generic.HashSet[string]
foreach ($classProp in $classes.PSObject.Properties) {
$moveType = [string](Get-Prop $classProp.Value "move_type" "foot")
if (-not [string]::IsNullOrWhiteSpace($moveType)) {
$validMoveTypes.Add($moveType) | Out-Null
}
}
foreach ($terrainProp in $terrain.PSObject.Properties) {
$moveCost = Get-Prop $terrainProp.Value "move_cost" $null
if ($null -eq $moveCost) {
continue
}
foreach ($moveCostProp in $moveCost.PSObject.Properties) {
$moveType = [string]$moveCostProp.Name
if (-not [string]::IsNullOrWhiteSpace($moveType)) {
$validMoveTypes.Add($moveType) | Out-Null
}
}
}
foreach ($officerIdValue in (Get-Prop $campaign "initial_joined_officers" @())) {
$officerId = [string]$officerIdValue
if ([string]::IsNullOrWhiteSpace($officerId)) {
@@ -679,6 +699,46 @@ function Check-Item-Effects() {
Fail "Weapon item $itemId is missing weapon_type."
}
Check-Skill-Range (Get-Prop $item "range" 1) "Item $itemId"
$hasEffectiveTypes = Has-Prop $item "effective_vs_move_types"
$hasEffectiveBonus = Has-Prop $item "effective_bonus_damage"
if ($hasEffectiveTypes -or $hasEffectiveBonus) {
if (-not $hasEffectiveTypes -or -not $hasEffectiveBonus) {
Fail "Weapon item $itemId effectiveness requires effective_vs_move_types and effective_bonus_damage."
}
$effectiveTypes = @((Get-Prop $item "effective_vs_move_types" @()))
if ($effectiveTypes.Count -eq 0) {
Fail "Weapon item $itemId effective_vs_move_types must be a non-empty array."
}
$seenEffectiveTypes = New-Object System.Collections.Generic.HashSet[string]
foreach ($moveTypeValue in $effectiveTypes) {
$moveType = [string]$moveTypeValue
if ([string]::IsNullOrWhiteSpace($moveType) -or -not ($moveType -match '^[a-z0-9_]+$')) {
Fail "Weapon item $itemId has unstable effective move type: $moveType"
}
if (-not $validMoveTypes.Contains($moveType)) {
Fail "Weapon item $itemId references unknown effective move type: $moveType"
}
if (-not $seenEffectiveTypes.Add($moveType)) {
Fail "Weapon item $itemId duplicates effective move type: $moveType"
}
}
$effectiveBonus = Get-Prop $item "effective_bonus_damage" 0
if (-not ($effectiveBonus -is [int] -or $effectiveBonus -is [long])) {
Fail "Weapon item $itemId effective_bonus_damage must be an integer."
}
$effectiveBonusValue = [int]$effectiveBonus
if ($effectiveBonusValue -lt 1 -or $effectiveBonusValue -gt 5) {
Fail "Weapon item $itemId effective_bonus_damage must be between 1 and 5."
}
}
}
if ($kind -ne "weapon") {
if (Has-Prop $item "effective_vs_move_types") {
Fail "Item $itemId has effectiveness move types but is not a weapon."
}
if (Has-Prop $item "effective_bonus_damage") {
Fail "Item $itemId has effectiveness bonus but is not a weapon."
}
}
if ($kind -eq "armor" -and (-not (Has-Prop $item "armor_type"))) {
Fail "Armor item $itemId is missing armor_type."