mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Addressed feedback in sceptre branch
This commit is contained in:
parent
de45784596
commit
5bd6f0e26f
@ -46,6 +46,11 @@ impl CharacterBehavior for Data {
|
|||||||
handle_move(data, &mut update, 0.4);
|
handle_move(data, &mut update, 0.4);
|
||||||
handle_jump(data, &mut update);
|
handle_jump(data, &mut update);
|
||||||
|
|
||||||
|
if unwrap_tool_data(data).is_none() {
|
||||||
|
update.character = CharacterState::Idle;
|
||||||
|
return update;
|
||||||
|
}
|
||||||
|
|
||||||
if self.buildup_duration != Duration::default() {
|
if self.buildup_duration != Duration::default() {
|
||||||
// Build up
|
// Build up
|
||||||
update.character = CharacterState::BasicBeam(Data {
|
update.character = CharacterState::BasicBeam(Data {
|
||||||
|
@ -189,36 +189,44 @@ impl<'a> System<'a> for Sys {
|
|||||||
damage.modify_damage(block, loadout);
|
damage.modify_damage(block, loadout);
|
||||||
}
|
}
|
||||||
|
|
||||||
if damage.healthchange != 0.0 {
|
if is_damage {
|
||||||
let cause = if is_heal {
|
|
||||||
HealthSource::Healing { by: beam.owner }
|
|
||||||
} else {
|
|
||||||
HealthSource::Energy { owner: beam.owner }
|
|
||||||
};
|
|
||||||
server_emitter.emit(ServerEvent::Damage {
|
server_emitter.emit(ServerEvent::Damage {
|
||||||
uid: *uid_b,
|
uid: *uid_b,
|
||||||
change: HealthChange {
|
change: HealthChange {
|
||||||
amount: damage.healthchange as i32,
|
amount: damage.healthchange as i32,
|
||||||
cause,
|
cause: HealthSource::Energy { owner: beam.owner },
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
if is_damage && beam.lifesteal_eff > 0.0 {
|
server_emitter.emit(ServerEvent::Damage {
|
||||||
server_emitter.emit(ServerEvent::Damage {
|
uid: beam.owner.unwrap_or(*uid),
|
||||||
uid: beam.owner.unwrap_or(*uid),
|
change: HealthChange {
|
||||||
change: HealthChange {
|
amount: (-damage.healthchange * beam.lifesteal_eff) as i32,
|
||||||
amount: (-damage.healthchange * beam.lifesteal_eff) as i32,
|
cause: HealthSource::Healing { by: beam.owner },
|
||||||
cause: HealthSource::Healing { by: beam.owner },
|
},
|
||||||
},
|
});
|
||||||
});
|
if let Some(energy_mut) = beam
|
||||||
|
.owner
|
||||||
|
.and_then(|o| uid_allocator.retrieve_entity_internal(o.into()))
|
||||||
|
.and_then(|o| energies.get_mut(o))
|
||||||
|
{
|
||||||
|
energy_mut
|
||||||
|
.change_by(beam.energy_regen as i32, EnergySource::HitEnemy);
|
||||||
}
|
}
|
||||||
if is_damage || stats_b.health.current() != stats_b.health.maximum() {
|
}
|
||||||
if let Some(energy_mut) = beam
|
if is_heal {
|
||||||
.owner
|
if let Some(energy_mut) = beam
|
||||||
.and_then(|o| uid_allocator.retrieve_entity_internal(o.into()))
|
.owner
|
||||||
.and_then(|o| energies.get_mut(o))
|
.and_then(|o| uid_allocator.retrieve_entity_internal(o.into()))
|
||||||
{
|
.and_then(|o| energies.get_mut(o))
|
||||||
energy_mut
|
{
|
||||||
.change_by(beam.energy_regen as i32, EnergySource::HitEnemy);
|
if energy_mut.try_change_by(-(beam.energy_regen as i32), EnergySource::Ability).is_ok() {
|
||||||
|
server_emitter.emit(ServerEvent::Damage {
|
||||||
|
uid: *uid_b,
|
||||||
|
change: HealthChange {
|
||||||
|
amount: damage.healthchange as i32,
|
||||||
|
cause: HealthSource::Healing { by: beam.owner },
|
||||||
|
},
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user