fix: fixed impenetrable proccing on heavy artillery hit
This commit is contained in:
parent
e7bad12bef
commit
34fe16407e
1 changed files with 23 additions and 9 deletions
|
|
@ -13,7 +13,7 @@ use proxisim_models::bundle::{
|
||||||
},
|
},
|
||||||
weapon::{
|
weapon::{
|
||||||
Ammo, AmmoType, DamageStat, NeedsReload, NonTargeted, RateOfFire, Usable, Uses, Weapon,
|
Ammo, AmmoType, DamageStat, NeedsReload, NonTargeted, RateOfFire, Usable, Uses, Weapon,
|
||||||
WeaponSlot,
|
WeaponCategory, WeaponSlot,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use rand::Rng as _;
|
use rand::Rng as _;
|
||||||
|
|
@ -197,8 +197,7 @@ fn check_bonus_mitigation(
|
||||||
w_children: &Children,
|
w_children: &Children,
|
||||||
armour_mitigation: &mut f32,
|
armour_mitigation: &mut f32,
|
||||||
piece: &mut Option<&BodyPartCoverage>,
|
piece: &mut Option<&BodyPartCoverage>,
|
||||||
slot: WeaponSlot,
|
cat: &WeaponCategory,
|
||||||
rounds: &Option<u16>,
|
|
||||||
health: &Health,
|
health: &Health,
|
||||||
max_health: &SimpleStatEffective<MaxHealth>,
|
max_health: &SimpleStatEffective<MaxHealth>,
|
||||||
) -> f32 {
|
) -> f32 {
|
||||||
|
|
@ -221,10 +220,26 @@ fn check_bonus_mitigation(
|
||||||
&& let Some(mut mitigation) = params.mitigation_q.get_mut(piece.armour).unwrap()
|
&& let Some(mut mitigation) = params.mitigation_q.get_mut(piece.armour).unwrap()
|
||||||
{
|
{
|
||||||
match mitigation.as_mut() {
|
match mitigation.as_mut() {
|
||||||
DamageMitigationBonus::Impregnable { mitigation } if slot == WeaponSlot::Melee => {
|
DamageMitigationBonus::Impregnable { mitigation }
|
||||||
|
if matches!(
|
||||||
|
*cat,
|
||||||
|
WeaponCategory::Clubbing | WeaponCategory::Piercing | WeaponCategory::Slashing
|
||||||
|
) =>
|
||||||
|
{
|
||||||
|
*mitigation
|
||||||
|
}
|
||||||
|
DamageMitigationBonus::Impenetrable { mitigation }
|
||||||
|
if matches!(
|
||||||
|
*cat,
|
||||||
|
WeaponCategory::MachineGun
|
||||||
|
| WeaponCategory::Pistol
|
||||||
|
| WeaponCategory::Rifle
|
||||||
|
| WeaponCategory::Shotgun
|
||||||
|
| WeaponCategory::Smg
|
||||||
|
) =>
|
||||||
|
{
|
||||||
*mitigation
|
*mitigation
|
||||||
}
|
}
|
||||||
DamageMitigationBonus::Impenetrable { mitigation } if rounds.is_some() => *mitigation,
|
|
||||||
DamageMitigationBonus::Insurmountable { mitigation } => {
|
DamageMitigationBonus::Insurmountable { mitigation } => {
|
||||||
if health.0 as f32 / max_health.value as f32 <= 0.25 {
|
if health.0 as f32 / max_health.value as f32 <= 0.25 {
|
||||||
*mitigation
|
*mitigation
|
||||||
|
|
@ -425,7 +440,7 @@ struct EntityParams<'w, 's> {
|
||||||
&'static SimpleStatEffective<DamageBonus>,
|
&'static SimpleStatEffective<DamageBonus>,
|
||||||
&'static SimpleStatEffective<CritRate>,
|
&'static SimpleStatEffective<CritRate>,
|
||||||
&'static Children,
|
&'static Children,
|
||||||
&'static WeaponSlot,
|
&'static WeaponCategory,
|
||||||
Has<NonTargeted>,
|
Has<NonTargeted>,
|
||||||
),
|
),
|
||||||
(With<Weapon>, With<Current>, Without<NeedsReload>),
|
(With<Weapon>, With<Current>, Without<NeedsReload>),
|
||||||
|
|
@ -495,7 +510,7 @@ fn use_damaging_weapon(
|
||||||
),
|
),
|
||||||
dmg_spread: Local<DamageSpread>,
|
dmg_spread: Local<DamageSpread>,
|
||||||
) {
|
) {
|
||||||
let Ok((weapon, w_dmg, acc, dmg_bonus, crit, children, slot, non_targeted)) =
|
let Ok((weapon, w_dmg, acc, dmg_bonus, crit, children, w_cat, non_targeted)) =
|
||||||
entities.weapon_q.single()
|
entities.weapon_q.single()
|
||||||
else {
|
else {
|
||||||
return;
|
return;
|
||||||
|
|
@ -689,8 +704,7 @@ fn use_damaging_weapon(
|
||||||
children,
|
children,
|
||||||
&mut armour_mitigation,
|
&mut armour_mitigation,
|
||||||
&mut piece,
|
&mut piece,
|
||||||
*slot,
|
w_cat,
|
||||||
&rounds,
|
|
||||||
&health,
|
&health,
|
||||||
target_max_health,
|
target_max_health,
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue