diff --git a/src/npc/ai/last_cave.rs b/src/npc/ai/last_cave.rs index 14ff5c2..7b08d61 100644 --- a/src/npc/ai/last_cave.rs +++ b/src/npc/ai/last_cave.rs @@ -401,6 +401,7 @@ impl NPC { self.anim_num = 2; state.quake_counter = 10; state.sound_manager.play_sfx(72); + self.create_xp_drop_custom(self.x, self.y, 19, state, npc_list); npc_list.create_death_smoke( self.x, diff --git a/src/npc/ai/maze.rs b/src/npc/ai/maze.rs index 5a4d49a..957a205 100644 --- a/src/npc/ai/maze.rs +++ b/src/npc/ai/maze.rs @@ -1145,50 +1145,54 @@ impl NPC { } pub(crate) fn tick_n174_gaudi_armored_projectile(&mut self, state: &mut SharedGameState) -> GameResult { - if self.action_num == 0 && self.direction == Direction::Right { - self.action_num = 2; + match self.action_num { + 0 | 1 => { + if self.direction == Direction::Right { + self.action_num = 2; + } + + let mut hit = false; + + if self.flags.hit_left_wall() { + hit = true; + self.vel_x = 0x200; + } + if self.flags.hit_right_wall() { + hit = true; + self.vel_x = -0x200; + } + if self.flags.hit_top_wall() { + hit = true; + self.vel_y = 0x200; + } + if self.flags.hit_bottom_wall() { + hit = true; + self.vel_y = -0x200; + } + + if hit { + self.action_num = 2; + self.action_counter2 += 1; + state.sound_manager.play_sfx(31); + } + } + 2 => { + self.vel_y += 0x40; + + if self.flags.hit_bottom_wall() { + self.action_counter2 += 1; + if self.action_counter2 > 1 { + state.create_caret(self.x, self.y, CaretType::ProjectileDissipation, Direction::Left); + self.cond.set_alive(false); + } + } + } + _ => (), } - if self.action_num == 1 { - self.x += self.vel_x; - self.y += self.vel_y; - - let mut hit = false; - - if self.flags.hit_left_wall() { - hit = true; - self.vel_x = 0x200; - } - if self.flags.hit_right_wall() { - hit = true; - self.vel_x = -0x200; - } - if self.flags.hit_top_wall() { - hit = true; - self.vel_y = 0x200; - } - if self.flags.hit_bottom_wall() { - hit = true; - self.vel_y = -0x200; - } - - if hit { - self.action_num = 2; - self.action_counter3 += 1; - state.sound_manager.play_sfx(31); - } - } - - self.vel_y += 0x40; self.x += self.vel_x; self.y += self.vel_y; - self.action_counter3 += 1; - if self.flags.hit_bottom_wall() && self.action_counter3 > 1 { - state.create_caret(self.x, self.y, CaretType::ProjectileDissipation, Direction::Left); - self.cond.set_alive(false); - } - self.vel_y = self.vel_y.clamp(-0x5ff, 0x5ff); self.anim_num += 1;