mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Changed knockback to be an effect on the overall attack, rather than a damage.
This commit is contained in:
parent
17d1432be0
commit
af982ec0bb
@ -98,8 +98,8 @@ impl Attack {
|
||||
self.crit_multiplier,
|
||||
strength_modifier,
|
||||
);
|
||||
let damage_damage = -change.amount as f32;
|
||||
accumulated_damage += damage_damage;
|
||||
let applied_damage = -change.amount as f32;
|
||||
accumulated_damage += applied_damage;
|
||||
if change.amount != 0 {
|
||||
server_events.push(ServerEvent::Damage {
|
||||
entity: target_entity,
|
||||
@ -130,14 +130,14 @@ impl Attack {
|
||||
server_events.push(ServerEvent::Buff {
|
||||
entity: target_entity,
|
||||
buff_change: BuffChange::Add(
|
||||
b.to_buff(attacker_uid, damage_damage),
|
||||
b.to_buff(attacker_uid, applied_damage),
|
||||
),
|
||||
});
|
||||
}
|
||||
},
|
||||
AttackEffect::Lifesteal(l) => {
|
||||
let change = HealthChange {
|
||||
amount: (damage_damage * l) as i32,
|
||||
amount: (applied_damage * l) as i32,
|
||||
cause: HealthSource::Heal {
|
||||
by: Some(attacker_uid),
|
||||
},
|
||||
|
@ -76,25 +76,27 @@ impl ProjectileConstructor {
|
||||
knockback,
|
||||
energy_regen,
|
||||
} => {
|
||||
let damage = Damage {
|
||||
source: DamageSource::Projectile,
|
||||
value: damage,
|
||||
};
|
||||
let knockback = AttackEffect::Knockback(Knockback {
|
||||
strength: knockback,
|
||||
direction: KnockbackDir::Away,
|
||||
});
|
||||
let knockback = EffectComponent::new(Some(GroupTarget::OutOfGroup), knockback)
|
||||
.with_requirement(CombatRequirement::AnyDamage);
|
||||
let energy = AttackEffect::EnergyReward(energy_regen);
|
||||
let energy = EffectComponent::new(None, energy)
|
||||
.with_requirement(CombatRequirement::AnyDamage);
|
||||
let buff = AttackEffect::Buff(CombatBuff::default_physical());
|
||||
let damage = DamageComponent::new(damage, Some(GroupTarget::OutOfGroup))
|
||||
.with_effect(knockback)
|
||||
.with_effect(buff);
|
||||
let damage = Damage {
|
||||
source: DamageSource::Projectile,
|
||||
value: damage,
|
||||
};
|
||||
let damage =
|
||||
DamageComponent::new(damage, Some(GroupTarget::OutOfGroup)).with_effect(buff);
|
||||
let attack = Attack::default()
|
||||
.with_damage(damage)
|
||||
.with_crit(0.5, 1.2)
|
||||
.with_effect(energy);
|
||||
.with_effect(energy)
|
||||
.with_effect(knockback);
|
||||
|
||||
Projectile {
|
||||
hit_solid: vec![Effect::Stick],
|
||||
@ -109,13 +111,13 @@ impl ProjectileConstructor {
|
||||
radius,
|
||||
energy_regen,
|
||||
} => {
|
||||
let energy = AttackEffect::EnergyReward(energy_regen);
|
||||
let energy = EffectComponent::new(None, energy)
|
||||
.with_requirement(CombatRequirement::AnyDamage);
|
||||
let damage = Damage {
|
||||
source: DamageSource::Explosion,
|
||||
value: damage,
|
||||
};
|
||||
let energy = AttackEffect::EnergyReward(energy_regen);
|
||||
let energy = EffectComponent::new(None, energy)
|
||||
.with_requirement(CombatRequirement::AnyDamage);
|
||||
let damage = DamageComponent::new(damage, Some(GroupTarget::OutOfGroup));
|
||||
let attack = Attack::default().with_damage(damage).with_effect(energy);
|
||||
let explosion = Explosion {
|
||||
@ -137,13 +139,13 @@ impl ProjectileConstructor {
|
||||
damage,
|
||||
energy_regen,
|
||||
} => {
|
||||
let energy = AttackEffect::EnergyReward(energy_regen);
|
||||
let energy = EffectComponent::new(None, energy)
|
||||
.with_requirement(CombatRequirement::AnyDamage);
|
||||
let damage = Damage {
|
||||
source: DamageSource::Energy,
|
||||
value: damage,
|
||||
};
|
||||
let energy = AttackEffect::EnergyReward(energy_regen);
|
||||
let energy = EffectComponent::new(None, energy)
|
||||
.with_requirement(CombatRequirement::AnyDamage);
|
||||
let damage = DamageComponent::new(damage, Some(GroupTarget::OutOfGroup));
|
||||
let attack = Attack::default().with_damage(damage).with_effect(energy);
|
||||
|
||||
|
@ -92,10 +92,6 @@ impl CharacterBehavior for Data {
|
||||
..*self
|
||||
});
|
||||
|
||||
let damage = Damage {
|
||||
source: DamageSource::Melee,
|
||||
value: self.static_data.base_damage as f32,
|
||||
};
|
||||
let poise = AttackEffect::Poise(self.static_data.base_poise_damage as f32);
|
||||
let poise = EffectComponent::new(Some(GroupTarget::OutOfGroup), poise)
|
||||
.with_requirement(CombatRequirement::AnyDamage);
|
||||
@ -103,18 +99,24 @@ impl CharacterBehavior for Data {
|
||||
strength: self.static_data.knockback,
|
||||
direction: KnockbackDir::Away,
|
||||
});
|
||||
let knockback = EffectComponent::new(Some(GroupTarget::OutOfGroup), knockback)
|
||||
.with_requirement(CombatRequirement::AnyDamage);
|
||||
let energy = AttackEffect::EnergyReward(50);
|
||||
let energy = EffectComponent::new(None, energy)
|
||||
.with_requirement(CombatRequirement::AnyDamage);
|
||||
let buff = AttackEffect::Buff(CombatBuff::default_physical());
|
||||
let damage = Damage {
|
||||
source: DamageSource::Melee,
|
||||
value: self.static_data.base_damage as f32,
|
||||
};
|
||||
let damage = DamageComponent::new(damage, Some(GroupTarget::OutOfGroup))
|
||||
.with_effect(knockback)
|
||||
.with_effect(buff);
|
||||
let attack = Attack::default()
|
||||
.with_damage(damage)
|
||||
.with_crit(0.5, 1.3)
|
||||
.with_effect(energy)
|
||||
.with_effect(poise);
|
||||
.with_effect(poise)
|
||||
.with_effect(knockback);
|
||||
|
||||
// Hit attempt
|
||||
data.updater.insert(data.entity, MeleeAttack {
|
||||
|
@ -155,11 +155,6 @@ impl CharacterBehavior for Data {
|
||||
exhausted: true,
|
||||
..*self
|
||||
});
|
||||
let damage = Damage {
|
||||
source: DamageSource::Melee,
|
||||
value: self.static_data.initial_damage as f32
|
||||
+ self.charge_amount * self.static_data.scaled_damage as f32,
|
||||
};
|
||||
let poise = self.static_data.initial_poise_damage as f32
|
||||
+ self.charge_amount * self.static_data.scaled_poise_damage as f32;
|
||||
let poise = AttackEffect::Poise(poise);
|
||||
@ -171,14 +166,21 @@ impl CharacterBehavior for Data {
|
||||
strength: knockback,
|
||||
direction: KnockbackDir::Away,
|
||||
});
|
||||
let knockback = EffectComponent::new(Some(GroupTarget::OutOfGroup), knockback)
|
||||
.with_requirement(CombatRequirement::AnyDamage);
|
||||
let buff = AttackEffect::Buff(CombatBuff::default_physical());
|
||||
let damage = Damage {
|
||||
source: DamageSource::Melee,
|
||||
value: self.static_data.initial_damage as f32
|
||||
+ self.charge_amount * self.static_data.scaled_damage as f32,
|
||||
};
|
||||
let damage = DamageComponent::new(damage, Some(GroupTarget::OutOfGroup))
|
||||
.with_effect(knockback)
|
||||
.with_effect(buff);
|
||||
let attack = Attack::default()
|
||||
.with_damage(damage)
|
||||
.with_crit(0.5, 1.3)
|
||||
.with_effect(poise);
|
||||
.with_effect(poise)
|
||||
.with_effect(knockback);
|
||||
|
||||
// Hit attempt
|
||||
data.updater.insert(data.entity, MeleeAttack {
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::{
|
||||
combat::{
|
||||
Attack, AttackEffect, CombatBuff, Damage, DamageComponent, DamageSource, GroupTarget,
|
||||
Knockback, KnockbackDir,
|
||||
Attack, AttackEffect, CombatBuff, CombatRequirement, Damage, DamageComponent, DamageSource,
|
||||
EffectComponent, GroupTarget, Knockback, KnockbackDir,
|
||||
},
|
||||
comp::{
|
||||
projectile, Body, CharacterState, EnergyChange, EnergySource, Gravity, LightEmitter,
|
||||
@ -103,22 +103,26 @@ impl CharacterBehavior for Data {
|
||||
let charge_frac = (self.timer.as_secs_f32()
|
||||
/ self.static_data.charge_duration.as_secs_f32())
|
||||
.min(1.0);
|
||||
let damage = Damage {
|
||||
source: DamageSource::Projectile,
|
||||
value: self.static_data.initial_damage as f32
|
||||
+ charge_frac * self.static_data.scaled_damage as f32,
|
||||
};
|
||||
let knockback = self.static_data.initial_knockback
|
||||
+ charge_frac * self.static_data.scaled_knockback;
|
||||
let knockback = AttackEffect::Knockback(Knockback {
|
||||
strength: knockback,
|
||||
direction: KnockbackDir::Away,
|
||||
});
|
||||
let knockback = EffectComponent::new(Some(GroupTarget::OutOfGroup), knockback)
|
||||
.with_requirement(CombatRequirement::AnyDamage);
|
||||
let buff = AttackEffect::Buff(CombatBuff::default_physical());
|
||||
let damage = Damage {
|
||||
source: DamageSource::Projectile,
|
||||
value: self.static_data.initial_damage as f32
|
||||
+ charge_frac * self.static_data.scaled_damage as f32,
|
||||
};
|
||||
let damage = DamageComponent::new(damage, Some(GroupTarget::OutOfGroup))
|
||||
.with_effect(knockback)
|
||||
.with_effect(buff);
|
||||
let attack = Attack::default().with_damage(damage).with_crit(0.5, 1.2);
|
||||
let attack = Attack::default()
|
||||
.with_damage(damage)
|
||||
.with_crit(0.5, 1.2)
|
||||
.with_effect(knockback);
|
||||
|
||||
// Fire
|
||||
let projectile = Projectile {
|
||||
|
@ -185,14 +185,12 @@ impl CharacterBehavior for Data {
|
||||
let poise = EffectComponent::new(Some(GroupTarget::OutOfGroup), poise)
|
||||
.with_requirement(CombatRequirement::AnyDamage);
|
||||
|
||||
let damage = Damage {
|
||||
source: DamageSource::Melee,
|
||||
value: damage as f32,
|
||||
};
|
||||
let knockback = AttackEffect::Knockback(Knockback {
|
||||
strength: self.static_data.stage_data[stage_index].knockback,
|
||||
direction: KnockbackDir::Away,
|
||||
});
|
||||
let knockback = EffectComponent::new(Some(GroupTarget::OutOfGroup), knockback)
|
||||
.with_requirement(CombatRequirement::AnyDamage);
|
||||
let energy = self.static_data.max_energy_gain.min(
|
||||
self.static_data.initial_energy_gain
|
||||
+ self.combo * self.static_data.energy_increase,
|
||||
@ -201,14 +199,18 @@ impl CharacterBehavior for Data {
|
||||
let energy = EffectComponent::new(None, energy)
|
||||
.with_requirement(CombatRequirement::AnyDamage);
|
||||
let buff = AttackEffect::Buff(CombatBuff::default_physical());
|
||||
let damage = Damage {
|
||||
source: DamageSource::Melee,
|
||||
value: damage as f32,
|
||||
};
|
||||
let damage = DamageComponent::new(damage, Some(GroupTarget::OutOfGroup))
|
||||
.with_effect(knockback)
|
||||
.with_effect(buff);
|
||||
let attack = Attack::default()
|
||||
.with_damage(damage)
|
||||
.with_crit(0.5, 1.3)
|
||||
.with_effect(energy)
|
||||
.with_effect(poise);
|
||||
.with_effect(poise)
|
||||
.with_effect(knockback);
|
||||
|
||||
data.updater.insert(data.entity, MeleeAttack {
|
||||
attack,
|
||||
|
@ -132,11 +132,6 @@ impl CharacterBehavior for Data {
|
||||
if !self.exhausted {
|
||||
// Hit attempt (also checks if player is moving)
|
||||
if update.vel.0.distance_squared(Vec3::zero()) > 1.0 {
|
||||
let damage = Damage {
|
||||
source: DamageSource::Melee,
|
||||
value: self.static_data.base_damage as f32
|
||||
+ charge_frac * self.static_data.scaled_damage as f32,
|
||||
};
|
||||
let poise = self.static_data.base_poise_damage as f32
|
||||
+ charge_frac * self.static_data.scaled_poise_damage as f32;
|
||||
let poise = AttackEffect::Poise(poise);
|
||||
@ -148,15 +143,23 @@ impl CharacterBehavior for Data {
|
||||
strength: knockback,
|
||||
direction: KnockbackDir::Away,
|
||||
});
|
||||
let knockback =
|
||||
EffectComponent::new(Some(GroupTarget::OutOfGroup), knockback)
|
||||
.with_requirement(CombatRequirement::AnyDamage);
|
||||
let buff = AttackEffect::Buff(CombatBuff::default_physical());
|
||||
let damage = Damage {
|
||||
source: DamageSource::Melee,
|
||||
value: self.static_data.base_damage as f32
|
||||
+ charge_frac * self.static_data.scaled_damage as f32,
|
||||
};
|
||||
let damage =
|
||||
DamageComponent::new(damage, Some(GroupTarget::OutOfGroup))
|
||||
.with_effect(knockback)
|
||||
.with_effect(buff);
|
||||
let attack = Attack::default()
|
||||
.with_damage(damage)
|
||||
.with_crit(0.5, 1.3)
|
||||
.with_effect(poise);
|
||||
.with_effect(poise)
|
||||
.with_effect(knockback);
|
||||
|
||||
data.updater.insert(data.entity, MeleeAttack {
|
||||
attack,
|
||||
|
@ -150,10 +150,6 @@ impl CharacterBehavior for Data {
|
||||
},
|
||||
StageSection::Recover => {
|
||||
if !self.exhausted {
|
||||
let damage = Damage {
|
||||
source: DamageSource::Melee,
|
||||
value: self.static_data.base_damage as f32,
|
||||
};
|
||||
let poise = AttackEffect::Poise(self.static_data.base_poise_damage as f32);
|
||||
let poise = EffectComponent::new(Some(GroupTarget::OutOfGroup), poise)
|
||||
.with_requirement(CombatRequirement::AnyDamage);
|
||||
@ -161,14 +157,20 @@ impl CharacterBehavior for Data {
|
||||
strength: self.static_data.knockback,
|
||||
direction: KnockbackDir::Away,
|
||||
});
|
||||
let knockback = EffectComponent::new(Some(GroupTarget::OutOfGroup), knockback)
|
||||
.with_requirement(CombatRequirement::AnyDamage);
|
||||
let buff = AttackEffect::Buff(CombatBuff::default_physical());
|
||||
let damage = Damage {
|
||||
source: DamageSource::Melee,
|
||||
value: self.static_data.base_damage as f32,
|
||||
};
|
||||
let damage = DamageComponent::new(damage, Some(GroupTarget::OutOfGroup))
|
||||
.with_effect(knockback)
|
||||
.with_effect(buff);
|
||||
let attack = Attack::default()
|
||||
.with_damage(damage)
|
||||
.with_crit(0.5, 1.3)
|
||||
.with_effect(poise);
|
||||
.with_effect(poise)
|
||||
.with_effect(knockback);
|
||||
|
||||
// Hit attempt, when animation plays
|
||||
data.updater.insert(data.entity, MeleeAttack {
|
||||
|
@ -83,17 +83,21 @@ impl CharacterBehavior for Data {
|
||||
});
|
||||
} else {
|
||||
// Attack
|
||||
let damage = Damage {
|
||||
source: DamageSource::Shockwave,
|
||||
value: self.static_data.damage as f32,
|
||||
};
|
||||
let poise = AttackEffect::Poise(self.static_data.poise_damage as f32);
|
||||
let poise = EffectComponent::new(Some(GroupTarget::OutOfGroup), poise)
|
||||
.with_requirement(CombatRequirement::AnyDamage);
|
||||
let knockback = AttackEffect::Knockback(self.static_data.knockback);
|
||||
let damage = DamageComponent::new(damage, Some(GroupTarget::OutOfGroup))
|
||||
let knockback = EffectComponent::new(Some(GroupTarget::OutOfGroup), knockback)
|
||||
.with_requirement(CombatRequirement::AnyDamage);
|
||||
let damage = Damage {
|
||||
source: DamageSource::Shockwave,
|
||||
value: self.static_data.damage as f32,
|
||||
};
|
||||
let damage = DamageComponent::new(damage, Some(GroupTarget::OutOfGroup));
|
||||
let attack = Attack::default()
|
||||
.with_damage(damage)
|
||||
.with_effect(poise)
|
||||
.with_effect(knockback);
|
||||
let attack = Attack::default().with_damage(damage).with_effect(poise);
|
||||
let properties = shockwave::Properties {
|
||||
angle: self.static_data.shockwave_angle,
|
||||
vertical_angle: self.static_data.shockwave_vertical_angle,
|
||||
|
@ -115,10 +115,6 @@ impl CharacterBehavior for Data {
|
||||
..*self
|
||||
});
|
||||
|
||||
let damage = Damage {
|
||||
source: DamageSource::Melee,
|
||||
value: self.static_data.base_damage as f32,
|
||||
};
|
||||
let poise = AttackEffect::Poise(self.static_data.base_poise_damage as f32);
|
||||
let poise = EffectComponent::new(Some(GroupTarget::OutOfGroup), poise)
|
||||
.with_requirement(CombatRequirement::AnyDamage);
|
||||
@ -126,14 +122,20 @@ impl CharacterBehavior for Data {
|
||||
strength: self.static_data.knockback,
|
||||
direction: KnockbackDir::Away,
|
||||
});
|
||||
let knockback = EffectComponent::new(Some(GroupTarget::OutOfGroup), knockback)
|
||||
.with_requirement(CombatRequirement::AnyDamage);
|
||||
let buff = AttackEffect::Buff(CombatBuff::default_physical());
|
||||
let damage = Damage {
|
||||
source: DamageSource::Melee,
|
||||
value: self.static_data.base_damage as f32,
|
||||
};
|
||||
let damage = DamageComponent::new(damage, Some(GroupTarget::OutOfGroup))
|
||||
.with_effect(knockback)
|
||||
.with_effect(buff);
|
||||
let attack = Attack::default()
|
||||
.with_damage(damage)
|
||||
.with_crit(0.5, 1.3)
|
||||
.with_effect(poise);
|
||||
.with_effect(poise)
|
||||
.with_effect(knockback);
|
||||
|
||||
// Hit attempt
|
||||
data.updater.insert(data.entity, MeleeAttack {
|
||||
|
Loading…
Reference in New Issue
Block a user