Complete section 3.3

This commit is contained in:
Timothy Warren 2021-11-17 15:55:48 -05:00
parent 5bd85f5d86
commit a973e6a444

View File

@ -1,7 +1,6 @@
use crate::components::{Confusion, Monster, Position, Viewshed, WantsToMelee}; use crate::components::{Confusion, Monster, Position, Viewshed, WantsToMelee};
use crate::{Map, RunState}; use crate::{particle_system::ParticleBuilder, Map, RunState};
use rltk::{Point, RGB};
use rltk::Point;
use specs::prelude::*; use specs::prelude::*;
pub struct MonsterAI {} pub struct MonsterAI {}
@ -19,6 +18,7 @@ impl<'a> System<'a> for MonsterAI {
WriteStorage<'a, Position>, WriteStorage<'a, Position>,
WriteStorage<'a, WantsToMelee>, WriteStorage<'a, WantsToMelee>,
WriteStorage<'a, Confusion>, WriteStorage<'a, Confusion>,
WriteExpect<'a, ParticleBuilder>,
); );
fn run(&mut self, data: Self::SystemData) { fn run(&mut self, data: Self::SystemData) {
@ -33,6 +33,7 @@ impl<'a> System<'a> for MonsterAI {
mut position, mut position,
mut wants_to_melee, mut wants_to_melee,
mut confused, mut confused,
mut particle_builder,
) = data; ) = data;
if *runstate != RunState::MonsterTurn { if *runstate != RunState::MonsterTurn {
@ -52,6 +53,15 @@ impl<'a> System<'a> for MonsterAI {
} }
can_act = false; can_act = false;
particle_builder.request(
pos.x,
pos.y,
RGB::named(rltk::MAGENTA),
RGB::named(rltk::BLACK),
rltk::to_cp437('?'),
200.0,
);
} }
if can_act { if can_act {