Show carried weight, and apply inititative pentalties
This commit is contained in:
parent
220b00c64c
commit
847a577c3e
@ -1,7 +1,7 @@
|
||||
use ::rltk::{DistanceAlg, Point, RandomNumberGenerator};
|
||||
use ::specs::prelude::*;
|
||||
|
||||
use crate::components::{Attributes, Initiative, MyTurn, Position};
|
||||
use crate::components::{Attributes, Initiative, MyTurn, Pools, Position};
|
||||
use crate::RunState;
|
||||
|
||||
pub struct InitiativeSystem {}
|
||||
@ -18,6 +18,7 @@ impl<'a> System<'a> for InitiativeSystem {
|
||||
WriteExpect<'a, RunState>,
|
||||
ReadExpect<'a, Entity>,
|
||||
ReadExpect<'a, Point>,
|
||||
ReadStorage<'a, Pools>,
|
||||
);
|
||||
|
||||
fn run(&mut self, data: Self::SystemData) {
|
||||
@ -31,6 +32,7 @@ impl<'a> System<'a> for InitiativeSystem {
|
||||
mut runstate,
|
||||
player,
|
||||
player_pos,
|
||||
pools,
|
||||
) = data;
|
||||
|
||||
if *runstate != RunState::Ticking {
|
||||
@ -54,6 +56,11 @@ impl<'a> System<'a> for InitiativeSystem {
|
||||
initiative.current -= attr.quickness.bonus;
|
||||
}
|
||||
|
||||
// Apply pool penalty
|
||||
if let Some(pools) = pools.get(entity) {
|
||||
initiative.current += f32::floor(pools.total_initiative_penalty) as i32;
|
||||
}
|
||||
|
||||
// TODO: More initiative granting boosts/penalties will go here later
|
||||
|
||||
// if its the player, we want to go to an AwaitingInput state
|
||||
|
25
src/gui.rs
25
src/gui.rs
@ -123,8 +123,31 @@ pub fn draw_ui(ecs: &World, ctx: &mut Rltk) {
|
||||
draw_attribute("Fitness:", &attr.fitness, 6, ctx);
|
||||
draw_attribute("Intelligence:", &attr.intelligence, 7, ctx);
|
||||
|
||||
// Initiative and weight
|
||||
ctx.print_color(
|
||||
50,
|
||||
9,
|
||||
white,
|
||||
black,
|
||||
&format!(
|
||||
"{:.0} lbs ({} lbs max)",
|
||||
player_pools.total_weight,
|
||||
(attr.might.base + attr.might.modifiers) * 15
|
||||
),
|
||||
);
|
||||
ctx.print_color(
|
||||
50,
|
||||
10,
|
||||
white,
|
||||
black,
|
||||
&format!(
|
||||
"Initiative Penalty: {:.0}",
|
||||
player_pools.total_initiative_penalty
|
||||
),
|
||||
);
|
||||
|
||||
// Equipped
|
||||
let mut y = 9;
|
||||
let mut y = 13;
|
||||
let equipped = ecs.read_storage::<Equipped>();
|
||||
let name = ecs.read_storage::<Name>();
|
||||
for (equipped_by, item_name) in (&equipped, &name).join() {
|
||||
|
Loading…
Reference in New Issue
Block a user