Added armor, more ai tweaks.

This commit is contained in:
Sam 2021-05-06 12:39:32 -04:00
parent 1c8db241e2
commit 9f8aeb91c0
5 changed files with 37 additions and 4 deletions

View File

@ -0,0 +1,13 @@
ItemDef(
name: "Clay Golem Armor",
description: "Worn by clay golem.",
kind: Armor((
kind: Chest("Clay Golem"),
stats: (
protection: Normal(180.0),
poise_resilience: Normal(1.0),
),
)),
quality: Legendary,
tags: [],
)

View File

@ -568,7 +568,7 @@ impl Body {
},
Body::BipedSmall(_) => 10,
Body::Object(_) => 10,
Body::Golem(_) => 260,
Body::Golem(_) => 0,
Body::Theropod(_) => 20,
Body::QuadrupedLow(quadruped_low) => match quadruped_low.species {
quadruped_low::Species::Crocodile => 20,
@ -602,6 +602,7 @@ impl Body {
pub fn immune_to(&self, buff: BuffKind) -> bool {
match buff {
BuffKind::Bleeding => matches!(self, Body::Object(_) | Body::Golem(_) | Body::Ship(_)),
BuffKind::Burning => matches!(self, Body::Golem(_)),
_ => false,
}
}

View File

@ -980,6 +980,15 @@ impl LoadoutBuilder {
.build(),
_ => LoadoutBuilder::new().active_item(active_item).build(),
},
Body::Golem(g) => match g.species {
golem::Species::ClayGolem => LoadoutBuilder::new()
.active_item(active_item)
.chest(Some(Item::new_from_asset_expect(
"common.items.npc_armor.golem.claygolem",
)))
.build(),
_ => LoadoutBuilder::new().active_item(active_item).build(),
},
_ => LoadoutBuilder::new().active_item(active_item).build(),
}
};

View File

@ -139,7 +139,7 @@ impl CharacterBehavior for Data {
specifier: self.static_data.specifier,
};
let body_offsets_z = match data.body {
Body::BirdLarge(_) | Body::Golem(_) => data.body.height() * 0.9,
Body::BirdLarge(_) | Body::Golem(_) => data.body.height() * 0.8,
_ => data.body.height() * 0.5,
};
// Gets offsets

View File

@ -1647,6 +1647,18 @@ impl<'a> AgentData<'a> {
),
)
}
Tactic::ClayGolem if matches!(self.char_state, CharacterState::BasicRanged(_)) => {
const ROCKET_SPEED: f32 = 20.0;
aim_projectile(
ROCKET_SPEED,
Vec3::new(self.pos.0.x, self.pos.0.y, self.pos.0.z + eye_offset),
Vec3::new(
tgt_data.pos.0.x,
tgt_data.pos.0.y,
tgt_data.pos.0.z + tgt_eye_offset,
),
)
},
_ => Dir::from_unnormalized(
Vec3::new(
tgt_data.pos.0.x,
@ -3493,8 +3505,6 @@ impl<'a> AgentData<'a> {
} else if attack_data.dist_sqrd < GOLEM_LONG_RANGE.powi(2) {
if target_speed_sqd < GOLEM_TARGET_SPEED.powi(2) {
// If target is far-ish and moving slow-ish, rocket them
// TODO: Maybe some look_dir shenanigans? Also maybe use condition so they
// stop and aim a bit first?
controller
.actions
.push(ControlAction::basic_input(InputKind::Ability(1)));