Added sfx. Addressed comments.

This commit is contained in:
Sam 2021-04-28 18:41:04 -04:00
parent 48fa4e7c1f
commit 5c241850f1
13 changed files with 137 additions and 122 deletions

View File

@ -7,7 +7,7 @@ BasicMelee(
base_poise_damage: 60.0, base_poise_damage: 60.0,
knockback: 15.0, knockback: 15.0,
range: 5.0, range: 5.0,
max_angle: 90.0, max_angle: 60.0,
damage_effect: Some(Buff(( damage_effect: Some(Buff((
kind: Crippled, kind: Crippled,
dur_secs: 15.0, dur_secs: 15.0,

View File

@ -824,5 +824,12 @@
], ],
threshold: 1.25, threshold: 1.25,
), ),
GroundSlam: (
files: [
"voxygen.audio.sfx.abilities.minotaur_smash_1",
"voxygen.audio.sfx.abilities.minotaur_smash_2",
],
threshold: 0.2,
),
} }
) )

BIN
assets/voxygen/audio/sfx/abilities/minotaur_smash_1.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/abilities/minotaur_smash_2.ogg (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -20,7 +20,7 @@
"buff.title.protectingward": "Protecting Ward", "buff.title.protectingward": "Protecting Ward",
"buff.desc.protectingward": "You are protected, somewhat, from attacks.", "buff.desc.protectingward": "You are protected, somewhat, from attacks.",
"buff.title.frenzied": "Frenzied", "buff.title.frenzied": "Frenzied",
"buff.desc.frenzied": "You are imbued with nunnatural speed and can ignore minor injuries." "buff.desc.frenzied": "You are imbued with unnatural speed and can ignore minor injuries.",
// Debuffs // Debuffs
"buff.title.bleed": "Bleeding", "buff.title.bleed": "Bleeding",
"buff.desc.bleed": "Inflicts regular damage.", "buff.desc.bleed": "Inflicts regular damage.",

View File

@ -306,9 +306,9 @@ pub struct Agent {
#[derive(Clone, Debug, Default)] #[derive(Clone, Debug, Default)]
pub struct ActionState { pub struct ActionState {
pub action_timer: f32, pub timer: f32,
pub action_float: f32, pub counter: f32,
pub action_bool: bool, pub condition: bool,
} }
impl Agent { impl Agent {

View File

@ -289,7 +289,7 @@ impl Buff {
vec![ vec![
BuffEffect::MovementSpeed(1.0 + data.strength), BuffEffect::MovementSpeed(1.0 + data.strength),
BuffEffect::HealthChangeOverTime { BuffEffect::HealthChangeOverTime {
rate: data.strength * 500.0, rate: data.strength * 100.0,
accumulated: 0.0, accumulated: 0.0,
kind: ModifierKind::Additive, kind: ModifierKind::Additive,
}, },

View File

@ -68,7 +68,7 @@ pub enum Outcome {
pos: Vec3<f32>, pos: Vec3<f32>,
state: PoiseState, state: PoiseState,
}, },
Bonk { GroundSlam {
pos: Vec3<f32>, pos: Vec3<f32>,
}, },
} }
@ -85,7 +85,7 @@ impl Outcome {
| Outcome::Damage { pos, .. } | Outcome::Damage { pos, .. }
| Outcome::Block { pos, .. } | Outcome::Block { pos, .. }
| Outcome::PoiseChange { pos, .. } | Outcome::PoiseChange { pos, .. }
| Outcome::Bonk { pos } => Some(*pos), | Outcome::GroundSlam { pos } => Some(*pos),
Outcome::BreakBlock { pos, .. } => Some(pos.map(|e| e as f32 + 0.5)), Outcome::BreakBlock { pos, .. } => Some(pos.map(|e| e as f32 + 0.5)),
Outcome::ExpChange { .. } | Outcome::ComboChange { .. } => None, Outcome::ExpChange { .. } | Outcome::ComboChange { .. } => None,
} }

View File

@ -208,7 +208,7 @@ impl CharacterBehavior for Data {
// Send local event used for frontend shenanigans // Send local event used for frontend shenanigans
update update
.local_events .local_events
.push_front(LocalEvent::CreateOutcome(Outcome::Bonk { .push_front(LocalEvent::CreateOutcome(Outcome::GroundSlam {
pos: data.pos.0 pos: data.pos.0
+ *data.ori.look_dir() + *data.ori.look_dir()
* (data.body.radius() + self.static_data.range), * (data.body.radius() + self.static_data.range),
@ -266,6 +266,7 @@ impl CharacterBehavior for Data {
} }
} }
/// Used to specify a particular effect for frontend purposes
#[derive(Copy, Clone, Debug, Serialize, Deserialize, PartialEq)] #[derive(Copy, Clone, Debug, Serialize, Deserialize, PartialEq)]
pub enum FrontendSpecifier { pub enum FrontendSpecifier {
GroundCleave, GroundCleave,

View File

@ -71,7 +71,7 @@ impl Body {
biped_large::Species::Occultsaurok => 100.0, biped_large::Species::Occultsaurok => 100.0,
biped_large::Species::Mightysaurok => 100.0, biped_large::Species::Mightysaurok => 100.0,
biped_large::Species::Mindflayer => 90.0, biped_large::Species::Mindflayer => 90.0,
biped_large::Species::Minotaur => 80.0, biped_large::Species::Minotaur => 70.0,
_ => 80.0, _ => 80.0,
}, },
Body::BirdMedium(_) => 80.0, Body::BirdMedium(_) => 80.0,

View File

@ -550,10 +550,10 @@ impl<'a> AgentData<'a> {
} }
// Interact if incoming messages // Interact if incoming messages
if !agent.inbox.is_empty() { if !agent.inbox.is_empty() {
agent.action_state.action_timer = 0.1; agent.action_state.timer = 0.1;
} }
if agent.action_state.action_timer > 0.0 { if agent.action_state.timer > 0.0 {
if agent.action_state.action_timer if agent.action_state.timer
< (if agent.behavior.is(BehaviorState::TRADING) { < (if agent.behavior.is(BehaviorState::TRADING) {
TRADE_INTERACTION_TIME TRADE_INTERACTION_TIME
} else { } else {
@ -562,7 +562,7 @@ impl<'a> AgentData<'a> {
{ {
self.interact(agent, controller, &read_data, event_emitter); self.interact(agent, controller, &read_data, event_emitter);
} else { } else {
agent.action_state.action_timer = 0.0; agent.action_state.timer = 0.0;
agent.target = None; agent.target = None;
controller.actions.push(ControlAction::Stand); controller.actions.push(ControlAction::Stand);
self.idle(agent, controller, &read_data); self.idle(agent, controller, &read_data);
@ -582,7 +582,7 @@ impl<'a> AgentData<'a> {
event_emitter: &mut Emitter<'_, ServerEvent>, event_emitter: &mut Emitter<'_, ServerEvent>,
) { ) {
if self.damage < HEALING_ITEM_THRESHOLD && self.heal_self(agent, controller) { if self.damage < HEALING_ITEM_THRESHOLD && self.heal_self(agent, controller) {
agent.action_state.action_timer = 0.01; agent.action_state.timer = 0.01;
return; return;
} }
@ -596,14 +596,14 @@ impl<'a> AgentData<'a> {
let dist_sqrd = self.pos.0.distance_squared(tgt_pos.0); let dist_sqrd = self.pos.0.distance_squared(tgt_pos.0);
// Should the agent flee? // Should the agent flee?
if 1.0 - agent.psyche.aggro > self.damage && self.flees { if 1.0 - agent.psyche.aggro > self.damage && self.flees {
if agent.action_state.action_timer == 0.0 if agent.action_state.timer == 0.0
&& agent.behavior.can(BehaviorCapability::SPEAK) && agent.behavior.can(BehaviorCapability::SPEAK)
{ {
let msg = "npc.speech.villager_under_attack".to_string(); let msg = "npc.speech.villager_under_attack".to_string();
event_emitter event_emitter
.emit(ServerEvent::Chat(UnresolvedChatMsg::npc(*self.uid, msg))); .emit(ServerEvent::Chat(UnresolvedChatMsg::npc(*self.uid, msg)));
agent.action_state.action_timer = 0.01; agent.action_state.timer = 0.01;
} else if agent.action_state.action_timer < FLEE_DURATION } else if agent.action_state.timer < FLEE_DURATION
|| dist_sqrd < MAX_FLEE_DIST || dist_sqrd < MAX_FLEE_DIST
{ {
self.flee( self.flee(
@ -614,7 +614,7 @@ impl<'a> AgentData<'a> {
&read_data.dt, &read_data.dt,
); );
} else { } else {
agent.action_state.action_timer = 0.0; agent.action_state.timer = 0.0;
agent.target = None; agent.target = None;
self.idle(agent, controller, &read_data); self.idle(agent, controller, &read_data);
} }
@ -709,11 +709,11 @@ impl<'a> AgentData<'a> {
}; };
if self.damage < HEALING_ITEM_THRESHOLD && self.heal_self(agent, controller) { if self.damage < HEALING_ITEM_THRESHOLD && self.heal_self(agent, controller) {
agent.action_state.action_timer = 0.01; agent.action_state.timer = 0.01;
return; return;
} }
agent.action_state.action_timer = 0.0; agent.action_state.timer = 0.0;
if let Some((travel_to, _destination)) = &agent.rtsim_controller.travel_to { if let Some((travel_to, _destination)) = &agent.rtsim_controller.travel_to {
// if it has an rtsim destination and can fly then it should // if it has an rtsim destination and can fly then it should
// if it is flying and bumps something above it then it should move down // if it is flying and bumps something above it then it should move down
@ -905,7 +905,7 @@ impl<'a> AgentData<'a> {
// .events // .events
// .push(ControlEvent::InviteResponse(InviteResponse::Decline)); // .push(ControlEvent::InviteResponse(InviteResponse::Decline));
// } // }
agent.action_state.action_timer += read_data.dt.0; agent.action_state.timer += read_data.dt.0;
let msg = agent.inbox.pop_back(); let msg = agent.inbox.pop_back();
match msg { match msg {
Some(AgentEvent::Talk(by, subject)) => { Some(AgentEvent::Talk(by, subject)) => {
@ -1254,7 +1254,7 @@ impl<'a> AgentData<'a> {
if let Some(Target { target, .. }) = &agent.target { if let Some(Target { target, .. }) = &agent.target {
self.look_toward(controller, read_data, target); self.look_toward(controller, read_data, target);
} else { } else {
agent.action_state.action_timer = 0.0; agent.action_state.timer = 0.0;
} }
} }
}, },
@ -1318,7 +1318,7 @@ impl<'a> AgentData<'a> {
self.jump_if(controller, bearing.z > 1.5); self.jump_if(controller, bearing.z > 1.5);
controller.inputs.move_z = bearing.z; controller.inputs.move_z = bearing.z;
} }
agent.action_state.action_timer += dt.0; agent.action_state.timer += dt.0;
} }
/// Attempt to consume a healing item, and return whether any healing items /// Attempt to consume a healing item, and return whether any healing items
@ -1383,7 +1383,7 @@ impl<'a> AgentData<'a> {
read_data: &ReadData, read_data: &ReadData,
event_emitter: &mut Emitter<'_, ServerEvent>, event_emitter: &mut Emitter<'_, ServerEvent>,
) { ) {
agent.action_state.action_timer = 0.0; agent.action_state.timer = 0.0;
// Search area // Search area
let target = self.cached_spatial_grid.0 let target = self.cached_spatial_grid.0
@ -1649,16 +1649,16 @@ impl<'a> AgentData<'a> {
Tactic::Axe => { Tactic::Axe => {
if dist_sqrd < min_attack_dist.powi(2) && angle < 45.0 { if dist_sqrd < min_attack_dist.powi(2) && angle < 45.0 {
controller.inputs.move_dir = Vec2::zero(); controller.inputs.move_dir = Vec2::zero();
if agent.action_state.action_timer > 6.0 { if agent.action_state.timer > 6.0 {
controller controller
.actions .actions
.push(ControlAction::CancelInput(InputKind::Secondary)); .push(ControlAction::CancelInput(InputKind::Secondary));
agent.action_state.action_timer = 0.0; agent.action_state.timer = 0.0;
} else if agent.action_state.action_timer > 4.0 && self.energy.current() > 10 { } else if agent.action_state.timer > 4.0 && self.energy.current() > 10 {
controller controller
.actions .actions
.push(ControlAction::basic_input(InputKind::Secondary)); .push(ControlAction::basic_input(InputKind::Secondary));
agent.action_state.action_timer += dt.0; agent.action_state.timer += dt.0;
} else if self.skill_set.has_skill(Skill::Axe(AxeSkill::UnlockLeap)) } else if self.skill_set.has_skill(Skill::Axe(AxeSkill::UnlockLeap))
&& self.energy.current() > 800 && self.energy.current() > 800
&& thread_rng().gen_bool(0.5) && thread_rng().gen_bool(0.5)
@ -1666,12 +1666,12 @@ impl<'a> AgentData<'a> {
controller controller
.actions .actions
.push(ControlAction::basic_input(InputKind::Ability(0))); .push(ControlAction::basic_input(InputKind::Ability(0)));
agent.action_state.action_timer += dt.0; agent.action_state.timer += dt.0;
} else { } else {
controller controller
.actions .actions
.push(ControlAction::basic_input(InputKind::Primary)); .push(ControlAction::basic_input(InputKind::Primary));
agent.action_state.action_timer += dt.0; agent.action_state.timer += dt.0;
} }
} else if dist_sqrd < MAX_CHASE_DIST.powi(2) { } else if dist_sqrd < MAX_CHASE_DIST.powi(2) {
if let Some((bearing, speed)) = agent.chaser.chase( if let Some((bearing, speed)) = agent.chaser.chase(
@ -1704,16 +1704,16 @@ impl<'a> AgentData<'a> {
Tactic::Hammer => { Tactic::Hammer => {
if dist_sqrd < min_attack_dist.powi(2) && angle < 45.0 { if dist_sqrd < min_attack_dist.powi(2) && angle < 45.0 {
controller.inputs.move_dir = Vec2::zero(); controller.inputs.move_dir = Vec2::zero();
if agent.action_state.action_timer > 4.0 { if agent.action_state.timer > 4.0 {
controller controller
.actions .actions
.push(ControlAction::CancelInput(InputKind::Secondary)); .push(ControlAction::CancelInput(InputKind::Secondary));
agent.action_state.action_timer = 0.0; agent.action_state.timer = 0.0;
} else if agent.action_state.action_timer > 2.0 { } else if agent.action_state.timer > 2.0 {
controller controller
.actions .actions
.push(ControlAction::basic_input(InputKind::Secondary)); .push(ControlAction::basic_input(InputKind::Secondary));
agent.action_state.action_timer += dt.0; agent.action_state.timer += dt.0;
} else if self } else if self
.skill_set .skill_set
.has_skill(Skill::Hammer(HammerSkill::UnlockLeap)) .has_skill(Skill::Hammer(HammerSkill::UnlockLeap))
@ -1723,12 +1723,12 @@ impl<'a> AgentData<'a> {
controller controller
.actions .actions
.push(ControlAction::basic_input(InputKind::Ability(0))); .push(ControlAction::basic_input(InputKind::Ability(0)));
agent.action_state.action_timer += dt.0; agent.action_state.timer += dt.0;
} else { } else {
controller controller
.actions .actions
.push(ControlAction::basic_input(InputKind::Primary)); .push(ControlAction::basic_input(InputKind::Primary));
agent.action_state.action_timer += dt.0; agent.action_state.timer += dt.0;
} }
} else if dist_sqrd < MAX_CHASE_DIST.powi(2) { } else if dist_sqrd < MAX_CHASE_DIST.powi(2) {
if let Some((bearing, speed)) = agent.chaser.chase( if let Some((bearing, speed)) = agent.chaser.chase(
@ -1747,14 +1747,14 @@ impl<'a> AgentData<'a> {
if self if self
.skill_set .skill_set
.has_skill(Skill::Hammer(HammerSkill::UnlockLeap)) .has_skill(Skill::Hammer(HammerSkill::UnlockLeap))
&& agent.action_state.action_timer > 5.0 && agent.action_state.timer > 5.0
{ {
controller controller
.actions .actions
.push(ControlAction::basic_input(InputKind::Ability(0))); .push(ControlAction::basic_input(InputKind::Ability(0)));
agent.action_state.action_timer = 0.0; agent.action_state.timer = 0.0;
} else { } else {
agent.action_state.action_timer += dt.0; agent.action_state.timer += dt.0;
} }
} else { } else {
controller.inputs.move_dir = controller.inputs.move_dir =
@ -1781,20 +1781,20 @@ impl<'a> AgentData<'a> {
if self if self
.skill_set .skill_set
.has_skill(Skill::Sword(SwordSkill::UnlockSpin)) .has_skill(Skill::Sword(SwordSkill::UnlockSpin))
&& agent.action_state.action_timer < 2.0 && agent.action_state.timer < 2.0
&& self.energy.current() > 600 && self.energy.current() > 600
{ {
controller controller
.actions .actions
.push(ControlAction::basic_input(InputKind::Ability(0))); .push(ControlAction::basic_input(InputKind::Ability(0)));
agent.action_state.action_timer += dt.0; agent.action_state.timer += dt.0;
} else if agent.action_state.action_timer > 2.0 { } else if agent.action_state.timer > 2.0 {
agent.action_state.action_timer = 0.0; agent.action_state.timer = 0.0;
} else { } else {
controller controller
.actions .actions
.push(ControlAction::basic_input(InputKind::Primary)); .push(ControlAction::basic_input(InputKind::Primary));
agent.action_state.action_timer += dt.0; agent.action_state.timer += dt.0;
} }
} else if dist_sqrd < MAX_CHASE_DIST.powi(2) { } else if dist_sqrd < MAX_CHASE_DIST.powi(2) {
if let Some((bearing, speed)) = agent.chaser.chase( if let Some((bearing, speed)) = agent.chaser.chase(
@ -1810,13 +1810,13 @@ impl<'a> AgentData<'a> {
if can_see_tgt(&*terrain, self.pos, tgt_pos, dist_sqrd) { if can_see_tgt(&*terrain, self.pos, tgt_pos, dist_sqrd) {
controller.inputs.move_dir = controller.inputs.move_dir =
bearing.xy().try_normalized().unwrap_or_else(Vec2::zero) * speed; bearing.xy().try_normalized().unwrap_or_else(Vec2::zero) * speed;
if agent.action_state.action_timer > 4.0 && angle < 45.0 { if agent.action_state.timer > 4.0 && angle < 45.0 {
controller controller
.actions .actions
.push(ControlAction::basic_input(InputKind::Secondary)); .push(ControlAction::basic_input(InputKind::Secondary));
agent.action_state.action_timer = 0.0; agent.action_state.timer = 0.0;
} else { } else {
agent.action_state.action_timer += dt.0; agent.action_state.timer += dt.0;
} }
} else { } else {
controller.inputs.move_dir = controller.inputs.move_dir =
@ -1891,18 +1891,18 @@ impl<'a> AgentData<'a> {
.try_normalized() .try_normalized()
.unwrap_or_else(Vec2::zero) .unwrap_or_else(Vec2::zero)
* speed; * speed;
if agent.action_state.action_timer > 4.0 { if agent.action_state.timer > 4.0 {
controller controller
.actions .actions
.push(ControlAction::CancelInput(InputKind::Secondary)); .push(ControlAction::CancelInput(InputKind::Secondary));
agent.action_state.action_timer = 0.0; agent.action_state.timer = 0.0;
} else if agent.action_state.action_timer > 2.0 } else if agent.action_state.timer > 2.0
&& self.energy.current() > 300 && self.energy.current() > 300
{ {
controller controller
.actions .actions
.push(ControlAction::basic_input(InputKind::Secondary)); .push(ControlAction::basic_input(InputKind::Secondary));
agent.action_state.action_timer += dt.0; agent.action_state.timer += dt.0;
} else if self } else if self
.skill_set .skill_set
.has_skill(Skill::Bow(BowSkill::UnlockRepeater)) .has_skill(Skill::Bow(BowSkill::UnlockRepeater))
@ -1915,7 +1915,7 @@ impl<'a> AgentData<'a> {
controller controller
.actions .actions
.push(ControlAction::basic_input(InputKind::Ability(0))); .push(ControlAction::basic_input(InputKind::Ability(0)));
agent.action_state.action_timer += dt.0; agent.action_state.timer += dt.0;
} else { } else {
controller controller
.actions .actions
@ -1923,7 +1923,7 @@ impl<'a> AgentData<'a> {
controller controller
.actions .actions
.push(ControlAction::basic_input(InputKind::Primary)); .push(ControlAction::basic_input(InputKind::Primary));
agent.action_state.action_timer += dt.0; agent.action_state.timer += dt.0;
} }
} else { } else {
controller.inputs.move_dir = controller.inputs.move_dir =
@ -1968,22 +1968,22 @@ impl<'a> AgentData<'a> {
.actions .actions
.push(ControlAction::basic_input(InputKind::Roll)); .push(ControlAction::basic_input(InputKind::Roll));
} else if dist_sqrd < (5.0 * min_attack_dist).powi(2) && angle < 15.0 { } else if dist_sqrd < (5.0 * min_attack_dist).powi(2) && angle < 15.0 {
if agent.action_state.action_timer < 1.5 { if agent.action_state.timer < 1.5 {
controller.inputs.move_dir = (tgt_pos.0 - self.pos.0) controller.inputs.move_dir = (tgt_pos.0 - self.pos.0)
.xy() .xy()
.rotated_z(0.47 * PI) .rotated_z(0.47 * PI)
.try_normalized() .try_normalized()
.unwrap_or_else(Vec2::unit_y); .unwrap_or_else(Vec2::unit_y);
agent.action_state.action_timer += dt.0; agent.action_state.timer += dt.0;
} else if agent.action_state.action_timer < 3.0 { } else if agent.action_state.timer < 3.0 {
controller.inputs.move_dir = (tgt_pos.0 - self.pos.0) controller.inputs.move_dir = (tgt_pos.0 - self.pos.0)
.xy() .xy()
.rotated_z(-0.47 * PI) .rotated_z(-0.47 * PI)
.try_normalized() .try_normalized()
.unwrap_or_else(Vec2::unit_y); .unwrap_or_else(Vec2::unit_y);
agent.action_state.action_timer += dt.0; agent.action_state.timer += dt.0;
} else { } else {
agent.action_state.action_timer = 0.0; agent.action_state.timer = 0.0;
} }
if self if self
.skill_set .skill_set
@ -2087,13 +2087,13 @@ impl<'a> AgentData<'a> {
if can_see_tgt(&*terrain, self.pos, tgt_pos, dist_sqrd) && angle < 90.0 { if can_see_tgt(&*terrain, self.pos, tgt_pos, dist_sqrd) && angle < 90.0 {
controller.inputs.move_dir = controller.inputs.move_dir =
bearing.xy().try_normalized().unwrap_or_else(Vec2::zero) * speed; bearing.xy().try_normalized().unwrap_or_else(Vec2::zero) * speed;
if agent.action_state.action_timer > 5.0 { if agent.action_state.timer > 5.0 {
controller controller
.actions .actions
.push(ControlAction::basic_input(InputKind::Secondary)); .push(ControlAction::basic_input(InputKind::Secondary));
agent.action_state.action_timer = 0.0; agent.action_state.timer = 0.0;
} else { } else {
agent.action_state.action_timer += dt.0; agent.action_state.timer += dt.0;
} }
} else { } else {
controller.inputs.move_dir = controller.inputs.move_dir =
@ -2123,7 +2123,7 @@ impl<'a> AgentData<'a> {
} else if dist_sqrd < ((radius as f32 + 1.0) * min_attack_dist).powi(2) } else if dist_sqrd < ((radius as f32 + 1.0) * min_attack_dist).powi(2)
&& dist_sqrd > (radius as f32 * min_attack_dist).powi(2) && dist_sqrd > (radius as f32 * min_attack_dist).powi(2)
{ {
if agent.action_state.action_timer < circle_time as f32 { if agent.action_state.timer < circle_time as f32 {
let move_dir = (tgt_pos.0 - self.pos.0) let move_dir = (tgt_pos.0 - self.pos.0)
.xy() .xy()
.rotated_z(0.47 * PI) .rotated_z(0.47 * PI)
@ -2140,16 +2140,16 @@ impl<'a> AgentData<'a> {
.1 .1
.map_or(true, |b| b.is_some()); .map_or(true, |b| b.is_some());
if obstacle_left { if obstacle_left {
agent.action_state.action_timer = circle_time as f32; agent.action_state.timer = circle_time as f32;
} }
controller.inputs.move_dir = move_dir; controller.inputs.move_dir = move_dir;
agent.action_state.action_timer += dt.0; agent.action_state.timer += dt.0;
} else if agent.action_state.action_timer < circle_time as f32 + 0.5 { } else if agent.action_state.timer < circle_time as f32 + 0.5 {
controller controller
.actions .actions
.push(ControlAction::basic_input(InputKind::Secondary)); .push(ControlAction::basic_input(InputKind::Secondary));
agent.action_state.action_timer += dt.0; agent.action_state.timer += dt.0;
} else if agent.action_state.action_timer < 2.0 * circle_time as f32 + 0.5 { } else if agent.action_state.timer < 2.0 * circle_time as f32 + 0.5 {
let move_dir = (tgt_pos.0 - self.pos.0) let move_dir = (tgt_pos.0 - self.pos.0)
.xy() .xy()
.rotated_z(-0.47 * PI) .rotated_z(-0.47 * PI)
@ -2166,20 +2166,20 @@ impl<'a> AgentData<'a> {
.1 .1
.map_or(true, |b| b.is_some()); .map_or(true, |b| b.is_some());
if obstacle_right { if obstacle_right {
agent.action_state.action_timer = 2.0 * circle_time as f32 + 0.5; agent.action_state.timer = 2.0 * circle_time as f32 + 0.5;
} }
controller.inputs.move_dir = move_dir; controller.inputs.move_dir = move_dir;
agent.action_state.action_timer += dt.0; agent.action_state.timer += dt.0;
} else if agent.action_state.action_timer < 2.0 * circle_time as f32 + 1.0 { } else if agent.action_state.timer < 2.0 * circle_time as f32 + 1.0 {
if agent.action_state.action_timer < 2.0 * circle_time as f32 { if agent.action_state.timer < 2.0 * circle_time as f32 {
agent.action_state.action_timer = 2.0 * circle_time as f32; agent.action_state.timer = 2.0 * circle_time as f32;
} }
controller controller
.actions .actions
.push(ControlAction::basic_input(InputKind::Secondary)); .push(ControlAction::basic_input(InputKind::Secondary));
agent.action_state.action_timer += dt.0; agent.action_state.timer += dt.0;
} else { } else {
agent.action_state.action_timer = 0.0; agent.action_state.timer = 0.0;
} }
} else if dist_sqrd < MAX_CHASE_DIST.powi(2) { } else if dist_sqrd < MAX_CHASE_DIST.powi(2) {
if let Some((bearing, speed)) = agent.chaser.chase( if let Some((bearing, speed)) = agent.chaser.chase(
@ -2222,16 +2222,16 @@ impl<'a> AgentData<'a> {
}, },
) { ) {
if can_see_tgt(&*terrain, self.pos, tgt_pos, dist_sqrd) && angle < 15.0 { if can_see_tgt(&*terrain, self.pos, tgt_pos, dist_sqrd) && angle < 15.0 {
if agent.action_state.action_timer > 5.0 { if agent.action_state.timer > 5.0 {
agent.action_state.action_timer = 0.0; agent.action_state.timer = 0.0;
} else if agent.action_state.action_timer > 2.5 { } else if agent.action_state.timer > 2.5 {
controller.inputs.move_dir = (tgt_pos.0 - self.pos.0) controller.inputs.move_dir = (tgt_pos.0 - self.pos.0)
.xy() .xy()
.rotated_z(1.75 * PI) .rotated_z(1.75 * PI)
.try_normalized() .try_normalized()
.unwrap_or_else(Vec2::zero) .unwrap_or_else(Vec2::zero)
* speed; * speed;
agent.action_state.action_timer += dt.0; agent.action_state.timer += dt.0;
} else { } else {
controller.inputs.move_dir = (tgt_pos.0 - self.pos.0) controller.inputs.move_dir = (tgt_pos.0 - self.pos.0)
.xy() .xy()
@ -2239,7 +2239,7 @@ impl<'a> AgentData<'a> {
.try_normalized() .try_normalized()
.unwrap_or_else(Vec2::zero) .unwrap_or_else(Vec2::zero)
* speed; * speed;
agent.action_state.action_timer += dt.0; agent.action_state.timer += dt.0;
} }
controller controller
.actions .actions
@ -2261,21 +2261,21 @@ impl<'a> AgentData<'a> {
}, },
Tactic::TailSlap => { Tactic::TailSlap => {
if dist_sqrd < (1.5 * min_attack_dist).powi(2) && angle < 90.0 { if dist_sqrd < (1.5 * min_attack_dist).powi(2) && angle < 90.0 {
if agent.action_state.action_timer > 4.0 { if agent.action_state.timer > 4.0 {
controller controller
.actions .actions
.push(ControlAction::CancelInput(InputKind::Primary)); .push(ControlAction::CancelInput(InputKind::Primary));
agent.action_state.action_timer = 0.0; agent.action_state.timer = 0.0;
} else if agent.action_state.action_timer > 1.0 { } else if agent.action_state.timer > 1.0 {
controller controller
.actions .actions
.push(ControlAction::basic_input(InputKind::Primary)); .push(ControlAction::basic_input(InputKind::Primary));
agent.action_state.action_timer += dt.0; agent.action_state.timer += dt.0;
} else { } else {
controller controller
.actions .actions
.push(ControlAction::basic_input(InputKind::Secondary)); .push(ControlAction::basic_input(InputKind::Secondary));
agent.action_state.action_timer += dt.0; agent.action_state.timer += dt.0;
} }
controller.inputs.move_dir = (tgt_pos.0 - self.pos.0) controller.inputs.move_dir = (tgt_pos.0 - self.pos.0)
.xy() .xy()
@ -2343,18 +2343,18 @@ impl<'a> AgentData<'a> {
Tactic::QuadLowBasic => { Tactic::QuadLowBasic => {
if dist_sqrd < (1.5 * min_attack_dist).powi(2) { if dist_sqrd < (1.5 * min_attack_dist).powi(2) {
controller.inputs.move_dir = Vec2::zero(); controller.inputs.move_dir = Vec2::zero();
if agent.action_state.action_timer > 5.0 { if agent.action_state.timer > 5.0 {
agent.action_state.action_timer = 0.0; agent.action_state.timer = 0.0;
} else if agent.action_state.action_timer > 2.0 && angle < 90.0 { } else if agent.action_state.timer > 2.0 && angle < 90.0 {
controller controller
.actions .actions
.push(ControlAction::basic_input(InputKind::Secondary)); .push(ControlAction::basic_input(InputKind::Secondary));
agent.action_state.action_timer += dt.0; agent.action_state.timer += dt.0;
} else if angle < 90.0 { } else if angle < 90.0 {
controller controller
.actions .actions
.push(ControlAction::basic_input(InputKind::Primary)); .push(ControlAction::basic_input(InputKind::Primary));
agent.action_state.action_timer += dt.0; agent.action_state.timer += dt.0;
} }
} else if dist_sqrd < MAX_CHASE_DIST.powi(2) { } else if dist_sqrd < MAX_CHASE_DIST.powi(2) {
if let Some((bearing, speed)) = agent.chaser.chase( if let Some((bearing, speed)) = agent.chaser.chase(
@ -2417,18 +2417,18 @@ impl<'a> AgentData<'a> {
Tactic::QuadMedBasic => { Tactic::QuadMedBasic => {
if dist_sqrd < min_attack_dist.powi(2) && angle < 90.0 { if dist_sqrd < min_attack_dist.powi(2) && angle < 90.0 {
controller.inputs.move_dir = Vec2::zero(); controller.inputs.move_dir = Vec2::zero();
if agent.action_state.action_timer < 2.0 { if agent.action_state.timer < 2.0 {
controller controller
.actions .actions
.push(ControlAction::basic_input(InputKind::Secondary)); .push(ControlAction::basic_input(InputKind::Secondary));
agent.action_state.action_timer += dt.0; agent.action_state.timer += dt.0;
} else if agent.action_state.action_timer < 3.0 { } else if agent.action_state.timer < 3.0 {
controller controller
.actions .actions
.push(ControlAction::basic_input(InputKind::Primary)); .push(ControlAction::basic_input(InputKind::Primary));
agent.action_state.action_timer += dt.0; agent.action_state.timer += dt.0;
} else { } else {
agent.action_state.action_timer = 0.0; agent.action_state.timer = 0.0;
} }
} else if dist_sqrd < MAX_CHASE_DIST.powi(2) { } else if dist_sqrd < MAX_CHASE_DIST.powi(2) {
if let Some((bearing, speed)) = agent.chaser.chase( if let Some((bearing, speed)) = agent.chaser.chase(
@ -2457,7 +2457,7 @@ impl<'a> AgentData<'a> {
.actions .actions
.push(ControlAction::basic_input(InputKind::Secondary)); .push(ControlAction::basic_input(InputKind::Secondary));
} else if dist_sqrd < (7.0 * min_attack_dist).powi(2) && angle < 15.0 { } else if dist_sqrd < (7.0 * min_attack_dist).powi(2) && angle < 15.0 {
if agent.action_state.action_timer < 2.0 { if agent.action_state.timer < 2.0 {
controller.inputs.move_dir = (tgt_pos.0 - self.pos.0) controller.inputs.move_dir = (tgt_pos.0 - self.pos.0)
.xy() .xy()
.rotated_z(0.47 * PI) .rotated_z(0.47 * PI)
@ -2466,8 +2466,8 @@ impl<'a> AgentData<'a> {
controller controller
.actions .actions
.push(ControlAction::basic_input(InputKind::Primary)); .push(ControlAction::basic_input(InputKind::Primary));
agent.action_state.action_timer += dt.0; agent.action_state.timer += dt.0;
} else if agent.action_state.action_timer < 4.0 && angle < 15.0 { } else if agent.action_state.timer < 4.0 && angle < 15.0 {
controller.inputs.move_dir = (tgt_pos.0 - self.pos.0) controller.inputs.move_dir = (tgt_pos.0 - self.pos.0)
.xy() .xy()
.rotated_z(-0.47 * PI) .rotated_z(-0.47 * PI)
@ -2476,14 +2476,14 @@ impl<'a> AgentData<'a> {
controller controller
.actions .actions
.push(ControlAction::basic_input(InputKind::Primary)); .push(ControlAction::basic_input(InputKind::Primary));
agent.action_state.action_timer += dt.0; agent.action_state.timer += dt.0;
} else if agent.action_state.action_timer < 6.0 && angle < 15.0 { } else if agent.action_state.timer < 6.0 && angle < 15.0 {
controller controller
.actions .actions
.push(ControlAction::basic_input(InputKind::Ability(0))); .push(ControlAction::basic_input(InputKind::Ability(0)));
agent.action_state.action_timer += dt.0; agent.action_state.timer += dt.0;
} else { } else {
agent.action_state.action_timer = 0.0; agent.action_state.timer = 0.0;
} }
} else if dist_sqrd < MAX_CHASE_DIST.powi(2) { } else if dist_sqrd < MAX_CHASE_DIST.powi(2) {
if let Some((bearing, speed)) = agent.chaser.chase( if let Some((bearing, speed)) = agent.chaser.chase(
@ -2570,21 +2570,21 @@ impl<'a> AgentData<'a> {
const MINDFLAYER_ATTACK_DIST: f32 = 16.0; const MINDFLAYER_ATTACK_DIST: f32 = 16.0;
const MINION_SUMMON_THRESHOLD: f32 = 0.20; const MINION_SUMMON_THRESHOLD: f32 = 0.20;
let health_fraction = self.health.map_or(0.5, |h| h.fraction()); let health_fraction = self.health.map_or(0.5, |h| h.fraction());
// Sets action_float at start of combat // Sets counter at start of combat
if agent.action_state.action_float < MINION_SUMMON_THRESHOLD if agent.action_state.counter < MINION_SUMMON_THRESHOLD
&& health_fraction > MINION_SUMMON_THRESHOLD && health_fraction > MINION_SUMMON_THRESHOLD
{ {
agent.action_state.action_float = 1.0 - MINION_SUMMON_THRESHOLD; agent.action_state.counter = 1.0 - MINION_SUMMON_THRESHOLD;
} }
let mindflayer_is_far = dist_sqrd > MINDFLAYER_ATTACK_DIST.powi(2); let mindflayer_is_far = dist_sqrd > MINDFLAYER_ATTACK_DIST.powi(2);
if agent.action_state.action_float > health_fraction { if agent.action_state.counter > health_fraction {
// Summon minions at particular thresholds of health // Summon minions at particular thresholds of health
controller controller
.actions .actions
.push(ControlAction::basic_input(InputKind::Ability(1))); .push(ControlAction::basic_input(InputKind::Ability(1)));
if matches!(self.char_state, CharacterState::BasicSummon(c) if matches!(c.stage_section, StageSection::Recover)) if matches!(self.char_state, CharacterState::BasicSummon(c) if matches!(c.stage_section, StageSection::Recover))
{ {
agent.action_state.action_float -= MINION_SUMMON_THRESHOLD; agent.action_state.counter -= MINION_SUMMON_THRESHOLD;
} }
} else if mindflayer_is_far { } else if mindflayer_is_far {
// If too far from target, blink to them. // If too far from target, blink to them.
@ -2874,20 +2874,20 @@ impl<'a> AgentData<'a> {
controller.inputs.move_z = bearing.z; controller.inputs.move_z = bearing.z;
} }
} else if self.energy.current() > 600 } else if self.energy.current() > 600
&& agent.action_state.action_timer < 3.0 && agent.action_state.timer < 3.0
&& angle < 15.0 && angle < 15.0
{ {
controller controller
.actions .actions
.push(ControlAction::basic_input(InputKind::Ability(0))); .push(ControlAction::basic_input(InputKind::Ability(0)));
agent.action_state.action_timer += dt.0; agent.action_state.timer += dt.0;
} else if agent.action_state.action_timer < 6.0 && angle < 90.0 { } else if agent.action_state.timer < 6.0 && angle < 90.0 {
controller controller
.actions .actions
.push(ControlAction::basic_input(InputKind::Secondary)); .push(ControlAction::basic_input(InputKind::Secondary));
agent.action_state.action_timer += dt.0; agent.action_state.timer += dt.0;
} else { } else {
agent.action_state.action_timer = 0.0; agent.action_state.timer = 0.0;
} }
}, },
Tactic::Minotaur => { Tactic::Minotaur => {
@ -2898,19 +2898,19 @@ impl<'a> AgentData<'a> {
self.body.map_or(0.0, |b| b.radius()) + MINOTAUR_ATTACK_RANGE; self.body.map_or(0.0, |b| b.radius()) + MINOTAUR_ATTACK_RANGE;
let health_fraction = self.health.map_or(1.0, |h| h.fraction()); let health_fraction = self.health.map_or(1.0, |h| h.fraction());
// Sets action float at start of combat // Sets action float at start of combat
if agent.action_state.action_float < MINOTAUR_FRENZY_THRESHOLD if agent.action_state.counter < MINOTAUR_FRENZY_THRESHOLD
&& health_fraction > MINOTAUR_FRENZY_THRESHOLD && health_fraction > MINOTAUR_FRENZY_THRESHOLD
{ {
agent.action_state.action_float = MINOTAUR_FRENZY_THRESHOLD; agent.action_state.counter = MINOTAUR_FRENZY_THRESHOLD;
} }
if health_fraction < agent.action_state.action_float { if health_fraction < agent.action_state.counter {
// Makes minotaur buff itself with frenzy // Makes minotaur buff itself with frenzy
controller controller
.actions .actions
.push(ControlAction::basic_input(InputKind::Ability(1))); .push(ControlAction::basic_input(InputKind::Ability(1)));
if matches!(self.char_state, CharacterState::SelfBuff(c) if matches!(c.stage_section, StageSection::Recover)) if matches!(self.char_state, CharacterState::SelfBuff(c) if matches!(c.stage_section, StageSection::Recover))
{ {
agent.action_state.action_float = 0.0; agent.action_state.counter = 0.0;
} }
} else if matches!(self.char_state, CharacterState::DashMelee(c) if !matches!(c.stage_section, StageSection::Recover)) } else if matches!(self.char_state, CharacterState::DashMelee(c) if !matches!(c.stage_section, StageSection::Recover))
{ {
@ -2932,18 +2932,18 @@ impl<'a> AgentData<'a> {
.push(ControlAction::basic_input(InputKind::Ability(0))); .push(ControlAction::basic_input(InputKind::Ability(0)));
} }
} else if dist_sqrd < minotaur_attack_distance.powi(2) { } else if dist_sqrd < minotaur_attack_distance.powi(2) {
if agent.action_state.action_bool && !self.char_state.is_attack() { if agent.action_state.condition && !self.char_state.is_attack() {
// Cripple target if not just used cripple // Cripple target if not just used cripple
controller controller
.actions .actions
.push(ControlAction::basic_input(InputKind::Secondary)); .push(ControlAction::basic_input(InputKind::Secondary));
agent.action_state.action_bool = false; agent.action_state.condition = false;
} else if !self.char_state.is_attack() { } else if !self.char_state.is_attack() {
// Cleave target if not just used cleave // Cleave target if not just used cleave
controller controller
.actions .actions
.push(ControlAction::basic_input(InputKind::Primary)); .push(ControlAction::basic_input(InputKind::Primary));
agent.action_state.action_bool = true; agent.action_state.condition = true;
} }
} }
// Make minotaur move towards target // Make minotaur move towards target

View File

@ -181,6 +181,7 @@ pub enum SfxEvent {
FireShot, FireShot,
FlameThrower, FlameThrower,
PoiseChange(PoiseState), PoiseChange(PoiseState),
GroundSlam,
} }
#[derive(Clone, Debug, PartialEq, Deserialize, Hash, Eq)] #[derive(Clone, Debug, PartialEq, Deserialize, Hash, Eq)]
@ -325,8 +326,8 @@ impl SfxMgr {
false, false,
); );
}, },
Outcome::Bonk { pos, .. } => { Outcome::GroundSlam { pos, .. } => {
let sfx_trigger_item = triggers.get_key_value(&SfxEvent::Explosion); let sfx_trigger_item = triggers.get_key_value(&SfxEvent::GroundSlam);
audio.emit_sfx(sfx_trigger_item, *pos, Some(1.0), false); audio.emit_sfx(sfx_trigger_item, *pos, Some(1.0), false);
}, },
Outcome::ProjectileShot { pos, body, .. } => { Outcome::ProjectileShot { pos, body, .. } => {

View File

@ -215,7 +215,7 @@ impl ParticleMgr {
}); });
} }
}, },
Outcome::Bonk { pos, .. } => { Outcome::GroundSlam { pos, .. } => {
self.particles.resize_with(self.particles.len() + 100, || { self.particles.resize_with(self.particles.len() + 100, || {
Particle::new( Particle::new(
Duration::from_millis(1000), Duration::from_millis(1000),