Restrict battle item stocks to allies
This commit is contained in:
@@ -101,6 +101,7 @@ try {
|
||||
['invalid item stock count', { itemStocks: { 'liu-bei': { bean: -1 } } }],
|
||||
['too many item stock count', { itemStocks: { 'liu-bei': { bean: 4, wine: 2 } } }],
|
||||
['unknown item stock unit id', { itemStocks: { 'ghost-unit': { bean: 1 } } }],
|
||||
['enemy item stock unit id', { itemStocks: { 'rebel-1': { bean: 1 } } }],
|
||||
['unknown item stock item id', { itemStocks: { 'liu-bei': { phantomItem: 1 } } }],
|
||||
['invalid buff turns', { battleBuffs: [{ ...validState.battleBuffs[0], turns: 0 }] }],
|
||||
['too many buff turns', { battleBuffs: [{ ...validState.battleBuffs[0], turns: 10 }] }],
|
||||
|
||||
@@ -430,6 +430,7 @@ function isOptionalItemStockRecord(value: unknown, options: BattleSaveValidation
|
||||
return Object.entries(value).every(
|
||||
([unitId, stocks]) =>
|
||||
isKnownUnitId(unitId, options) &&
|
||||
(!options.validAllyUnitIds || options.validAllyUnitIds.has(unitId)) &&
|
||||
isRecord(stocks) &&
|
||||
Object.keys(stocks).length <= itemReferenceLimit(options) &&
|
||||
Object.entries(stocks).every(
|
||||
|
||||
Reference in New Issue
Block a user