Merge branch 'phoenix_tweaks' into 'master'

phoenix_tweaks

See merge request veloren/veloren!4331
This commit is contained in:
flo 2024-02-18 19:11:34 +00:00
commit 9031ac922a
3 changed files with 29 additions and 16 deletions

View File

@ -9,7 +9,7 @@ RapidMelee(
knockback: 50, knockback: 50,
energy_regen: 0, energy_regen: 0,
), ),
range: 3.5, range: 2.0,
angle: 360, angle: 360,
multi_target: Some(Normal), multi_target: Some(Normal),
damage_effect: Some(Buff(( damage_effect: Some(Buff((

View File

@ -147,7 +147,14 @@ impl CharacterBehavior for Data {
let length = rand::thread_rng().gen_range( let length = rand::thread_rng().gen_range(
self.static_data.summon_distance.0..=self.static_data.summon_distance.1, self.static_data.summon_distance.0..=self.static_data.summon_distance.1,
); );
let extra_height =
if self.static_data.summon_info.body == Object(FieryTornado) {
15.0
} else {
0.0
};
let position =
Vec3::new(data.pos.0.x, data.pos.0.y, data.pos.0.z + extra_height);
// Summon in a clockwise fashion // Summon in a clockwise fashion
let ray_vector = Vec3::new( let ray_vector = Vec3::new(
(summon_frac * 2.0 * PI).sin() * length, (summon_frac * 2.0 * PI).sin() * length,
@ -158,16 +165,16 @@ impl CharacterBehavior for Data {
// Check for collision on the xy plane, subtract 1 to get point before block // Check for collision on the xy plane, subtract 1 to get point before block
let obstacle_xy = data let obstacle_xy = data
.terrain .terrain
.ray(data.pos.0, data.pos.0 + length * ray_vector) .ray(position, position + length * ray_vector)
.until(Block::is_solid) .until(Block::is_solid)
.cast() .cast()
.0 .0
.sub(1.0); .sub(1.0);
let collision_vector = Vec3::new( let collision_vector = Vec3::new(
data.pos.0.x + (summon_frac * 2.0 * PI).sin() * obstacle_xy, position.x + (summon_frac * 2.0 * PI).sin() * obstacle_xy,
data.pos.0.y + (summon_frac * 2.0 * PI).cos() * obstacle_xy, position.y + (summon_frac * 2.0 * PI).cos() * obstacle_xy,
data.pos.0.z + data.body.eye_height(data.scale.map_or(1.0, |s| s.0)), position.z + data.body.eye_height(data.scale.map_or(1.0, |s| s.0)),
); );
// Check for collision in z up to 50 blocks // Check for collision in z up to 50 blocks
@ -188,19 +195,11 @@ impl CharacterBehavior for Data {
is_sticky: false, is_sticky: false,
is_point: false, is_point: false,
}); });
let extra_height =
if self.static_data.summon_info.body == Object(FieryTornado) {
5.0
} else {
0.0
};
let mut rng = rand::thread_rng(); let mut rng = rand::thread_rng();
// Send server event to create npc // Send server event to create npc
output_events.emit_server(CreateNpcEvent { output_events.emit_server(CreateNpcEvent {
pos: comp::Pos( pos: comp::Pos(collision_vector - Vec3::unit_z() * obstacle_z),
collision_vector - Vec3::unit_z() * obstacle_z + extra_height,
),
ori: comp::Ori::from(Dir::random_2d(&mut rng)), ori: comp::Ori::from(Dir::random_2d(&mut rng)),
npc: NpcBuilder::new(stats, body, comp::Alignment::Owned(*data.uid)) npc: NpcBuilder::new(stats, body, comp::Alignment::Owned(*data.uid))
.with_skill_set(skill_set) .with_skill_set(skill_set)

View File

@ -3000,6 +3000,7 @@ impl<'a> AgentData<'a> {
enum ActionStateTimers { enum ActionStateTimers {
AttackTimer1, AttackTimer1,
AttackTimer2, AttackTimer2,
WaterTimer,
} }
let attack_timer_1 = let attack_timer_1 =
@ -3053,7 +3054,20 @@ impl<'a> AgentData<'a> {
// Flee from the ground! The internet told me it was lava! // Flee from the ground! The internet told me it was lava!
// If on the ground, jump with every last ounce of energy, holding onto // If on the ground, jump with every last ounce of energy, holding onto
// all that is dear in life and straining for the wide open skies. // all that is dear in life and straining for the wide open skies.
if self.physics_state.on_ground.is_some() {
// Don't stay in water
if matches!(self.physics_state.in_fluid, Some(Fluid::Liquid { .. })) {
agent.combat_state.timers[ActionStateTimers::WaterTimer as usize] = 2.0;
};
if agent.combat_state.timers[ActionStateTimers::WaterTimer as usize] > 0.0 {
agent.combat_state.timers[ActionStateTimers::WaterTimer as usize] -= read_data.dt.0;
if agent.combat_state.timers[ActionStateTimers::WaterTimer as usize] > 1.0 {
controller.inputs.move_z = 1.0
} else {
// heat laser
controller.push_basic_input(InputKind::Ability(3))
}
} else if self.physics_state.on_ground.is_some() {
controller.push_basic_input(InputKind::Jump); controller.push_basic_input(InputKind::Jump);
} else { } else {
// Use a proportional controller with a coefficient of 1.0 to // Use a proportional controller with a coefficient of 1.0 to