summaryrefslogtreecommitdiff
path: root/src/systems/fight.rs
diff options
context:
space:
mode:
authortroido <troido@protonmail.com>2020-03-05 14:47:48 +0100
committertroido <troido@protonmail.com>2020-03-05 14:47:48 +0100
commita520382eb19e4234ed52fd1eb9fb965b5967d522 (patch)
tree5b4a8831cd544f57c6119eac5785973dc9e9bd50 /src/systems/fight.rs
parent7846b871f5c9d57a19dbf09b7acbf0d6b38a69ca (diff)
equipment is now a part of the inventory
Diffstat (limited to 'src/systems/fight.rs')
-rw-r--r--src/systems/fight.rs11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/systems/fight.rs b/src/systems/fight.rs
index 7a02ba0..3e1142b 100644
--- a/src/systems/fight.rs
+++ b/src/systems/fight.rs
@@ -19,8 +19,7 @@ use crate::components::{
ControlCooldown,
Autofight,
Faction,
- Equipment,
- equipment::Stat
+ Inventory
};
use crate::controls::{Control};
@@ -41,10 +40,10 @@ impl <'a> System<'a> for Fight {
WriteStorage<'a, ControlCooldown>,
WriteStorage<'a, Autofight>,
ReadStorage<'a, Faction>,
- ReadStorage<'a, Equipment>
+ ReadStorage<'a, Inventory>
);
- fn run(&mut self, (entities, controllers, positions, ground, mut attacked, fighters, healths, mut cooldowns, mut autofighters, factions, equipments): Self::SystemData) {
+ fn run(&mut self, (entities, controllers, positions, ground, mut attacked, fighters, healths, mut cooldowns, mut autofighters, factions, inventories): Self::SystemData) {
for (entity, controller, position, fighter) in (&entities, &controllers, &positions, &fighters).join(){
let mut target = None;
match &controller.control {
@@ -70,8 +69,8 @@ impl <'a> System<'a> for Fight {
}
if let Some(ent) = target {
let mut attack = fighter.attack.clone();
- if let Some(equipment) = equipments.get(entity) {
- attack = attack.apply_bonuses(&equipment.all_bonuses());
+ if let Some(inventory) = inventories.get(entity) {
+ attack = attack.apply_bonuses(&inventory.equipment_bonuses());
}
AttackInbox::add_message(&mut attacked, ent, AttackMessage{typ: attack, attacker: Some(entity)});
cooldowns.insert(entity, ControlCooldown{amount: fighter.cooldown}).unwrap();