mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'snowram/buffs-immunity' into 'master'
Allows some species to be immune to specific buffs See merge request veloren/veloren!1800
This commit is contained in:
commit
63c72f77f1
@ -68,6 +68,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Fixed missing controller actions (dance and crafting)
|
||||
- Fixed a bug where the stairs to the boss floor in dungeons would sometimes not spawn
|
||||
- Fixed waypoints being placed underwater
|
||||
- Objects and golems are not affected by bleed debuff anymore
|
||||
|
||||
## [0.8.0] - 2020-11-28
|
||||
|
||||
|
@ -22,6 +22,8 @@ use specs::{Component, DerefFlaggedStorage};
|
||||
use specs_idvs::IdvStorage;
|
||||
use vek::*;
|
||||
|
||||
use super::BuffKind;
|
||||
|
||||
make_case_elim!(
|
||||
body,
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
@ -439,6 +441,13 @@ impl Body {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn immune_to(&self, buff: BuffKind) -> bool {
|
||||
match buff {
|
||||
BuffKind::Bleeding => matches!(self, Body::Object(_) | Body::Golem(_)),
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns a multiplier representing increased difficulty not accounted for
|
||||
/// due to AI or not using an actual weapon
|
||||
// TODO: Match on species
|
||||
|
@ -776,11 +776,17 @@ pub fn handle_aura(server: &mut Server, entity: EcsEntity, aura_change: aura::Au
|
||||
pub fn handle_buff(server: &mut Server, entity: EcsEntity, buff_change: buff::BuffChange) {
|
||||
let ecs = &server.state.ecs();
|
||||
let mut buffs_all = ecs.write_storage::<comp::Buffs>();
|
||||
let bodies = ecs.read_storage::<comp::Body>();
|
||||
if let Some(mut buffs) = buffs_all.get_mut(entity) {
|
||||
use buff::BuffChange;
|
||||
match buff_change {
|
||||
BuffChange::Add(new_buff) => {
|
||||
buffs.insert(new_buff);
|
||||
if !bodies
|
||||
.get(entity)
|
||||
.map_or(false, |body| body.immune_to(new_buff.kind))
|
||||
{
|
||||
buffs.insert(new_buff);
|
||||
}
|
||||
},
|
||||
BuffChange::RemoveById(ids) => {
|
||||
for id in ids {
|
||||
|
Loading…
Reference in New Issue
Block a user