mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Simultaneous melee hits now show separately in SCT
This commit is contained in:
parent
a38f336c9e
commit
faff715c4f
@ -199,6 +199,7 @@ impl Attack {
|
|||||||
mut emit: impl FnMut(ServerEvent),
|
mut emit: impl FnMut(ServerEvent),
|
||||||
mut emit_outcome: impl FnMut(Outcome),
|
mut emit_outcome: impl FnMut(Outcome),
|
||||||
rng: &mut rand::rngs::ThreadRng,
|
rng: &mut rand::rngs::ThreadRng,
|
||||||
|
damage_instance_offset: u64,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
// TODO: Maybe move this higher and pass it as argument into this function?
|
// TODO: Maybe move this higher and pass it as argument into this function?
|
||||||
let msm = &MaterialStatManifest::load().read();
|
let msm = &MaterialStatManifest::load().read();
|
||||||
@ -238,6 +239,7 @@ impl Attack {
|
|||||||
.filter(|d| d.target.map_or(true, |t| t == target_group))
|
.filter(|d| d.target.map_or(true, |t| t == target_group))
|
||||||
.filter(|d| !avoid_damage(d))
|
.filter(|d| !avoid_damage(d))
|
||||||
{
|
{
|
||||||
|
let damage_instance = damage.instance + damage_instance_offset;
|
||||||
is_applied = true;
|
is_applied = true;
|
||||||
let damage_reduction = Attack::compute_damage_reduction(
|
let damage_reduction = Attack::compute_damage_reduction(
|
||||||
attacker.as_ref(),
|
attacker.as_ref(),
|
||||||
@ -256,7 +258,7 @@ impl Attack {
|
|||||||
self.crit_multiplier,
|
self.crit_multiplier,
|
||||||
strength_modifier * damage_modifier,
|
strength_modifier * damage_modifier,
|
||||||
time,
|
time,
|
||||||
damage.instance,
|
damage_instance,
|
||||||
);
|
);
|
||||||
let applied_damage = -change.amount;
|
let applied_damage = -change.amount;
|
||||||
accumulated_damage += applied_damage;
|
accumulated_damage += applied_damage;
|
||||||
@ -282,7 +284,7 @@ impl Attack {
|
|||||||
cause: Some(damage.damage.source),
|
cause: Some(damage.damage.source),
|
||||||
time,
|
time,
|
||||||
crit: is_crit,
|
crit: is_crit,
|
||||||
instance: damage.instance,
|
instance: damage_instance,
|
||||||
};
|
};
|
||||||
emit(ServerEvent::HealthChange {
|
emit(ServerEvent::HealthChange {
|
||||||
entity: target.entity,
|
entity: target.entity,
|
||||||
@ -331,7 +333,7 @@ impl Attack {
|
|||||||
amount: health_change,
|
amount: health_change,
|
||||||
by: attacker.map(|x| x.into()),
|
by: attacker.map(|x| x.into()),
|
||||||
cause: Some(damage.damage.source),
|
cause: Some(damage.damage.source),
|
||||||
instance: damage.instance,
|
instance: damage_instance,
|
||||||
crit: is_crit,
|
crit: is_crit,
|
||||||
time,
|
time,
|
||||||
};
|
};
|
||||||
|
@ -264,6 +264,7 @@ impl<'a> System<'a> for Sys {
|
|||||||
|e| server_events.push(e),
|
|e| server_events.push(e),
|
||||||
|o| outcomes.push(o),
|
|o| outcomes.push(o),
|
||||||
&mut rng,
|
&mut rng,
|
||||||
|
0,
|
||||||
);
|
);
|
||||||
|
|
||||||
add_hit_entities.push((beam_owner, *uid_b));
|
add_hit_entities.push((beam_owner, *uid_b));
|
||||||
|
@ -232,7 +232,7 @@ impl<'a> System<'a> for Sys {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let mut is_applied = false;
|
let mut is_applied = false;
|
||||||
for _ in 0..melee_attack.simultaneous_hits {
|
for offset in 0..melee_attack.simultaneous_hits {
|
||||||
is_applied = melee_attack.attack.apply_attack(
|
is_applied = melee_attack.attack.apply_attack(
|
||||||
attacker_info,
|
attacker_info,
|
||||||
&target_info,
|
&target_info,
|
||||||
@ -244,6 +244,7 @@ impl<'a> System<'a> for Sys {
|
|||||||
|e| server_emitter.emit(e),
|
|e| server_emitter.emit(e),
|
||||||
|o| outcomes_emitter.emit(o),
|
|o| outcomes_emitter.emit(o),
|
||||||
&mut rng,
|
&mut rng,
|
||||||
|
offset as u64,
|
||||||
) || is_applied;
|
) || is_applied;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -361,6 +361,7 @@ fn dispatch_hit(
|
|||||||
|e| server_emitter.emit(e),
|
|e| server_emitter.emit(e),
|
||||||
|o| outcomes_emitter.emit(o),
|
|o| outcomes_emitter.emit(o),
|
||||||
rng,
|
rng,
|
||||||
|
0,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
projectile::Effect::Explode(e) => {
|
projectile::Effect::Explode(e) => {
|
||||||
|
@ -254,6 +254,7 @@ impl<'a> System<'a> for Sys {
|
|||||||
|e| server_emitter.emit(e),
|
|e| server_emitter.emit(e),
|
||||||
|o| outcomes_emitter.emit(o),
|
|o| outcomes_emitter.emit(o),
|
||||||
&mut rng,
|
&mut rng,
|
||||||
|
0,
|
||||||
);
|
);
|
||||||
|
|
||||||
shockwave_hit_list.hit_entities.push(*uid_b);
|
shockwave_hit_list.hit_entities.push(*uid_b);
|
||||||
|
@ -1017,6 +1017,7 @@ pub fn handle_explosion(server: &Server, pos: Vec3<f32>, explosion: Explosion, o
|
|||||||
|e| emitter.emit(e),
|
|e| emitter.emit(e),
|
||||||
|o| outcomes_emitter.emit(o),
|
|o| outcomes_emitter.emit(o),
|
||||||
&mut rng,
|
&mut rng,
|
||||||
|
0,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user