Remove impossible cell activity choices
This commit is contained in:
parent
f967d860ee
commit
97f470004b
1 changed files with 34 additions and 6 deletions
|
|
@ -2842,12 +2842,14 @@ fn exact_activity_effect_schema(
|
|||
}
|
||||
})
|
||||
};
|
||||
serde_json::json!({
|
||||
"anyOf":[
|
||||
alternative(&["prepare","investigate","obstruct","communicate"], 0),
|
||||
alternative(&["coordinate","recruit","trade"], 1)
|
||||
]
|
||||
})
|
||||
let mut alternatives = vec![alternative(
|
||||
&["prepare", "investigate", "obstruct", "communicate"],
|
||||
0,
|
||||
)];
|
||||
if !target_ids.is_empty() {
|
||||
alternatives.push(alternative(&["coordinate", "recruit", "trade"], 1));
|
||||
}
|
||||
serde_json::json!({"anyOf":alternatives})
|
||||
}
|
||||
|
||||
fn exact_string_array_schema(
|
||||
|
|
@ -4712,6 +4714,32 @@ mod tests {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn activity_schema_omits_relation_dependent_choices_without_an_exact_target() {
|
||||
let no_target =
|
||||
exact_activity_effect_schema(&BTreeSet::new(), &BTreeSet::from(["village".into()]), 0);
|
||||
assert!(no_target.pointer("/anyOf/1").is_none());
|
||||
assert_eq!(
|
||||
no_target.pointer("/anyOf/0/properties/activity/enum"),
|
||||
Some(&serde_json::json!([
|
||||
"prepare",
|
||||
"investigate",
|
||||
"obstruct",
|
||||
"communicate"
|
||||
]))
|
||||
);
|
||||
|
||||
let exact_target = exact_activity_effect_schema(
|
||||
&BTreeSet::from(["refugee-convoy".into()]),
|
||||
&BTreeSet::from(["village".into()]),
|
||||
0,
|
||||
);
|
||||
assert_eq!(
|
||||
exact_target.pointer("/anyOf/1/properties/activity/enum"),
|
||||
Some(&serde_json::json!(["coordinate", "recruit", "trade"]))
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cell_projection_binds_exact_unique_perspective_owners_into_prose() {
|
||||
let slice = fixture_cell_slice();
|
||||
|
|
|
|||
Loading…
Reference in a new issue