diff --git a/models/src/bundle/passive.rs b/models/src/bundle/passive.rs index aca3091..ee40aac 100644 --- a/models/src/bundle/passive.rs +++ b/models/src/bundle/passive.rs @@ -178,6 +178,12 @@ pub struct FactionUpgrades { pub side_effects: u16, } +#[derive(Component, Default)] +#[cfg_attr(feature = "json", derive(serde::Deserialize))] +pub struct Property { + pub damage: bool, +} + #[derive(Component)] #[cfg_attr(feature = "json", derive(serde::Deserialize))] pub enum DrugCooldown { @@ -204,4 +210,5 @@ pub(crate) struct PassiveBundle { pub merits: Merits, pub education: Education, pub faction: FactionUpgrades, + pub property: Property, } diff --git a/models/src/dto/player.rs b/models/src/dto/player.rs index 377df11..c3fbcf4 100644 --- a/models/src/dto/player.rs +++ b/models/src/dto/player.rs @@ -3,7 +3,7 @@ use bevy_ecs::prelude::*; use crate::{ bundle::{ armour::PlayerArmour, - passive::{DrugCooldown, Education, FactionUpgrades, Merits, PassiveBundle}, + passive::{DrugCooldown, Education, FactionUpgrades, Merits, PassiveBundle, Property}, player::{PlayerBundle, PlayerStrategy, Weapons}, stat::{Defence, Dexterity, Speed, StatBundle, Strength}, }, @@ -43,6 +43,7 @@ pub struct PlayerDto { pub stats: Stats, pub merits: Option, pub education: Option, + pub property: Option, pub weapons: EquippedWeapons, pub armour: EquippedArmour, pub faction: Option, @@ -65,11 +66,13 @@ impl PlayerDto { let education = self.education.unwrap_or_default(); let merits = self.merits.unwrap_or_default(); let faction = self.faction.unwrap_or_default(); + let property = self.property.unwrap_or_default(); commands.insert(PassiveBundle { education, merits, faction, + property, }); let mut weapons = None; diff --git a/src/weapon/mod.rs b/src/weapon/mod.rs index 6b2665e..2f66730 100644 --- a/src/weapon/mod.rs +++ b/src/weapon/mod.rs @@ -1,6 +1,6 @@ use bevy_ecs::prelude::*; use proxisim_models::bundle::{ - passive::{Education, EducationPartDamageBonus, FactionUpgrades, Merits}, + passive::{Education, EducationPartDamageBonus, FactionUpgrades, Merits, Property}, player::{Current, PartDamageBonus}, stat::{ AdditiveBonus, AmmoControl, ClipSize, Clips, CritRate, DamageBonus, Dexterity, @@ -169,7 +169,7 @@ fn apply_passives( Has, &ChildOf, )>, - player_q: Query<(&Merits, &Education, &FactionUpgrades)>, + player_q: Query<(&Merits, &Education, &FactionUpgrades, &Property)>, mut effects: Effects, mut commands: Commands, ) { @@ -354,7 +354,7 @@ fn apply_passives( } } - let (merits, education, faction) = player_q.get(player.parent()).unwrap(); + let (merits, education, faction, property) = player_q.get(player.parent()).unwrap(); let (mastery, edu_acc) = match cat { WeaponCategory::HeavyArtillery => ( @@ -458,6 +458,13 @@ fn apply_passives( weapon, ); } + + if property.damage { + effects.spawn( + SimpleStatBonus::::new("property", 0.02), + weapon, + ); + } } }