mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Changed name of Attacking comp to MeleeAttack
This commit is contained in:
parent
bb019309ea
commit
d3b75df76f
@ -11,6 +11,7 @@ use crate::{
|
||||
skills::{SkillGroupKind, SkillSet},
|
||||
Body, BuffKind, Health, HealthChange, HealthSource, Inventory, Stats,
|
||||
},
|
||||
effect,
|
||||
uid::Uid,
|
||||
util::Dir,
|
||||
};
|
||||
@ -87,19 +88,16 @@ pub struct EffectComponent {
|
||||
|
||||
impl EffectComponent {
|
||||
pub fn new(target: Option<GroupTarget>, effect: AttackEffect) -> Self {
|
||||
Self {
|
||||
target,
|
||||
effect,
|
||||
}
|
||||
Self { target, effect }
|
||||
}
|
||||
}
|
||||
|
||||
pub enum AttackEffect {
|
||||
Heal,
|
||||
Buff,
|
||||
Knockback,
|
||||
EnergyChange,
|
||||
Lifesteal,
|
||||
Heal(f32),
|
||||
Buff(effect::BuffEffect),
|
||||
Knockback(Knockback),
|
||||
EnergyChange(f32),
|
||||
Lifesteal(f32),
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, Serialize, Deserialize)]
|
||||
|
@ -170,7 +170,7 @@ impl Component for CharacterState {
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct Attacking {
|
||||
pub struct MeleeAttack {
|
||||
pub effects: Vec<(Option<GroupTarget>, Damage, PoiseChange)>,
|
||||
pub range: f32,
|
||||
pub max_angle: f32,
|
||||
@ -179,6 +179,6 @@ pub struct Attacking {
|
||||
pub knockback: Knockback,
|
||||
}
|
||||
|
||||
impl Component for Attacking {
|
||||
impl Component for MeleeAttack {
|
||||
type Storage = VecStorage<Self>;
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ pub use buff::{
|
||||
Buff, BuffCategory, BuffChange, BuffData, BuffEffect, BuffId, BuffKind, BuffSource, Buffs,
|
||||
ModifierKind,
|
||||
};
|
||||
pub use character_state::{Attacking, CharacterState, StateUpdate};
|
||||
pub use character_state::{CharacterState, MeleeAttack, StateUpdate};
|
||||
pub use chat::{
|
||||
ChatMode, ChatMsg, ChatType, Faction, SpeechBubble, SpeechBubbleType, UnresolvedChatMsg,
|
||||
};
|
||||
|
@ -1,6 +1,6 @@
|
||||
use crate::{
|
||||
comp::{
|
||||
Attacking, CharacterState, EnergyChange, EnergySource, PoiseChange, PoiseSource,
|
||||
CharacterState, EnergyChange, EnergySource, MeleeAttack, PoiseChange, PoiseSource,
|
||||
StateUpdate,
|
||||
},
|
||||
states::{
|
||||
@ -93,7 +93,7 @@ impl CharacterBehavior for Data {
|
||||
});
|
||||
|
||||
// Hit attempt
|
||||
data.updater.insert(data.entity, Attacking {
|
||||
data.updater.insert(data.entity, MeleeAttack {
|
||||
effects: vec![(
|
||||
Some(GroupTarget::OutOfGroup),
|
||||
Damage {
|
||||
@ -146,21 +146,21 @@ impl CharacterBehavior for Data {
|
||||
// Done
|
||||
update.character = CharacterState::Wielding;
|
||||
// Make sure attack component is removed
|
||||
data.updater.remove::<Attacking>(data.entity);
|
||||
data.updater.remove::<MeleeAttack>(data.entity);
|
||||
}
|
||||
},
|
||||
_ => {
|
||||
// If it somehow ends up in an incorrect stage section
|
||||
update.character = CharacterState::Wielding;
|
||||
// Make sure attack component is removed
|
||||
data.updater.remove::<Attacking>(data.entity);
|
||||
data.updater.remove::<MeleeAttack>(data.entity);
|
||||
},
|
||||
}
|
||||
|
||||
// Grant energy on successful hit
|
||||
if let Some(attack) = data.attacking {
|
||||
if let Some(attack) = data.melee_attack {
|
||||
if attack.applied && attack.hit_count > 0 {
|
||||
data.updater.remove::<Attacking>(data.entity);
|
||||
data.updater.remove::<MeleeAttack>(data.entity);
|
||||
update.energy.change_by(EnergyChange {
|
||||
amount: 50,
|
||||
source: EnergySource::HitEnemy,
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::{
|
||||
comp::{
|
||||
Attacking, Beam, Body, CharacterState, ControlAction, Controller, ControllerInputs, Energy,
|
||||
Health, Inventory, Ori, PhysicsState, Pos, StateUpdate, Stats, Vel,
|
||||
Beam, Body, CharacterState, ControlAction, Controller, ControllerInputs, Energy, Health,
|
||||
Inventory, MeleeAttack, Ori, PhysicsState, Pos, StateUpdate, Stats, Vel,
|
||||
},
|
||||
resources::DeltaTime,
|
||||
uid::Uid,
|
||||
@ -57,7 +57,7 @@ pub struct JoinData<'a> {
|
||||
pub inventory: &'a Inventory,
|
||||
pub body: &'a Body,
|
||||
pub physics: &'a PhysicsState,
|
||||
pub attacking: Option<&'a Attacking>,
|
||||
pub melee_attack: Option<&'a MeleeAttack>,
|
||||
pub updater: &'a LazyUpdate,
|
||||
pub stats: &'a Stats,
|
||||
}
|
||||
@ -84,7 +84,7 @@ pub type JoinTuple<'a> = (
|
||||
&'a Health,
|
||||
&'a Body,
|
||||
&'a PhysicsState,
|
||||
Option<&'a Attacking>,
|
||||
Option<&'a MeleeAttack>,
|
||||
Option<&'a Beam>,
|
||||
&'a Stats,
|
||||
);
|
||||
@ -105,7 +105,7 @@ impl<'a> JoinData<'a> {
|
||||
health: j.9,
|
||||
body: j.10,
|
||||
physics: j.11,
|
||||
attacking: j.12,
|
||||
melee_attack: j.12,
|
||||
stats: j.14,
|
||||
updater,
|
||||
dt,
|
||||
|
@ -1,6 +1,6 @@
|
||||
use crate::{
|
||||
comp::{
|
||||
Attacking, CharacterState, EnergyChange, EnergySource, PoiseChange, PoiseSource,
|
||||
CharacterState, EnergyChange, EnergySource, MeleeAttack, PoiseChange, PoiseSource,
|
||||
StateUpdate,
|
||||
},
|
||||
states::{
|
||||
@ -170,7 +170,7 @@ impl CharacterBehavior for Data {
|
||||
+ self.charge_amount * self.static_data.scaled_knockback;
|
||||
|
||||
// Hit attempt
|
||||
data.updater.insert(data.entity, Attacking {
|
||||
data.updater.insert(data.entity, MeleeAttack {
|
||||
effects: vec![(Some(GroupTarget::OutOfGroup), damage, poise_damage)],
|
||||
range: self.static_data.range,
|
||||
max_angle: self.static_data.max_angle.to_radians(),
|
||||
@ -213,14 +213,14 @@ impl CharacterBehavior for Data {
|
||||
// Done
|
||||
update.character = CharacterState::Wielding;
|
||||
// Make sure attack component is removed
|
||||
data.updater.remove::<Attacking>(data.entity);
|
||||
data.updater.remove::<MeleeAttack>(data.entity);
|
||||
}
|
||||
},
|
||||
_ => {
|
||||
// If it somehow ends up in an incorrect stage section
|
||||
update.character = CharacterState::Wielding;
|
||||
// Make sure attack component is removed
|
||||
data.updater.remove::<Attacking>(data.entity);
|
||||
data.updater.remove::<MeleeAttack>(data.entity);
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
use crate::{
|
||||
comp::{
|
||||
Attacking, CharacterState, EnergyChange, EnergySource, PoiseChange, PoiseSource,
|
||||
CharacterState, EnergyChange, EnergySource, MeleeAttack, PoiseChange, PoiseSource,
|
||||
StateUpdate,
|
||||
},
|
||||
states::{
|
||||
@ -181,7 +181,7 @@ impl CharacterBehavior for Data {
|
||||
.scales_from_combo
|
||||
.min(self.combo / self.static_data.num_stages)
|
||||
* self.static_data.stage_data[stage_index].poise_damage_increase;
|
||||
data.updater.insert(data.entity, Attacking {
|
||||
data.updater.insert(data.entity, MeleeAttack {
|
||||
effects: vec![(
|
||||
Some(GroupTarget::OutOfGroup),
|
||||
Damage {
|
||||
@ -273,19 +273,19 @@ impl CharacterBehavior for Data {
|
||||
// Done
|
||||
update.character = CharacterState::Wielding;
|
||||
// Make sure attack component is removed
|
||||
data.updater.remove::<Attacking>(data.entity);
|
||||
data.updater.remove::<MeleeAttack>(data.entity);
|
||||
}
|
||||
},
|
||||
_ => {
|
||||
// If it somehow ends up in an incorrect stage section
|
||||
update.character = CharacterState::Wielding;
|
||||
// Make sure attack component is removed
|
||||
data.updater.remove::<Attacking>(data.entity);
|
||||
data.updater.remove::<MeleeAttack>(data.entity);
|
||||
},
|
||||
}
|
||||
|
||||
// Grant energy on successful hit
|
||||
if let Some(attack) = data.attacking {
|
||||
if let Some(attack) = data.melee_attack {
|
||||
if attack.applied && attack.hit_count > 0 {
|
||||
let energy = self.static_data.max_energy_gain.min(
|
||||
self.static_data.initial_energy_gain
|
||||
@ -299,7 +299,7 @@ impl CharacterBehavior for Data {
|
||||
stage_section: self.stage_section,
|
||||
next_stage: self.next_stage,
|
||||
});
|
||||
data.updater.remove::<Attacking>(data.entity);
|
||||
data.updater.remove::<MeleeAttack>(data.entity);
|
||||
update.energy.change_by(EnergyChange {
|
||||
amount: energy,
|
||||
source: EnergySource::HitEnemy,
|
||||
|
@ -1,6 +1,6 @@
|
||||
use crate::{
|
||||
comp::{
|
||||
Attacking, CharacterState, EnergyChange, EnergySource, PoiseChange, PoiseSource,
|
||||
CharacterState, EnergyChange, EnergySource, MeleeAttack, PoiseChange, PoiseSource,
|
||||
StateUpdate,
|
||||
},
|
||||
states::{
|
||||
@ -145,7 +145,7 @@ impl CharacterBehavior for Data {
|
||||
};
|
||||
let knockback = self.static_data.base_knockback
|
||||
+ charge_frac * self.static_data.scaled_knockback;
|
||||
data.updater.insert(data.entity, Attacking {
|
||||
data.updater.insert(data.entity, MeleeAttack {
|
||||
effects: vec![(
|
||||
Some(GroupTarget::OutOfGroup),
|
||||
damage,
|
||||
@ -238,14 +238,14 @@ impl CharacterBehavior for Data {
|
||||
// Done
|
||||
update.character = CharacterState::Wielding;
|
||||
// Make sure attack component is removed
|
||||
data.updater.remove::<Attacking>(data.entity);
|
||||
data.updater.remove::<MeleeAttack>(data.entity);
|
||||
}
|
||||
},
|
||||
_ => {
|
||||
// If it somehow ends up in an incorrect stage section
|
||||
update.character = CharacterState::Wielding;
|
||||
// Make sure attack component is removed
|
||||
data.updater.remove::<Attacking>(data.entity);
|
||||
data.updater.remove::<MeleeAttack>(data.entity);
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
use crate::{
|
||||
comp::{Attacking, CharacterState, PoiseChange, PoiseSource, StateUpdate},
|
||||
comp::{CharacterState, MeleeAttack, PoiseChange, PoiseSource, StateUpdate},
|
||||
states::{
|
||||
behavior::{CharacterBehavior, JoinData},
|
||||
utils::{StageSection, *},
|
||||
@ -148,7 +148,7 @@ impl CharacterBehavior for Data {
|
||||
StageSection::Recover => {
|
||||
if !self.exhausted {
|
||||
// Hit attempt, when animation plays
|
||||
data.updater.insert(data.entity, Attacking {
|
||||
data.updater.insert(data.entity, MeleeAttack {
|
||||
effects: vec![(
|
||||
Some(GroupTarget::OutOfGroup),
|
||||
Damage {
|
||||
@ -191,14 +191,14 @@ impl CharacterBehavior for Data {
|
||||
// Done
|
||||
update.character = CharacterState::Wielding;
|
||||
// Make sure attack component is removed
|
||||
data.updater.remove::<Attacking>(data.entity);
|
||||
data.updater.remove::<MeleeAttack>(data.entity);
|
||||
}
|
||||
},
|
||||
_ => {
|
||||
// If it somehow ends up in an incorrect stage section
|
||||
update.character = CharacterState::Wielding;
|
||||
// Make sure attack component is removed
|
||||
data.updater.remove::<Attacking>(data.entity);
|
||||
data.updater.remove::<MeleeAttack>(data.entity);
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
use crate::{
|
||||
comp::{
|
||||
Attacking, CharacterState, EnergyChange, EnergySource, PoiseChange, PoiseSource,
|
||||
CharacterState, EnergyChange, EnergySource, MeleeAttack, PoiseChange, PoiseSource,
|
||||
StateUpdate,
|
||||
},
|
||||
consts::GRAVITY,
|
||||
@ -115,7 +115,7 @@ impl CharacterBehavior for Data {
|
||||
..*self
|
||||
});
|
||||
// Hit attempt
|
||||
data.updater.insert(data.entity, Attacking {
|
||||
data.updater.insert(data.entity, MeleeAttack {
|
||||
effects: vec![(
|
||||
Some(GroupTarget::OutOfGroup),
|
||||
Damage {
|
||||
@ -204,14 +204,14 @@ impl CharacterBehavior for Data {
|
||||
// Done
|
||||
update.character = CharacterState::Wielding;
|
||||
// Make sure attack component is removed
|
||||
data.updater.remove::<Attacking>(data.entity);
|
||||
data.updater.remove::<MeleeAttack>(data.entity);
|
||||
}
|
||||
},
|
||||
_ => {
|
||||
// If it somehow ends up in an incorrect stage section
|
||||
update.character = CharacterState::Wielding;
|
||||
// Make sure attack component is removed
|
||||
data.updater.remove::<Attacking>(data.entity);
|
||||
data.updater.remove::<MeleeAttack>(data.entity);
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,7 @@ use specs::{Entities, Join, LazyUpdate, Read, ReadExpect, ReadStorage, System, W
|
||||
use common::{
|
||||
comp::{
|
||||
inventory::slot::{EquipSlot, Slot},
|
||||
Attacking, Beam, Body, CharacterState, Controller, Energy, Health, Inventory, Mounting,
|
||||
Beam, Body, CharacterState, Controller, Energy, Health, Inventory, MeleeAttack, Mounting,
|
||||
Ori, PhysicsState, Poise, PoiseState, Pos, StateUpdate, Stats, Vel,
|
||||
},
|
||||
event::{EventBus, LocalEvent, ServerEvent},
|
||||
@ -69,7 +69,7 @@ impl<'a> System<'a> for Sys {
|
||||
WriteStorage<'a, Poise>,
|
||||
ReadStorage<'a, Body>,
|
||||
ReadStorage<'a, PhysicsState>,
|
||||
ReadStorage<'a, Attacking>,
|
||||
ReadStorage<'a, MeleeAttack>,
|
||||
ReadStorage<'a, Beam>,
|
||||
ReadStorage<'a, Uid>,
|
||||
ReadStorage<'a, Mounting>,
|
||||
|
@ -1,5 +1,5 @@
|
||||
use common::{
|
||||
comp::{buff, group, Attacking, Body, CharacterState, Health, Inventory, Ori, Pos, Scale},
|
||||
comp::{buff, group, Body, CharacterState, Health, Inventory, MeleeAttack, Ori, Pos, Scale},
|
||||
event::{EventBus, LocalEvent, ServerEvent},
|
||||
metrics::SysMetrics,
|
||||
span,
|
||||
@ -30,7 +30,7 @@ impl<'a> System<'a> for Sys {
|
||||
ReadStorage<'a, Health>,
|
||||
ReadStorage<'a, Inventory>,
|
||||
ReadStorage<'a, group::Group>,
|
||||
WriteStorage<'a, Attacking>,
|
||||
WriteStorage<'a, MeleeAttack>,
|
||||
ReadStorage<'a, CharacterState>,
|
||||
);
|
||||
|
||||
|
@ -163,7 +163,7 @@ impl State {
|
||||
ecs.register::<comp::Admin>();
|
||||
ecs.register::<comp::Waypoint>();
|
||||
ecs.register::<comp::Projectile>();
|
||||
ecs.register::<comp::Attacking>();
|
||||
ecs.register::<comp::MeleeAttack>();
|
||||
ecs.register::<comp::ItemDrop>();
|
||||
ecs.register::<comp::ChatMode>();
|
||||
ecs.register::<comp::Faction>();
|
||||
|
Loading…
Reference in New Issue
Block a user