Add chapter: 18
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
use specs::prelude::*;
|
||||
|
||||
use crate::gamelog::GameLog;
|
||||
use crate::particle_system::ParticleBuilder;
|
||||
use crate::{
|
||||
AreaOfEffect, CombatStats, Confusion, Consumable, Equippable, Equipped, InBackpack,
|
||||
InflictsDamage, Map, Name, Position, ProvidesHealing, Ranged, SufferDamage, WantsToDropItem,
|
||||
@@ -69,6 +70,8 @@ impl<'a> System<'a> for ItemUseSystem {
|
||||
ReadStorage<'a, Equippable>,
|
||||
WriteStorage<'a, Equipped>,
|
||||
WriteStorage<'a, InBackpack>,
|
||||
WriteExpect<'a, ParticleBuilder>,
|
||||
ReadStorage<'a, Position>,
|
||||
);
|
||||
|
||||
fn run(&mut self, data: Self::SystemData) {
|
||||
@@ -90,6 +93,8 @@ impl<'a> System<'a> for ItemUseSystem {
|
||||
equippable,
|
||||
mut equipped,
|
||||
mut backpack,
|
||||
mut particle_builder,
|
||||
positions,
|
||||
) = data;
|
||||
|
||||
for (entity, use_item) in (&entities, &wants_use).join() {
|
||||
@@ -118,8 +123,17 @@ impl<'a> System<'a> for ItemUseSystem {
|
||||
for mob in map.tile_content[idx].iter() {
|
||||
targets.push(*mob);
|
||||
}
|
||||
|
||||
particle_builder.request(
|
||||
tile_idx.x,
|
||||
tile_idx.y,
|
||||
rltk::RGB::named(rltk::ORANGE),
|
||||
rltk::RGB::named(rltk::BLACK),
|
||||
rltk::to_cp437('░'),
|
||||
200.,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -172,6 +186,17 @@ impl<'a> System<'a> for ItemUseSystem {
|
||||
"You use {} on {}, inflicting {} hp.",
|
||||
item_name.name, mob_name.name, item_damages.damage
|
||||
));
|
||||
|
||||
if let Some(pos) = positions.get(*mob) {
|
||||
particle_builder.request(
|
||||
pos.x,
|
||||
pos.y,
|
||||
rltk::RGB::named(rltk::RED),
|
||||
rltk::RGB::named(rltk::BLACK),
|
||||
rltk::to_cp437('‼'),
|
||||
200.,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
used_item = true;
|
||||
@@ -192,6 +217,16 @@ impl<'a> System<'a> for ItemUseSystem {
|
||||
));
|
||||
}
|
||||
used_item = true;
|
||||
if let Some(pos) = positions.get(*target) {
|
||||
particle_builder.request(
|
||||
pos.x,
|
||||
pos.y,
|
||||
rltk::RGB::named(rltk::GREEN),
|
||||
rltk::RGB::named(rltk::BLACK),
|
||||
rltk::to_cp437('♥'),
|
||||
200.,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -209,6 +244,17 @@ impl<'a> System<'a> for ItemUseSystem {
|
||||
"You use {} on {}, confusing them.",
|
||||
item_name.name, mob_name.name
|
||||
));
|
||||
|
||||
if let Some(pos) = positions.get(*mob) {
|
||||
particle_builder.request(
|
||||
pos.x,
|
||||
pos.y,
|
||||
rltk::RGB::named(rltk::MAGENTA),
|
||||
rltk::RGB::named(rltk::BLACK),
|
||||
rltk::to_cp437('?'),
|
||||
200.,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user