more variable alignments

This commit is contained in:
Monty Marz 2020-08-13 22:27:07 +02:00
parent b930c34d89
commit 0512c7a764
2 changed files with 28 additions and 11 deletions

View File

@ -396,7 +396,7 @@ pub fn apply_caves_supplement<'a>(
comp::quadruped_small::Body::random_with(rng, &species).into() comp::quadruped_small::Body::random_with(rng, &species).into()
}, },
1 => { 1 => {
is_hostile = false; is_hostile = true;
let species = match rng.gen_range(0, 5) { let species = match rng.gen_range(0, 5) {
0 => comp::quadruped_medium::Species::Tarasque, 0 => comp::quadruped_medium::Species::Tarasque,
_ => comp::quadruped_medium::Species::Bonerattler, _ => comp::quadruped_medium::Species::Bonerattler,
@ -404,7 +404,7 @@ pub fn apply_caves_supplement<'a>(
comp::quadruped_medium::Body::random_with(rng, &species).into() comp::quadruped_medium::Body::random_with(rng, &species).into()
}, },
2 => { 2 => {
is_hostile = false; is_hostile = true;
let species = match rng.gen_range(0, 4) { let species = match rng.gen_range(0, 4) {
1 => comp::quadruped_low::Species::Rocksnapper, 1 => comp::quadruped_low::Species::Rocksnapper,
_ => comp::quadruped_low::Species::Salamander, _ => comp::quadruped_low::Species::Salamander,

View File

@ -236,18 +236,35 @@ impl World {
&& sim_chunk.chaos < 0.5 && sim_chunk.chaos < 0.5
&& !sim_chunk.is_underwater() && !sim_chunk.is_underwater()
{ {
let is_hostile: bool;
let entity = EntityInfo::at(gen_entity_pos()) let entity = EntityInfo::at(gen_entity_pos())
.with_alignment(match rng.gen_range(0, 10) {
0 => comp::Alignment::Enemy,
_ => comp::Alignment::Wild,
})
.do_if(rng.gen_range(0, 8) == 0, |e| e.into_giant()) .do_if(rng.gen_range(0, 8) == 0, |e| e.into_giant())
.with_body(match rng.gen_range(0, 5) { .with_body(match rng.gen_range(0, 5) {
0 => comp::Body::QuadrupedMedium(quadruped_medium::Body::random()), 0 => {
1 => comp::Body::BirdMedium(bird_medium::Body::random()), is_hostile = true;
2 => comp::Body::Critter(critter::Body::random()), comp::Body::QuadrupedMedium(quadruped_medium::Body::random())
3 => comp::Body::QuadrupedLow(quadruped_low::Body::random()), },
_ => comp::Body::QuadrupedSmall(quadruped_small::Body::random()), 1 => {
is_hostile = false;
comp::Body::BirdMedium(bird_medium::Body::random())
},
2 => {
is_hostile = false;
comp::Body::Critter(critter::Body::random())
},
3 => {
is_hostile = false;
comp::Body::QuadrupedLow(quadruped_low::Body::random())
},
_ => {
is_hostile = false;
comp::Body::QuadrupedSmall(quadruped_small::Body::random())
},
})
.with_alignment(if is_hostile {
comp::Alignment::Enemy
} else {
comp::Alignment::Wild
}) })
.with_automatic_name(); .with_automatic_name();