mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Changed how buffs were constructed on projectiles.
This commit is contained in:
parent
f4244ecbaf
commit
abf7301a89
assets/common/abilities/bow
common/src
@ -12,18 +12,17 @@ BasicRanged(
|
|||||||
Knockback(Away(10.0)),
|
Knockback(Away(10.0)),
|
||||||
RewardEnergy(50),
|
RewardEnergy(50),
|
||||||
Vanish,
|
Vanish,
|
||||||
/*projectile::Effect::Buff {
|
Buff(
|
||||||
buff: Buff::new(
|
buff: (
|
||||||
BuffKind::Bleeding,
|
kind: Bleeding,
|
||||||
BuffData {
|
data: (
|
||||||
strength: 20.0 * self.base_power(),
|
strength: 20.0,
|
||||||
duration: Some(Duration::from_secs(5)),
|
duration: Some(5), // secs
|
||||||
},
|
),
|
||||||
vec![BuffCategory::Physical],
|
cat_ids: [Physical],
|
||||||
BuffSource::Unknown,
|
|
||||||
),
|
),
|
||||||
chance: Some(0.10),
|
chance: Some(0.10),
|
||||||
},*/
|
),
|
||||||
],
|
],
|
||||||
time_left: 15, // seconds
|
time_left: 15, // seconds
|
||||||
owner: None,
|
owner: None,
|
||||||
|
@ -14,18 +14,17 @@ RepeaterRanged(
|
|||||||
)),
|
)),
|
||||||
Knockback(Away(10.0)),
|
Knockback(Away(10.0)),
|
||||||
Vanish,
|
Vanish,
|
||||||
/*projectile::Effect::Buff {
|
Buff(
|
||||||
buff: Buff::new(
|
buff: (
|
||||||
BuffKind::Bleeding,
|
kind: Bleeding,
|
||||||
BuffData {
|
data: (
|
||||||
strength: 20.0 * self.base_power(),
|
strength: 20.0,
|
||||||
duration: Some(Duration::from_secs(5)),
|
duration: Some(5), // secs
|
||||||
},
|
),
|
||||||
vec![BuffCategory::Physical],
|
cat_ids: [Physical],
|
||||||
BuffSource::Unknown,
|
|
||||||
),
|
),
|
||||||
chance: Some(0.10),
|
chance: Some(0.10),
|
||||||
},*/
|
),
|
||||||
],
|
],
|
||||||
time_left: 15, // seconds
|
time_left: 15, // seconds
|
||||||
owner: None,
|
owner: None,
|
||||||
|
@ -4,10 +4,10 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
comp::{
|
comp::{
|
||||||
body::object,
|
body::object,
|
||||||
buff::{Buff, BuffCategory, BuffData, BuffKind, BuffSource},
|
buff::{BuffCategory, BuffData, BuffKind},
|
||||||
projectile, Body, CharacterAbility, Gravity, LightEmitter, Projectile,
|
projectile, Body, CharacterAbility, Gravity, LightEmitter, Projectile,
|
||||||
},
|
},
|
||||||
effect::Effect,
|
effect::{BuffEffect, Effect},
|
||||||
states::combo_melee,
|
states::combo_melee,
|
||||||
Damage, DamageSource, Explosion, GroupTarget, Knockback, RadiusEffect,
|
Damage, DamageSource, Explosion, GroupTarget, Knockback, RadiusEffect,
|
||||||
};
|
};
|
||||||
@ -324,15 +324,14 @@ impl Tool {
|
|||||||
projectile::Effect::RewardEnergy(50),
|
projectile::Effect::RewardEnergy(50),
|
||||||
projectile::Effect::Vanish,
|
projectile::Effect::Vanish,
|
||||||
projectile::Effect::Buff {
|
projectile::Effect::Buff {
|
||||||
buff: Buff::new(
|
buff: BuffEffect {
|
||||||
BuffKind::Bleeding,
|
kind: BuffKind::Bleeding,
|
||||||
BuffData {
|
data: BuffData {
|
||||||
strength: 20.0 * self.base_power(),
|
strength: 20.0 * self.base_power(),
|
||||||
duration: Some(Duration::from_secs(5)),
|
duration: Some(Duration::from_secs(5)),
|
||||||
},
|
},
|
||||||
vec![BuffCategory::Physical],
|
cat_ids: vec![BuffCategory::Physical],
|
||||||
BuffSource::Unknown,
|
},
|
||||||
),
|
|
||||||
chance: Some(0.10),
|
chance: Some(0.10),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@ -380,15 +379,14 @@ impl Tool {
|
|||||||
projectile::Effect::Knockback(Knockback::Away(10.0)),
|
projectile::Effect::Knockback(Knockback::Away(10.0)),
|
||||||
projectile::Effect::Vanish,
|
projectile::Effect::Vanish,
|
||||||
projectile::Effect::Buff {
|
projectile::Effect::Buff {
|
||||||
buff: Buff::new(
|
buff: BuffEffect {
|
||||||
BuffKind::Bleeding,
|
kind: BuffKind::Bleeding,
|
||||||
BuffData {
|
data: BuffData {
|
||||||
strength: 20.0 * self.base_power(),
|
strength: 20.0 * self.base_power(),
|
||||||
duration: Some(Duration::from_secs(5)),
|
duration: Some(Duration::from_secs(5)),
|
||||||
},
|
},
|
||||||
vec![BuffCategory::Physical],
|
cat_ids: vec![BuffCategory::Physical],
|
||||||
BuffSource::Unknown,
|
},
|
||||||
),
|
|
||||||
chance: Some(0.10),
|
chance: Some(0.10),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use crate::{comp::Buff, sync::Uid, Damage, Explosion, GroupTarget, Knockback};
|
use crate::{effect::BuffEffect, sync::Uid, Damage, Explosion, GroupTarget, Knockback};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use specs::{Component, FlaggedStorage};
|
use specs::{Component, FlaggedStorage};
|
||||||
use specs_idvs::IdvStorage;
|
use specs_idvs::IdvStorage;
|
||||||
@ -13,7 +13,10 @@ pub enum Effect {
|
|||||||
Vanish,
|
Vanish,
|
||||||
Stick,
|
Stick,
|
||||||
Possess,
|
Possess,
|
||||||
Buff { buff: Buff, chance: Option<f32> },
|
Buff {
|
||||||
|
buff: BuffEffect,
|
||||||
|
chance: Option<f32>,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
comp::{
|
comp::{
|
||||||
buff::{Buff, BuffCategory, BuffData, BuffKind, BuffSource},
|
buff::{BuffCategory, BuffData, BuffKind},
|
||||||
projectile, Body, CharacterState, EnergyChange, EnergySource, Gravity, LightEmitter,
|
projectile, Body, CharacterState, EnergyChange, EnergySource, Gravity, LightEmitter,
|
||||||
Projectile, StateUpdate,
|
Projectile, StateUpdate,
|
||||||
},
|
},
|
||||||
|
effect::BuffEffect,
|
||||||
event::ServerEvent,
|
event::ServerEvent,
|
||||||
states::utils::*,
|
states::utils::*,
|
||||||
sys::character_behavior::{CharacterBehavior, JoinData},
|
sys::character_behavior::{CharacterBehavior, JoinData},
|
||||||
@ -105,15 +106,14 @@ impl CharacterBehavior for Data {
|
|||||||
projectile::Effect::Knockback(Knockback::Away(knockback)),
|
projectile::Effect::Knockback(Knockback::Away(knockback)),
|
||||||
projectile::Effect::Vanish,
|
projectile::Effect::Vanish,
|
||||||
projectile::Effect::Buff {
|
projectile::Effect::Buff {
|
||||||
buff: Buff::new(
|
buff: BuffEffect {
|
||||||
BuffKind::Bleeding,
|
kind: BuffKind::Bleeding,
|
||||||
BuffData {
|
data: BuffData {
|
||||||
strength: damage.value / 5.0,
|
strength: damage.value / 5.0,
|
||||||
duration: Some(Duration::from_secs(5)),
|
duration: Some(Duration::from_secs(5)),
|
||||||
},
|
},
|
||||||
vec![BuffCategory::Physical],
|
cat_ids: vec![BuffCategory::Physical],
|
||||||
BuffSource::Unknown,
|
},
|
||||||
),
|
|
||||||
chance: Some(0.10),
|
chance: Some(0.10),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
comp::{
|
comp::{
|
||||||
buff::{BuffChange, BuffSource},
|
buff::{Buff, BuffChange, BuffSource},
|
||||||
projectile, EnergyChange, EnergySource, Group, HealthSource, Loadout, Ori, PhysicsState,
|
projectile, EnergyChange, EnergySource, Group, HealthSource, Loadout, Ori, PhysicsState,
|
||||||
Pos, Projectile, Vel,
|
Pos, Projectile, Vel,
|
||||||
},
|
},
|
||||||
@ -176,10 +176,13 @@ impl<'a> System<'a> for Sys {
|
|||||||
uid_allocator.retrieve_entity_internal(other.into())
|
uid_allocator.retrieve_entity_internal(other.into())
|
||||||
{
|
{
|
||||||
if chance.map_or(true, |c| thread_rng().gen::<f32>() < c) {
|
if chance.map_or(true, |c| thread_rng().gen::<f32>() < c) {
|
||||||
let mut buff = buff.clone();
|
let source = if let Some(owner) = projectile.owner {
|
||||||
if let Some(uid) = projectile.owner {
|
BuffSource::Character { by: owner }
|
||||||
buff.source = BuffSource::Character { by: uid };
|
} else {
|
||||||
}
|
BuffSource::Unknown
|
||||||
|
};
|
||||||
|
let buff =
|
||||||
|
Buff::new(buff.kind, buff.data, buff.cat_ids, source);
|
||||||
server_emitter.emit(ServerEvent::Buff {
|
server_emitter.emit(ServerEvent::Buff {
|
||||||
entity,
|
entity,
|
||||||
buff_change: BuffChange::Add(buff),
|
buff_change: BuffChange::Add(buff),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user