Make castles appear close to towns.

This commit is contained in:
Tormod Gjeitnes Hellen 2023-02-15 22:01:35 +01:00
parent a0dd527a1d
commit 0fbe6a67f2
No known key found for this signature in database
GPG Key ID: 48FAFB3169034023
2 changed files with 6 additions and 6 deletions

View File

@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Bats move slower and use a simple proportional controller to maintain altitude
- Bats now have less health
- Climbing no longer requires having 10 energy
- Castles will now be placed close to towns
### Removed

View File

@ -113,11 +113,8 @@ struct ProximityRequirements {
impl ProximityRequirements {
pub fn satisfied_by(&self, site: Vec2<i32>) -> bool {
let all_of_compliance = self.all_of.iter().all(|spec| spec.satisfied_by(site));
let any_of_compliance = if self.any_of.is_empty() {
true
} else {
self.any_of.iter().any(|spec| spec.satisfied_by(site))
};
let any_of_compliance =
self.any_of.is_empty() || self.any_of.iter().any(|spec| spec.satisfied_by(site));
all_of_compliance && any_of_compliance
}
@ -193,7 +190,9 @@ impl Civs {
0..=5 => (
find_site_loc(
&mut ctx,
&ProximityRequirements::new().avoid_all_of(this.castle_enemies(), 40),
&ProximityRequirements::new()
.avoid_all_of(this.castle_enemies(), 40)
.close_to_one_of(this.towns(), 20),
SiteKind::Castle,
)?,
SiteKind::Castle,