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 ::rltk::{DistanceAlg, Point, RandomNumberGenerator};
|
||||||
use ::specs::prelude::*;
|
use ::specs::prelude::*;
|
||||||
|
|
||||||
use crate::components::{Attributes, Initiative, MyTurn, Position};
|
use crate::components::{Attributes, Initiative, MyTurn, Pools, Position};
|
||||||
use crate::RunState;
|
use crate::RunState;
|
||||||
|
|
||||||
pub struct InitiativeSystem {}
|
pub struct InitiativeSystem {}
|
||||||
@ -18,6 +18,7 @@ impl<'a> System<'a> for InitiativeSystem {
|
|||||||
WriteExpect<'a, RunState>,
|
WriteExpect<'a, RunState>,
|
||||||
ReadExpect<'a, Entity>,
|
ReadExpect<'a, Entity>,
|
||||||
ReadExpect<'a, Point>,
|
ReadExpect<'a, Point>,
|
||||||
|
ReadStorage<'a, Pools>,
|
||||||
);
|
);
|
||||||
|
|
||||||
fn run(&mut self, data: Self::SystemData) {
|
fn run(&mut self, data: Self::SystemData) {
|
||||||
@ -31,6 +32,7 @@ impl<'a> System<'a> for InitiativeSystem {
|
|||||||
mut runstate,
|
mut runstate,
|
||||||
player,
|
player,
|
||||||
player_pos,
|
player_pos,
|
||||||
|
pools,
|
||||||
) = data;
|
) = data;
|
||||||
|
|
||||||
if *runstate != RunState::Ticking {
|
if *runstate != RunState::Ticking {
|
||||||
@ -54,6 +56,11 @@ impl<'a> System<'a> for InitiativeSystem {
|
|||||||
initiative.current -= attr.quickness.bonus;
|
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
|
// TODO: More initiative granting boosts/penalties will go here later
|
||||||
|
|
||||||
// if its the player, we want to go to an AwaitingInput state
|
// 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("Fitness:", &attr.fitness, 6, ctx);
|
||||||
draw_attribute("Intelligence:", &attr.intelligence, 7, 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
|
// Equipped
|
||||||
let mut y = 9;
|
let mut y = 13;
|
||||||
let equipped = ecs.read_storage::<Equipped>();
|
let equipped = ecs.read_storage::<Equipped>();
|
||||||
let name = ecs.read_storage::<Name>();
|
let name = ecs.read_storage::<Name>();
|
||||||
for (equipped_by, item_name) in (&equipped, &name).join() {
|
for (equipped_by, item_name) in (&equipped, &name).join() {
|
||||||
|
Loading…
Reference in New Issue
Block a user