fix Trap projectile

This commit is contained in:
flo666 2023-04-18 09:27:25 +02:00 committed by Sam
parent 713baa615e
commit f13c3774c0

View File

@ -127,8 +127,6 @@ pub enum ProjectileConstructor {
},
Trap {
damage: f32,
knockback: f32,
energy_regen: f32,
},
}
@ -795,57 +793,27 @@ impl ProjectileConstructor {
is_point: true,
}
},
Trap {
damage,
knockback,
energy_regen,
} => {
let knockback = AttackEffect::new(
Some(GroupTarget::OutOfGroup),
CombatEffect::Knockback(Knockback {
strength: knockback,
direction: KnockbackDir::Away,
})
.adjusted_by_stats(tool_stats),
)
.with_requirement(CombatRequirement::AnyDamage);
let energy = AttackEffect::new(None, CombatEffect::EnergyReward(energy_regen))
.with_requirement(CombatRequirement::AnyDamage);
let buff = CombatEffect::Buff(CombatBuff {
kind: BuffKind::Bleeding,
dur_secs: 10.0,
strength: CombatBuffStrength::DamageFraction(0.5),
chance: 0.3,
})
.adjusted_by_stats(tool_stats);
let mut damage = AttackDamage::new(
Trap { damage } => {
let damage = AttackDamage::new(
Damage {
source: DamageSource::Projectile,
source: DamageSource::Explosion,
kind: DamageKind::Piercing,
value: damage,
},
Some(GroupTarget::OutOfGroup),
instance,
)
.with_effect(buff);
if let Some(damage_effect) = damage_effect {
damage = damage.with_effect(damage_effect);
}
);
let attack = Attack::default()
.with_damage(damage)
.with_crit(crit_chance, crit_mult)
.with_effect(energy)
.with_effect(knockback)
.with_combo_increment();
.with_crit(crit_chance, crit_mult);
Projectile {
hit_solid: vec![Effect::Stick, Effect::Bonk],
hit_solid: vec![],
hit_entity: vec![Effect::Attack(attack), Effect::Vanish],
time_left: Duration::from_secs(15),
time_left: Duration::from_secs(300),
owner,
ignore_group: true,
is_sticky: true,
is_point: true,
is_point: false,
}
},
}
@ -971,13 +939,8 @@ impl ProjectileConstructor {
*damage *= power;
*radius *= range;
},
Trap {
ref mut damage,
ref mut energy_regen,
..
} => {
Trap { ref mut damage, .. } => {
*damage *= power;
*energy_regen *= regen;
},
}
self