Clay golem attacks done.

This commit is contained in:
Sam 2021-05-04 19:02:18 -04:00
parent 217462805d
commit 5fa4358e74
18 changed files with 217 additions and 6 deletions

View File

@ -216,6 +216,14 @@
(None, "common.abilities.custom.minotaur.frenzy"),
],
),
Custom("Clay Golem"): (
primary: "common.abilities.custom.claygolem.strike",
secondary: "common.abilities.custom.claygolem.laser",
abilities: [
(None, "common.abilities.custom.claygolem.shockwave"),
(None, "common.abilities.custom.claygolem.rocket"),
],
),
Custom("Bird Large Breathe"): (
primary: "common.abilities.custom.birdlargebreathe.firebomb",
secondary: "common.abilities.custom.birdlargebreathe.triplestrike",

View File

@ -0,0 +1,14 @@
BasicBeam(
buildup_duration: 0.20,
recover_duration: 0.20,
beam_duration: 0.25,
damage: 10,
tick_rate: 10.0,
range: 25.0,
max_angle: 1.0,
damage_effect: None,
energy_regen: 50,
energy_drain: 0,
orientation_behavior: Normal,
specifier: ClayGolem,
)

View File

@ -0,0 +1,13 @@
BasicRanged(
energy_cost: 0,
buildup_duration: 0.5,
recover_duration: 0.8,
projectile: ClayRocket(
damage: 500.0,
knockback: 25.0,
radius: 10.0,
),
projectile_body: Object(ClayRocket),
projectile_light: None,
projectile_speed: 20.0,
)

View File

@ -0,0 +1,15 @@
Shockwave(
energy_cost: 0,
buildup_duration: 0.6,
swing_duration: 0.12,
recover_duration: 1.2,
damage: 500,
poise_damage: 50,
knockback: (strength: 40.0, direction: TowardsUp),
shockwave_angle: 360.0,
shockwave_vertical_angle: 90.0,
shockwave_speed: 65.0,
shockwave_duration: 1.0,
requires_ground: true,
move_efficiency: 0.0,
)

View File

@ -0,0 +1,12 @@
BasicMelee(
energy_cost: 0,
buildup_duration: 0.2,
swing_duration: 0.2,
recover_duration: 0.5,
base_damage: 250,
base_poise_damage: 50,
knockback: 10.0,
range: 5.0,
max_angle: 60.0,
damage_effect: None,
)

View File

@ -0,0 +1,19 @@
ItemDef(
name: "Clay Golem Fists",
description: "Yeet.",
kind: Tool((
kind: Natural,
hands: Two,
stats: Direct((
equip_time_secs: 0.001,
power: 1.0,
poise_strength: 1.0,
speed: 1.0,
crit_chance: 0.1,
crit_mult: 1.5,
)),
)),
quality: Low,
tags: [],
ability_spec: Some(Custom("Clay Golem")),
)

View File

@ -66,6 +66,7 @@ const int STATIC_SMOKE = 24;
const int BLOOD = 25;
const int ENRAGED = 26;
const int BIG_SHRAPNEL = 27;
const int LASER = 28;
// meters per second squared (acceleration)
const float earth_gravity = 9.807;
@ -443,6 +444,21 @@ void main() {
vec4(red_color, 0.0, 0.0, 1),
spin_in_axis(vec3(rand6, rand7, rand8), percent() * 10 + 3 * rand9)
);
} else if (inst_mode == LASER) {
f_reflect = 0.0;
vec3 perp_axis = normalize(cross(inst_dir, vec3(0.0, 0.0, 1.0)));
vec3 offset = vec3(0.0);
if (rand0 > 0.0) {
offset = perp_axis * 0.5;
} else {
offset = perp_axis * -0.5;
}
attr = Attr(
inst_dir * percent() + offset,
vec3(1.0, 1.0, 50.0),
vec4(vec3(2.0, 0.0, 0.0), 1),
spin_in_axis(perp_axis, asin(inst_dir.z / length(inst_dir)) + PI / 2.0)
);
} else {
attr = Attr(
linear_motion(

View File

@ -689,4 +689,14 @@
central: ("armor.empty"),
)
),
ClayRocket: (
bone0: (
offset: (-0.5, -6.0, -1.5),
central: ("weapon.projectile.clay-missile"),
),
bone1: (
offset: (0.0, 0.0, 0.0),
central: ("armor.empty"),
)
),
})

BIN
assets/voxygen/voxel/weapon/projectile/clay-missile.vox (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -52,4 +52,5 @@ pub enum FrontendSpecifier {
LifestealBeam,
HealingBeam,
Cultist,
ClayGolem,
}

View File

@ -288,7 +288,7 @@ impl Body {
Body::Dragon(_) => Vec3::new(16.0, 10.0, 16.0),
Body::FishMedium(_) => Vec3::new(0.5, 2.0, 0.8),
Body::FishSmall(_) => Vec3::new(0.3, 1.2, 0.6),
Body::Golem(_) => Vec3::new(5.0, 5.0, 5.0),
Body::Golem(_) => Vec3::new(5.0, 5.0, 8.0),
Body::Humanoid(humanoid) => {
let height = match (humanoid.species, humanoid.body_type) {
(humanoid::Species::Orc, humanoid::BodyType::Male) => 2.3,

View File

@ -81,6 +81,7 @@ make_case_elim!(
Coins = 66,
GoldOre = 67,
SilverOre = 68,
ClayRocket = 69,
}
);
@ -91,7 +92,7 @@ impl Body {
}
}
pub const ALL_OBJECTS: [Body; 69] = [
pub const ALL_OBJECTS: [Body; 70] = [
Body::Arrow,
Body::Bomb,
Body::Scarecrow,
@ -161,6 +162,7 @@ pub const ALL_OBJECTS: [Body; 69] = [
Body::Coins,
Body::SilverOre,
Body::GoldOre,
Body::ClayRocket,
];
impl From<Body> for super::Body {
@ -239,6 +241,7 @@ impl Body {
Body::Coins => "coins",
Body::SilverOre => "silver_ore",
Body::GoldOre => "gold_ore",
Body::ClayRocket => "clay_rocket",
}
}
@ -328,6 +331,7 @@ impl Body {
Body::WindowSpooky => 10.0,
Body::SilverOre => 1000.0,
Body::GoldOre => 1000.0,
Body::ClayRocket => 50.0,
};
Mass(m)

View File

@ -59,6 +59,11 @@ pub enum ProjectileConstructor {
radius: f32,
},
Possess,
ClayRocket {
damage: f32,
radius: f32,
knockback: f32,
},
}
impl ProjectileConstructor {
@ -205,6 +210,47 @@ impl ProjectileConstructor {
owner,
ignore_group: false,
},
ClayRocket {
damage,
radius,
knockback,
} => {
let knockback = AttackEffect::new(
Some(GroupTarget::OutOfGroup),
CombatEffect::Knockback(Knockback {
strength: knockback,
direction: KnockbackDir::Away,
}),
)
.with_requirement(CombatRequirement::AnyDamage);
let damage = AttackDamage::new(
Damage {
source: DamageSource::Explosion,
value: damage,
kind: DamageKind::Energy,
},
Some(GroupTarget::OutOfGroup),
);
let attack = Attack::default()
.with_damage(damage)
.with_crit(crit_chance, crit_mult)
.with_effect(knockback);
let explosion = Explosion {
effects: vec![
RadiusEffect::Attack(attack),
RadiusEffect::TerrainDestruction(5.0),
],
radius,
reagent: Some(Reagent::Red),
};
Projectile {
hit_solid: vec![Effect::Explode(explosion.clone()), Effect::Vanish],
hit_entity: vec![Effect::Explode(explosion), Effect::Vanish],
time_left: Duration::from_secs(10),
owner,
ignore_group: true,
}
},
}
}
@ -246,6 +292,14 @@ impl ProjectileConstructor {
*radius *= range;
},
Possess => {},
ClayRocket {
ref mut damage,
ref mut radius,
..
} => {
*damage *= power;
*radius *= range;
},
}
self
}

View File

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

View File

@ -402,6 +402,9 @@ impl SfxMgr {
audio.emit_sfx(sfx_trigger_item, *pos, None, false);
}
},
beam::FrontendSpecifier::ClayGolem => {
// TODO: Get sfx for this
},
},
Outcome::BreakBlock { pos, .. } => {
let sfx_trigger_item = triggers.get_key_value(&SfxEvent::BreakBlock);

View File

@ -124,6 +124,7 @@ pub enum ParticleMode {
Blood = 25,
Enraged = 26,
BigShrapnel = 27,
Laser = 28,
}
impl ParticleMode {

View File

@ -4327,6 +4327,29 @@ impl FigureMgr {
skeleton_attr,
)
},
CharacterState::BasicMelee(s) => {
let stage_time = s.timer.as_secs_f32();
let stage_progress = match s.stage_section {
StageSection::Buildup => {
stage_time / s.static_data.buildup_duration.as_secs_f32()
},
StageSection::Swing => {
stage_time / s.static_data.swing_duration.as_secs_f32()
},
StageSection::Recover => {
stage_time / s.static_data.recover_duration.as_secs_f32()
},
_ => 0.0,
};
anim::golem::AlphaAnimation::update_skeleton(
&target_base,
(Some(s.stage_section), time, state.state_time),
stage_progress,
&mut state_animation_rate,
skeleton_attr,
)
},
CharacterState::Shockwave(s) => {
let stage_time = s.timer.as_secs_f32();
let stage_progress = match s.stage_section {

View File

@ -791,6 +791,7 @@ impl ParticleMgr {
beam::FrontendSpecifier::HealingBeam => {
// Emit a light when using healing
lights.push(Light::new(pos.0, Rgb::new(0.1, 1.0, 0.15), 1.0));
self.particles.reserve(beam_tick_count as usize);
for i in 0..beam_tick_count {
self.particles.push(Particle::new_directed(
beam.properties.duration,
@ -804,6 +805,7 @@ impl ParticleMgr {
beam::FrontendSpecifier::LifestealBeam => {
// Emit a light when using lifesteal beam
lights.push(Light::new(pos.0, Rgb::new(0.8, 1.0, 0.5), 1.0));
self.particles.reserve(beam_tick_count as usize);
for i in 0..beam_tick_count {
self.particles.push(Particle::new_directed(
beam.properties.duration,
@ -814,6 +816,17 @@ impl ParticleMgr {
));
}
},
beam::FrontendSpecifier::ClayGolem => {
self.particles.resize_with(self.particles.len() + 2, || {
Particle::new_directed(
beam.properties.duration,
time,
ParticleMode::Laser,
pos.0,
pos.0 + *ori.look_dir() * range,
)
})
},
}
}
}
@ -1110,11 +1123,13 @@ impl ParticleMgr {
let distance =
shockwave.properties.speed * (elapsed as f32 - sub_tick_interpolation);
let new_particle_count = distance / scale as f32;
let particle_count_factor = radians / (3.0 * scale);
let new_particle_count = distance * particle_count_factor;
self.particles.reserve(new_particle_count as usize);
for d in 0..((distance / scale) as i32) {
let arc_position = theta - radians / 2.0 + dtheta * d as f32 * scale;
for d in 0..(new_particle_count as i32) {
let arc_position =
theta - radians / 2.0 + dtheta * d as f32 / particle_count_factor;
let position = pos.0
+ distance * Vec3::new(arc_position.cos(), arc_position.sin(), 0.0);