mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Fixed gaining combo by shooting loot bags
This commit is contained in:
parent
1afe3b7de5
commit
92c9e8c477
@ -53,6 +53,7 @@ pub struct TargetInfo<'a> {
|
|||||||
pub entity: EcsEntity,
|
pub entity: EcsEntity,
|
||||||
pub inventory: Option<&'a Inventory>,
|
pub inventory: Option<&'a Inventory>,
|
||||||
pub stats: Option<&'a Stats>,
|
pub stats: Option<&'a Stats>,
|
||||||
|
pub health: Option<&'a Health>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(target_arch = "wasm32"))]
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
@ -229,7 +230,7 @@ impl Attack {
|
|||||||
.filter(|e| !(matches!(e.target, Some(GroupTarget::OutOfGroup)) && target_dodging))
|
.filter(|e| !(matches!(e.target, Some(GroupTarget::OutOfGroup)) && target_dodging))
|
||||||
{
|
{
|
||||||
if effect.requirements.iter().all(|req| match req {
|
if effect.requirements.iter().all(|req| match req {
|
||||||
CombatRequirement::AnyDamage => accumulated_damage > 0.0,
|
CombatRequirement::AnyDamage => accumulated_damage > 0.0 && target.health.is_some(),
|
||||||
CombatRequirement::Energy(r) => {
|
CombatRequirement::Energy(r) => {
|
||||||
if let Some(AttackerInfo {
|
if let Some(AttackerInfo {
|
||||||
entity,
|
entity,
|
||||||
|
@ -169,6 +169,7 @@ impl<'a> System<'a> for Sys {
|
|||||||
entity: target,
|
entity: target,
|
||||||
inventory: read_data.inventories.get(target),
|
inventory: read_data.inventories.get(target),
|
||||||
stats: read_data.stats.get(target),
|
stats: read_data.stats.get(target),
|
||||||
|
health: read_data.healths.get(target),
|
||||||
};
|
};
|
||||||
|
|
||||||
beam_segment.properties.attack.apply_attack(
|
beam_segment.properties.attack.apply_attack(
|
||||||
|
@ -124,6 +124,7 @@ impl<'a> System<'a> for Sys {
|
|||||||
entity: target,
|
entity: target,
|
||||||
inventory: read_data.inventories.get(target),
|
inventory: read_data.inventories.get(target),
|
||||||
stats: read_data.stats.get(target),
|
stats: read_data.stats.get(target),
|
||||||
|
health: read_data.healths.get(target),
|
||||||
};
|
};
|
||||||
|
|
||||||
melee_attack.attack.apply_attack(
|
melee_attack.attack.apply_attack(
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use common::{
|
use common::{
|
||||||
combat::{AttackerInfo, TargetInfo},
|
combat::{AttackerInfo, TargetInfo},
|
||||||
comp::{
|
comp::{
|
||||||
projectile, Combo, Energy, Group, HealthSource, Inventory, Ori, PhysicsState, Pos,
|
projectile, Combo, Energy, Group, Health, HealthSource, Inventory, Ori, PhysicsState, Pos,
|
||||||
Projectile, Stats, Vel,
|
Projectile, Stats, Vel,
|
||||||
},
|
},
|
||||||
event::{EventBus, ServerEvent},
|
event::{EventBus, ServerEvent},
|
||||||
@ -31,6 +31,7 @@ pub struct ReadData<'a> {
|
|||||||
energies: ReadStorage<'a, Energy>,
|
energies: ReadStorage<'a, Energy>,
|
||||||
stats: ReadStorage<'a, Stats>,
|
stats: ReadStorage<'a, Stats>,
|
||||||
combos: ReadStorage<'a, Combo>,
|
combos: ReadStorage<'a, Combo>,
|
||||||
|
healths: ReadStorage<'a, Health>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This system is responsible for handling projectile effect triggers
|
/// This system is responsible for handling projectile effect triggers
|
||||||
@ -119,6 +120,7 @@ impl<'a> System<'a> for Sys {
|
|||||||
entity: target,
|
entity: target,
|
||||||
inventory: read_data.inventories.get(target),
|
inventory: read_data.inventories.get(target),
|
||||||
stats: read_data.stats.get(target),
|
stats: read_data.stats.get(target),
|
||||||
|
health: read_data.healths.get(target),
|
||||||
};
|
};
|
||||||
|
|
||||||
attack.apply_attack(
|
attack.apply_attack(
|
||||||
|
@ -188,6 +188,7 @@ impl<'a> System<'a> for Sys {
|
|||||||
entity: target,
|
entity: target,
|
||||||
inventory: read_data.inventories.get(target),
|
inventory: read_data.inventories.get(target),
|
||||||
stats: read_data.stats.get(target),
|
stats: read_data.stats.get(target),
|
||||||
|
health: read_data.healths.get(target),
|
||||||
};
|
};
|
||||||
|
|
||||||
shockwave.properties.attack.apply_attack(
|
shockwave.properties.attack.apply_attack(
|
||||||
|
@ -697,17 +697,16 @@ pub fn handle_explosion(server: &Server, pos: Vec3<f32>, explosion: Explosion, o
|
|||||||
RadiusEffect::Attack(attack) => {
|
RadiusEffect::Attack(attack) => {
|
||||||
let energies = &ecs.read_storage::<comp::Energy>();
|
let energies = &ecs.read_storage::<comp::Energy>();
|
||||||
let combos = &ecs.read_storage::<comp::Combo>();
|
let combos = &ecs.read_storage::<comp::Combo>();
|
||||||
for (entity_b, pos_b, _health_b, inventory_b_maybe, stats_b_maybe, body_b_maybe) in
|
for (entity_b, pos_b, health_b, inventory_b_maybe, stats_b_maybe, body_b_maybe) in (
|
||||||
(
|
&ecs.entities(),
|
||||||
&ecs.entities(),
|
&ecs.read_storage::<comp::Pos>(),
|
||||||
&ecs.read_storage::<comp::Pos>(),
|
&ecs.read_storage::<comp::Health>(),
|
||||||
&ecs.read_storage::<comp::Health>(),
|
ecs.read_storage::<comp::Inventory>().maybe(),
|
||||||
ecs.read_storage::<comp::Inventory>().maybe(),
|
ecs.read_storage::<comp::Stats>().maybe(),
|
||||||
ecs.read_storage::<comp::Stats>().maybe(),
|
ecs.read_storage::<comp::Body>().maybe(),
|
||||||
ecs.read_storage::<comp::Body>().maybe(),
|
)
|
||||||
)
|
.join()
|
||||||
.join()
|
.filter(|(_, _, h, _, _, _)| !h.is_dead)
|
||||||
.filter(|(_, _, h, _, _, _)| !h.is_dead)
|
|
||||||
{
|
{
|
||||||
// Check if it is a hit
|
// Check if it is a hit
|
||||||
let strength = if let Some(body) = body_b_maybe {
|
let strength = if let Some(body) = body_b_maybe {
|
||||||
@ -749,6 +748,7 @@ pub fn handle_explosion(server: &Server, pos: Vec3<f32>, explosion: Explosion, o
|
|||||||
entity: entity_b,
|
entity: entity_b,
|
||||||
inventory: inventory_b_maybe,
|
inventory: inventory_b_maybe,
|
||||||
stats: stats_b_maybe,
|
stats: stats_b_maybe,
|
||||||
|
health: Some(health_b),
|
||||||
};
|
};
|
||||||
|
|
||||||
let server_eventbus = ecs.read_resource::<EventBus<ServerEvent>>();
|
let server_eventbus = ecs.read_resource::<EventBus<ServerEvent>>();
|
||||||
|
Loading…
Reference in New Issue
Block a user