Clamp battle save unit levels
This commit is contained in:
@@ -55,6 +55,7 @@ try {
|
|||||||
['self-targeting attack intent', { attackIntents: [{ attackerId: 'liu-bei', targetId: 'liu-bei' }] }],
|
['self-targeting attack intent', { attackIntents: [{ attackerId: 'liu-bei', targetId: 'liu-bei' }] }],
|
||||||
['duplicate attack intent attacker id', { attackIntents: [{ attackerId: 'liu-bei', targetId: 'rebel-1' }, { attackerId: 'liu-bei', targetId: 'rebel-1' }] }],
|
['duplicate attack intent attacker id', { attackIntents: [{ attackerId: 'liu-bei', targetId: 'rebel-1' }, { attackerId: 'liu-bei', targetId: 'rebel-1' }] }],
|
||||||
['invalid units array', { units: {} }],
|
['invalid units array', { units: {} }],
|
||||||
|
['too high unit level', { units: patchUnit(0, { level: 100, exp: 0 }) }],
|
||||||
['invalid unit exp threshold', { units: patchUnit(0, { exp: 100 }) }],
|
['invalid unit exp threshold', { units: patchUnit(0, { exp: 100 }) }],
|
||||||
['invalid max-level unit exp threshold', { units: patchUnit(0, { level: 99, exp: 101 }) }],
|
['invalid max-level unit exp threshold', { units: patchUnit(0, { level: 99, exp: 101 }) }],
|
||||||
['invalid unit hp', { units: patchUnit(0, { hp: 99, maxHp: 30 }) }],
|
['invalid unit hp', { units: patchUnit(0, { hp: 99, maxHp: 30 }) }],
|
||||||
|
|||||||
@@ -294,6 +294,7 @@ function isEquipmentStateForSlot(value: unknown, slot: EquipmentSlot, options: B
|
|||||||
function isValidCharacterProgress(level: unknown, exp: unknown) {
|
function isValidCharacterProgress(level: unknown, exp: unknown) {
|
||||||
return (
|
return (
|
||||||
isPositiveInteger(level) &&
|
isPositiveInteger(level) &&
|
||||||
|
Number(level) <= 99 &&
|
||||||
Number.isInteger(exp) &&
|
Number.isInteger(exp) &&
|
||||||
Number(exp) >= 0 &&
|
Number(exp) >= 0 &&
|
||||||
(Number(level) >= 99 ? Number(exp) <= 100 : Number(exp) < 100)
|
(Number(level) >= 99 ? Number(exp) <= 100 : Number(exp) < 100)
|
||||||
|
|||||||
Reference in New Issue
Block a user