adds mob ancestries, converts everything over to get_reactions()

This commit is contained in:
Llywelwyn 2023-08-21 10:40:30 +01:00
parent 614653e028
commit 9e26c41aad
5 changed files with 40 additions and 54 deletions

View file

@ -96,6 +96,9 @@ impl RawMaster {
}
self.faction_index.insert(faction.id.clone(), reactions);
}
for ancestry in self.raws.ancestries.iter() {
self.ancestry_index.insert(ancestry.id.clone(), ancestry.allies.clone());
}
}
}
@ -851,14 +854,15 @@ pub fn ancestry_reaction(this_ancestry: Ancestry, other_ancestry: Ancestry, raws
} else {
let this_ancestry = get_ancestry_string(this_ancestry);
let other_ancestry = get_ancestry_string(other_ancestry);
console::log(format!("{:?}", this_ancestry));
if raws.ancestry_index.contains_key(this_ancestry) {
let mine = &raws.ancestry_index[this_ancestry];
console::log(format!("{:?}", mine));
if mine.contains(other_ancestry) {
return Some(Reaction::Ignore);
}
}
}
return None;
}