Chapter 20
This commit is contained in:
@@ -4,14 +4,9 @@ use rltk::{FontCharType, RandomNumberGenerator, RGB};
|
||||
use specs::prelude::*;
|
||||
use specs::saveload::{MarkedBuilder, SimpleMarker};
|
||||
|
||||
use crate::{AreaOfEffect, BlocksTile, CombatStats, Confusion, Consumable, DefenseBonus, EquipmentSlot, Equippable, HungerClock, HungerState, InflictsDamage, Item, MagicMapper, MAP_WIDTH, MAX_MONSTER, MeleePowerBonus, Monster, Name, Player, Position, ProvidesFood, ProvidesHealing, Ranged, Renderable, SerializeMe, Viewshed};
|
||||
use crate::random_table::RandomTable;
|
||||
use crate::rect::Rect;
|
||||
use crate::{
|
||||
AreaOfEffect, BlocksTile, CombatStats, Confusion, Consumable, DefenseBonus, EquipmentSlot,
|
||||
Equippable, HungerClock, HungerState, InflictsDamage, Item, MeleePowerBonus, Monster, Name,
|
||||
Player, Position, ProvidesFood, ProvidesHealing, Ranged, Renderable, SerializeMe, Viewshed,
|
||||
MAP_WIDTH, MAX_MONSTER,
|
||||
};
|
||||
|
||||
pub fn player(ecs: &mut World, player_x: i32, player_y: i32) -> Entity {
|
||||
ecs.create_entity()
|
||||
@@ -131,6 +126,7 @@ pub fn spawn_room(ecs: &mut World, room: &Rect, map_depth: i32) {
|
||||
"Leggings" => leggings(ecs, x, y),
|
||||
"Sabatons" => sabatons(ecs, x, y),
|
||||
"Rations" => rations(ecs, x, y),
|
||||
"Magic Mapping Scroll" => magic_mapper_scroll(ecs, x, y),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
@@ -233,6 +229,7 @@ pub fn room_table(map_depth: i32) -> RandomTable {
|
||||
.add("Leggings", map_depth - 4)
|
||||
.add("Sabatons", map_depth - 4)
|
||||
.add("Rations", 10)
|
||||
.add("Magic Mapping Scroll", 2)
|
||||
}
|
||||
|
||||
fn dagger(ecs: &mut World, x: i32, y: i32) {
|
||||
@@ -423,3 +420,22 @@ fn rations(ecs: &mut World, x: i32, y: i32) {
|
||||
.marked::<SimpleMarker<SerializeMe>>()
|
||||
.build();
|
||||
}
|
||||
|
||||
fn magic_mapper_scroll(ecs: &mut World, x: i32, y: i32) {
|
||||
ecs.create_entity()
|
||||
.with(Position { x, y })
|
||||
.with(Renderable {
|
||||
glyph: rltk::to_cp437(')'),
|
||||
render_order: 2,
|
||||
fg: RGB::named(rltk::CYAN3),
|
||||
bg: RGB::named(rltk::BLACK),
|
||||
})
|
||||
.with(Item {})
|
||||
.with(Name {
|
||||
name: "Scroll to Magic Mapping".to_string(),
|
||||
})
|
||||
.with(Consumable {})
|
||||
.with(MagicMapper {})
|
||||
.marked::<SimpleMarker<SerializeMe>>()
|
||||
.build();
|
||||
}
|
Reference in New Issue
Block a user