1
0
Fork 0

Complete section 3.3

This commit is contained in:
Timothy Warren 2021-11-17 15:55:48 -05:00
parent 5bd85f5d86
commit a973e6a444
1 changed files with 13 additions and 3 deletions

View File

@ -1,7 +1,6 @@
use crate::components::{Confusion, Monster, Position, Viewshed, WantsToMelee};
use crate::{Map, RunState};
use rltk::Point;
use crate::{particle_system::ParticleBuilder, Map, RunState};
use rltk::{Point, RGB};
use specs::prelude::*;
pub struct MonsterAI {}
@ -19,6 +18,7 @@ impl<'a> System<'a> for MonsterAI {
WriteStorage<'a, Position>,
WriteStorage<'a, WantsToMelee>,
WriteStorage<'a, Confusion>,
WriteExpect<'a, ParticleBuilder>,
);
fn run(&mut self, data: Self::SystemData) {
@ -33,6 +33,7 @@ impl<'a> System<'a> for MonsterAI {
mut position,
mut wants_to_melee,
mut confused,
mut particle_builder,
) = data;
if *runstate != RunState::MonsterTurn {
@ -52,6 +53,15 @@ impl<'a> System<'a> for MonsterAI {
}
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 {