mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Poise damage dealt to a target in a stunned state is now no longer universally applied to the target as health damage.
Instead poise damage is only converted to health damage when its source is mitigated crushing damage. Fixed 'Long Pole' -> 'Longpole'
This commit is contained in:
parent
33014225be
commit
4a5ef6dce3
@ -15,7 +15,7 @@ ItemDef(
|
||||
buff_strength: 0.8,
|
||||
),
|
||||
hand_restriction: Some(Two),
|
||||
weapon_name: Universal("Long Pole"),
|
||||
weapon_name: Universal("Longpole"),
|
||||
)
|
||||
),
|
||||
quality: Low,
|
||||
|
@ -286,10 +286,27 @@ impl Attack {
|
||||
time,
|
||||
};
|
||||
if change.abs() > Poise::POISE_EPSILON {
|
||||
emit(ServerEvent::PoiseChange {
|
||||
entity: target.entity,
|
||||
change: poise_change,
|
||||
});
|
||||
// If target is in a stunned state, apply extra poise damage as health
|
||||
// damage instead
|
||||
if let Some(CharacterState::Stunned(data)) = target.char_state {
|
||||
let health_change =
|
||||
change * data.static_data.poise_state.damage_multiplier();
|
||||
let health_change = HealthChange {
|
||||
amount: health_change,
|
||||
by: attacker.map(|x| x.into()),
|
||||
cause: Some(damage.damage.source),
|
||||
time,
|
||||
};
|
||||
emit(ServerEvent::HealthChange {
|
||||
entity: target.entity,
|
||||
change: health_change,
|
||||
});
|
||||
} else {
|
||||
emit(ServerEvent::PoiseChange {
|
||||
entity: target.entity,
|
||||
change: poise_change,
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
// Piercing damage ignores some penetration, and is handled when damage
|
||||
|
@ -55,24 +55,11 @@ enum DamageContrib {
|
||||
pub fn handle_poise(server: &Server, entity: EcsEntity, change: comp::PoiseChange) {
|
||||
let ecs = &server.state.ecs();
|
||||
if let Some(character_state) = ecs.read_storage::<CharacterState>().get(entity) {
|
||||
// Entity is invincible to poise change during stunned/staggered character
|
||||
// state, but the mitigated poise damage is converted to health damage instead
|
||||
if let CharacterState::Stunned(data) = character_state {
|
||||
let health_change = change.amount * data.static_data.poise_state.damage_multiplier();
|
||||
let time = ecs.read_resource::<Time>();
|
||||
let health_change = HealthChange {
|
||||
amount: health_change,
|
||||
by: None,
|
||||
cause: None,
|
||||
time: *time,
|
||||
};
|
||||
let server_eventbus = ecs.read_resource::<EventBus<ServerEvent>>();
|
||||
server_eventbus.emit_now(ServerEvent::HealthChange {
|
||||
entity,
|
||||
change: health_change,
|
||||
});
|
||||
} else if let Some(mut poise) = ecs.write_storage::<Poise>().get_mut(entity) {
|
||||
poise.change(change);
|
||||
// Entity is invincible to poise change during stunned character state
|
||||
if !matches!(character_state, CharacterState::Stunned(_)) {
|
||||
if let Some(mut poise) = ecs.write_storage::<Poise>().get_mut(entity) {
|
||||
poise.change(change);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user